-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: updated doc for speech mode PiperOrigin-RevId: 586469693 Source-Link: googleapis/googleapis@e8148d6 Source-Link: googleapis/googleapis-gen@85136bd Copy-Tag: eyJwIjoiRGlhbG9nZmxvd0N4Ly5Pd2xCb3QueWFtbCIsImgiOiI4NTEzNmJkMDQzODNlZDcxNzJiYjE4YjdiOGQyMjBkZDdmZjZiM2EwIn0=
- Loading branch information
1 parent
b43313e
commit 8a35600
Showing
48 changed files
with
5,299 additions
and
12 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
85 changes: 85 additions & 0 deletions
85
DialogflowCx/samples/V3/GeneratorsClient/create_generator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START dialogflow_v3_generated_Generators_CreateGenerator_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\Dialogflow\Cx\V3\Generator; | ||
use Google\Cloud\Dialogflow\Cx\V3\GeneratorsClient; | ||
use Google\Cloud\Dialogflow\Cx\V3\Phrase; | ||
|
||
/** | ||
* Creates a generator in the specified agent. | ||
* | ||
* @param string $formattedParent The agent to create a generator for. | ||
* Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. Please see | ||
* {@see GeneratorsClient::agentName()} for help formatting this field. | ||
* @param string $generatorDisplayName The human-readable name of the generator, unique within the | ||
* agent. The prompt contains pre-defined parameters such as $conversation, | ||
* $last-user-utterance, etc. populated by Dialogflow. It can also contain | ||
* custom placeholders which will be resolved during fulfillment. | ||
* @param string $generatorPromptTextText Text input which can be used for prompt or banned phrases. | ||
*/ | ||
function create_generator_sample( | ||
string $formattedParent, | ||
string $generatorDisplayName, | ||
string $generatorPromptTextText | ||
): void { | ||
// Create a client. | ||
$generatorsClient = new GeneratorsClient(); | ||
|
||
// Prepare any non-scalar elements to be passed along with the request. | ||
$generatorPromptText = (new Phrase()) | ||
->setText($generatorPromptTextText); | ||
$generator = (new Generator()) | ||
->setDisplayName($generatorDisplayName) | ||
->setPromptText($generatorPromptText); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var Generator $response */ | ||
$response = $generatorsClient->createGenerator($formattedParent, $generator); | ||
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); | ||
} catch (ApiException $ex) { | ||
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Helper to execute the sample. | ||
* | ||
* This sample has been automatically generated and should be regarded as a code | ||
* template only. It will require modifications to work: | ||
* - It may require correct/in-range values for request initialization. | ||
* - It may require specifying regional endpoints when creating the service client, | ||
* please see the apiEndpoint client configuration option for more details. | ||
*/ | ||
function callSample(): void | ||
{ | ||
$formattedParent = GeneratorsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); | ||
$generatorDisplayName = '[DISPLAY_NAME]'; | ||
$generatorPromptTextText = '[TEXT]'; | ||
|
||
create_generator_sample($formattedParent, $generatorDisplayName, $generatorPromptTextText); | ||
} | ||
// [END dialogflow_v3_generated_Generators_CreateGenerator_sync] |
71 changes: 71 additions & 0 deletions
71
DialogflowCx/samples/V3/GeneratorsClient/delete_generator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START dialogflow_v3_generated_Generators_DeleteGenerator_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\Dialogflow\Cx\V3\GeneratorsClient; | ||
|
||
/** | ||
* Deletes the specified generators. | ||
* | ||
* @param string $formattedName The name of the generator to delete. | ||
* Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent | ||
* ID>/generators/<Generator ID>`. Please see | ||
* {@see GeneratorsClient::generatorName()} for help formatting this field. | ||
*/ | ||
function delete_generator_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$generatorsClient = new GeneratorsClient(); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
$generatorsClient->deleteGenerator($formattedName); | ||
printf('Call completed successfully.' . PHP_EOL); | ||
} catch (ApiException $ex) { | ||
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Helper to execute the sample. | ||
* | ||
* This sample has been automatically generated and should be regarded as a code | ||
* template only. It will require modifications to work: | ||
* - It may require correct/in-range values for request initialization. | ||
* - It may require specifying regional endpoints when creating the service client, | ||
* please see the apiEndpoint client configuration option for more details. | ||
*/ | ||
function callSample(): void | ||
{ | ||
$formattedName = GeneratorsClient::generatorName( | ||
'[PROJECT]', | ||
'[LOCATION]', | ||
'[AGENT]', | ||
'[GENERATOR]' | ||
); | ||
|
||
delete_generator_sample($formattedName); | ||
} | ||
// [END dialogflow_v3_generated_Generators_DeleteGenerator_sync] |
73 changes: 73 additions & 0 deletions
73
DialogflowCx/samples/V3/GeneratorsClient/get_generator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START dialogflow_v3_generated_Generators_GetGenerator_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\Dialogflow\Cx\V3\Generator; | ||
use Google\Cloud\Dialogflow\Cx\V3\GeneratorsClient; | ||
|
||
/** | ||
* Retrieves the specified generator. | ||
* | ||
* @param string $formattedName The name of the generator. | ||
* Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent | ||
* ID>/generators/<Generator ID>`. Please see | ||
* {@see GeneratorsClient::generatorName()} for help formatting this field. | ||
*/ | ||
function get_generator_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$generatorsClient = new GeneratorsClient(); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var Generator $response */ | ||
$response = $generatorsClient->getGenerator($formattedName); | ||
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); | ||
} catch (ApiException $ex) { | ||
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Helper to execute the sample. | ||
* | ||
* This sample has been automatically generated and should be regarded as a code | ||
* template only. It will require modifications to work: | ||
* - It may require correct/in-range values for request initialization. | ||
* - It may require specifying regional endpoints when creating the service client, | ||
* please see the apiEndpoint client configuration option for more details. | ||
*/ | ||
function callSample(): void | ||
{ | ||
$formattedName = GeneratorsClient::generatorName( | ||
'[PROJECT]', | ||
'[LOCATION]', | ||
'[AGENT]', | ||
'[GENERATOR]' | ||
); | ||
|
||
get_generator_sample($formattedName); | ||
} | ||
// [END dialogflow_v3_generated_Generators_GetGenerator_sync] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START dialogflow_v3_generated_Generators_GetLocation_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\Dialogflow\Cx\V3\GeneratorsClient; | ||
use Google\Cloud\Location\Location; | ||
|
||
/** | ||
* Gets information about a location. | ||
* | ||
* This sample has been automatically generated and should be regarded as a code | ||
* template only. It will require modifications to work: | ||
* - It may require correct/in-range values for request initialization. | ||
* - It may require specifying regional endpoints when creating the service client, | ||
* please see the apiEndpoint client configuration option for more details. | ||
*/ | ||
function get_location_sample(): void | ||
{ | ||
// Create a client. | ||
$generatorsClient = new GeneratorsClient(); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var Location $response */ | ||
$response = $generatorsClient->getLocation(); | ||
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); | ||
} catch (ApiException $ex) { | ||
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); | ||
} | ||
} | ||
// [END dialogflow_v3_generated_Generators_GetLocation_sync] |
Oops, something went wrong.