diff --git a/Dialogflow/metadata/V2/Conversation.php b/Dialogflow/metadata/V2/Conversation.php index d1e672c0b266..5e239a2dfa18 100644 Binary files a/Dialogflow/metadata/V2/Conversation.php and b/Dialogflow/metadata/V2/Conversation.php differ diff --git a/Dialogflow/src/V2/Client/ConversationsClient.php b/Dialogflow/src/V2/Client/ConversationsClient.php index ca6086877882..71d21a319ba7 100644 --- a/Dialogflow/src/V2/Client/ConversationsClient.php +++ b/Dialogflow/src/V2/Client/ConversationsClient.php @@ -212,6 +212,27 @@ public static function conversationProfileName(string $project, string $conversa ]); } + /** + * Formats a string containing the fully-qualified path to represent a data_store + * resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * + * @return string The formatted data_store resource. + */ + public static function dataStoreName(string $project, string $location, string $collection, string $dataStore): string + { + return self::getPathTemplate('dataStore')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a document * resource. @@ -475,6 +496,27 @@ public static function projectLocationAgentName(string $project, string $locatio ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_data_store resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * + * @return string The formatted project_location_collection_data_store resource. + */ + public static function projectLocationCollectionDataStoreName(string $project, string $location, string $collection, string $dataStore): string + { + return self::getPathTemplate('projectLocationCollectionDataStore')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_conversation resource. @@ -553,6 +595,25 @@ public static function projectLocationConversationProfileName(string $project, s ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_data_store resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * + * @return string The formatted project_location_data_store resource. + */ + public static function projectLocationDataStoreName(string $project, string $location, string $dataStore): string + { + return self::getPathTemplate('projectLocationDataStore')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_knowledge_base resource. @@ -602,6 +663,7 @@ public static function projectLocationKnowledgeBaseDocumentName(string $project, * - conversation: projects/{project}/conversations/{conversation} * - conversationModel: projects/{project}/locations/{location}/conversationModels/{conversation_model} * - conversationProfile: projects/{project}/conversationProfiles/{conversation_profile} + * - dataStore: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store} * - document: projects/{project}/knowledgeBases/{knowledge_base}/documents/{document} * - generator: projects/{project}/locations/{location}/generators/{generator} * - knowledgeBase: projects/{project}/knowledgeBases/{knowledge_base} @@ -617,10 +679,12 @@ public static function projectLocationKnowledgeBaseDocumentName(string $project, * - projectKnowledgeBase: projects/{project}/knowledgeBases/{knowledge_base} * - projectKnowledgeBaseDocument: projects/{project}/knowledgeBases/{knowledge_base}/documents/{document} * - projectLocationAgent: projects/{project}/locations/{location}/agent + * - projectLocationCollectionDataStore: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store} * - projectLocationConversation: projects/{project}/locations/{location}/conversations/{conversation} * - projectLocationConversationMessage: projects/{project}/locations/{location}/conversations/{conversation}/messages/{message} * - projectLocationConversationModel: projects/{project}/locations/{location}/conversationModels/{conversation_model} * - projectLocationConversationProfile: projects/{project}/locations/{location}/conversationProfiles/{conversation_profile} + * - projectLocationDataStore: projects/{project}/locations/{location}/dataStores/{data_store} * - projectLocationKnowledgeBase: projects/{project}/locations/{location}/knowledgeBases/{knowledge_base} * - projectLocationKnowledgeBaseDocument: projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document} * diff --git a/Dialogflow/src/V2/CreateConversationRequest.php b/Dialogflow/src/V2/CreateConversationRequest.php index a33fc3de87b3..cbd54bc03863 100644 --- a/Dialogflow/src/V2/CreateConversationRequest.php +++ b/Dialogflow/src/V2/CreateConversationRequest.php @@ -33,9 +33,9 @@ class CreateConversationRequest extends \Google\Protobuf\Internal\Message * Optional. Identifier of the conversation. Generally it's auto generated by * Google. Only set it if you cannot wait for the response to return a * auto-generated one to you. - * The conversation ID must be compliant with the regression fomula + * The conversation ID must be compliant with the regression formula * `[a-zA-Z][a-zA-Z0-9_-]*` with the characters length in range of [3,64]. - * If the field is provided, the caller is resposible for + * If the field is provided, the caller is responsible for * 1. the uniqueness of the ID, otherwise the request will be rejected. * 2. the consistency for whether to use custom ID or not under a project to * better ensure uniqueness. @@ -76,9 +76,9 @@ public static function build(string $parent, \Google\Cloud\Dialogflow\V2\Convers * Optional. Identifier of the conversation. Generally it's auto generated by * Google. Only set it if you cannot wait for the response to return a * auto-generated one to you. - * The conversation ID must be compliant with the regression fomula + * The conversation ID must be compliant with the regression formula * `[a-zA-Z][a-zA-Z0-9_-]*` with the characters length in range of [3,64]. - * If the field is provided, the caller is resposible for + * If the field is provided, the caller is responsible for * 1. the uniqueness of the ID, otherwise the request will be rejected. * 2. the consistency for whether to use custom ID or not under a project to * better ensure uniqueness. @@ -157,9 +157,9 @@ public function setConversation($var) * Optional. Identifier of the conversation. Generally it's auto generated by * Google. Only set it if you cannot wait for the response to return a * auto-generated one to you. - * The conversation ID must be compliant with the regression fomula + * The conversation ID must be compliant with the regression formula * `[a-zA-Z][a-zA-Z0-9_-]*` with the characters length in range of [3,64]. - * If the field is provided, the caller is resposible for + * If the field is provided, the caller is responsible for * 1. the uniqueness of the ID, otherwise the request will be rejected. * 2. the consistency for whether to use custom ID or not under a project to * better ensure uniqueness. @@ -176,9 +176,9 @@ public function getConversationId() * Optional. Identifier of the conversation. Generally it's auto generated by * Google. Only set it if you cannot wait for the response to return a * auto-generated one to you. - * The conversation ID must be compliant with the regression fomula + * The conversation ID must be compliant with the regression formula * `[a-zA-Z][a-zA-Z0-9_-]*` with the characters length in range of [3,64]. - * If the field is provided, the caller is resposible for + * If the field is provided, the caller is responsible for * 1. the uniqueness of the ID, otherwise the request will be rejected. * 2. the consistency for whether to use custom ID or not under a project to * better ensure uniqueness. diff --git a/Dialogflow/src/V2/FewShotExample.php b/Dialogflow/src/V2/FewShotExample.php index f0cabe72ebd2..220f2f680618 100644 --- a/Dialogflow/src/V2/FewShotExample.php +++ b/Dialogflow/src/V2/FewShotExample.php @@ -11,7 +11,6 @@ /** * Providing examples in the generator (i.e. building a few-shot generator) * helps convey the desired format of the LLM response. - * NEXT_ID: 10 * * Generated from protobuf message google.cloud.dialogflow.v2.FewShotExample */ diff --git a/Dialogflow/src/V2/Gapic/ConversationsGapicClient.php b/Dialogflow/src/V2/Gapic/ConversationsGapicClient.php index fcd99409ebe5..5a9bfa074338 100644 --- a/Dialogflow/src/V2/Gapic/ConversationsGapicClient.php +++ b/Dialogflow/src/V2/Gapic/ConversationsGapicClient.php @@ -52,6 +52,7 @@ use Google\Cloud\Dialogflow\V2\ListMessagesRequest; use Google\Cloud\Dialogflow\V2\ListMessagesResponse; use Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest; +use Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig; use Google\Cloud\Dialogflow\V2\SearchKnowledgeResponse; use Google\Cloud\Dialogflow\V2\SuggestConversationSummaryRequest; use Google\Cloud\Dialogflow\V2\SuggestConversationSummaryResponse; @@ -60,6 +61,7 @@ use Google\Cloud\Location\ListLocationsRequest; use Google\Cloud\Location\ListLocationsResponse; use Google\Cloud\Location\Location; +use Google\Protobuf\Struct; /** * Service Description: Service for managing @@ -124,6 +126,8 @@ class ConversationsGapicClient private static $conversationProfileNameTemplate; + private static $dataStoreNameTemplate; + private static $documentNameTemplate; private static $generatorNameTemplate; @@ -154,6 +158,8 @@ class ConversationsGapicClient private static $projectLocationAgentNameTemplate; + private static $projectLocationCollectionDataStoreNameTemplate; + private static $projectLocationConversationNameTemplate; private static $projectLocationConversationMessageNameTemplate; @@ -162,6 +168,8 @@ class ConversationsGapicClient private static $projectLocationConversationProfileNameTemplate; + private static $projectLocationDataStoreNameTemplate; + private static $projectLocationKnowledgeBaseNameTemplate; private static $projectLocationKnowledgeBaseDocumentNameTemplate; @@ -232,6 +240,15 @@ private static function getConversationProfileNameTemplate() return self::$conversationProfileNameTemplate; } + private static function getDataStoreNameTemplate() + { + if (self::$dataStoreNameTemplate == null) { + self::$dataStoreNameTemplate = new PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}'); + } + + return self::$dataStoreNameTemplate; + } + private static function getDocumentNameTemplate() { if (self::$documentNameTemplate == null) { @@ -367,6 +384,15 @@ private static function getProjectLocationAgentNameTemplate() return self::$projectLocationAgentNameTemplate; } + private static function getProjectLocationCollectionDataStoreNameTemplate() + { + if (self::$projectLocationCollectionDataStoreNameTemplate == null) { + self::$projectLocationCollectionDataStoreNameTemplate = new PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}'); + } + + return self::$projectLocationCollectionDataStoreNameTemplate; + } + private static function getProjectLocationConversationNameTemplate() { if (self::$projectLocationConversationNameTemplate == null) { @@ -403,6 +429,15 @@ private static function getProjectLocationConversationProfileNameTemplate() return self::$projectLocationConversationProfileNameTemplate; } + private static function getProjectLocationDataStoreNameTemplate() + { + if (self::$projectLocationDataStoreNameTemplate == null) { + self::$projectLocationDataStoreNameTemplate = new PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}'); + } + + return self::$projectLocationDataStoreNameTemplate; + } + private static function getProjectLocationKnowledgeBaseNameTemplate() { if (self::$projectLocationKnowledgeBaseNameTemplate == null) { @@ -430,6 +465,7 @@ private static function getPathTemplateMap() 'conversation' => self::getConversationNameTemplate(), 'conversationModel' => self::getConversationModelNameTemplate(), 'conversationProfile' => self::getConversationProfileNameTemplate(), + 'dataStore' => self::getDataStoreNameTemplate(), 'document' => self::getDocumentNameTemplate(), 'generator' => self::getGeneratorNameTemplate(), 'knowledgeBase' => self::getKnowledgeBaseNameTemplate(), @@ -445,10 +481,12 @@ private static function getPathTemplateMap() 'projectKnowledgeBase' => self::getProjectKnowledgeBaseNameTemplate(), 'projectKnowledgeBaseDocument' => self::getProjectKnowledgeBaseDocumentNameTemplate(), 'projectLocationAgent' => self::getProjectLocationAgentNameTemplate(), + 'projectLocationCollectionDataStore' => self::getProjectLocationCollectionDataStoreNameTemplate(), 'projectLocationConversation' => self::getProjectLocationConversationNameTemplate(), 'projectLocationConversationMessage' => self::getProjectLocationConversationMessageNameTemplate(), 'projectLocationConversationModel' => self::getProjectLocationConversationModelNameTemplate(), 'projectLocationConversationProfile' => self::getProjectLocationConversationProfileNameTemplate(), + 'projectLocationDataStore' => self::getProjectLocationDataStoreNameTemplate(), 'projectLocationKnowledgeBase' => self::getProjectLocationKnowledgeBaseNameTemplate(), 'projectLocationKnowledgeBaseDocument' => self::getProjectLocationKnowledgeBaseDocumentNameTemplate(), ]; @@ -544,6 +582,27 @@ public static function conversationProfileName($project, $conversationProfile) ]); } + /** + * Formats a string containing the fully-qualified path to represent a data_store + * resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * + * @return string The formatted data_store resource. + */ + public static function dataStoreName($project, $location, $collection, $dataStore) + { + return self::getDataStoreNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a document * resource. @@ -807,6 +866,27 @@ public static function projectLocationAgentName($project, $location) ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_data_store resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * + * @return string The formatted project_location_collection_data_store resource. + */ + public static function projectLocationCollectionDataStoreName($project, $location, $collection, $dataStore) + { + return self::getProjectLocationCollectionDataStoreNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_conversation resource. @@ -885,6 +965,25 @@ public static function projectLocationConversationProfileName($project, $locatio ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_data_store resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * + * @return string The formatted project_location_data_store resource. + */ + public static function projectLocationDataStoreName($project, $location, $dataStore) + { + return self::getProjectLocationDataStoreNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_knowledge_base resource. @@ -934,6 +1033,7 @@ public static function projectLocationKnowledgeBaseDocumentName($project, $locat * - conversation: projects/{project}/conversations/{conversation} * - conversationModel: projects/{project}/locations/{location}/conversationModels/{conversation_model} * - conversationProfile: projects/{project}/conversationProfiles/{conversation_profile} + * - dataStore: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store} * - document: projects/{project}/knowledgeBases/{knowledge_base}/documents/{document} * - generator: projects/{project}/locations/{location}/generators/{generator} * - knowledgeBase: projects/{project}/knowledgeBases/{knowledge_base} @@ -949,10 +1049,12 @@ public static function projectLocationKnowledgeBaseDocumentName($project, $locat * - projectKnowledgeBase: projects/{project}/knowledgeBases/{knowledge_base} * - projectKnowledgeBaseDocument: projects/{project}/knowledgeBases/{knowledge_base}/documents/{document} * - projectLocationAgent: projects/{project}/locations/{location}/agent + * - projectLocationCollectionDataStore: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store} * - projectLocationConversation: projects/{project}/locations/{location}/conversations/{conversation} * - projectLocationConversationMessage: projects/{project}/locations/{location}/conversations/{conversation}/messages/{message} * - projectLocationConversationModel: projects/{project}/locations/{location}/conversationModels/{conversation_model} * - projectLocationConversationProfile: projects/{project}/locations/{location}/conversationProfiles/{conversation_profile} + * - projectLocationDataStore: projects/{project}/locations/{location}/dataStores/{data_store} * - projectLocationKnowledgeBase: projects/{project}/locations/{location}/knowledgeBases/{knowledge_base} * - projectLocationKnowledgeBaseDocument: projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document} * @@ -1139,9 +1241,9 @@ public function completeConversation($name, array $optionalArgs = []) * Google. Only set it if you cannot wait for the response to return a * auto-generated one to you. * - * The conversation ID must be compliant with the regression fomula + * The conversation ID must be compliant with the regression formula * `[a-zA-Z][a-zA-Z0-9_-]*` with the characters length in range of [3,64]. - * If the field is provided, the caller is resposible for + * If the field is provided, the caller is responsible for * 1. the uniqueness of the ID, otherwise the request will be rejected. * 2. the consistency for whether to use custom ID or not under a project to * better ensure uniqueness. @@ -1556,6 +1658,31 @@ public function listMessages($parent, array $optionalArgs = []) * triggered. * Format: `projects//locations//conversations//messages/`. + * @type int $querySource + * Optional. The source of the query in the request. + * For allowed values, use constants defined on {@see \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\QuerySource} + * @type Struct $endUserMetadata + * Optional. Information about the end-user to improve the relevance and + * accuracy of generative answers. + * + * This will be interpreted and used by a language model, so, for good + * results, the data should be self-descriptive, and in a simple structure. + * + * Example: + * + * ```json + * { + * "subscription plan": "Business Premium Plus", + * "devices owned": [ + * {"model": "Google Pixel 7"}, + * {"model": "Google Pixel Tablet"} + * ] + * } + * ``` + * @type SearchConfig $searchConfig + * Optional. Configuration specific to search queries with data stores. + * @type bool $exactSearch + * Optional. Whether to search the query exactly without query rewrite. * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an * associative array of retry settings parameters. See the documentation on @@ -1590,6 +1717,22 @@ public function searchKnowledge($query, $conversationProfile, array $optionalArg $request->setLatestMessage($optionalArgs['latestMessage']); } + if (isset($optionalArgs['querySource'])) { + $request->setQuerySource($optionalArgs['querySource']); + } + + if (isset($optionalArgs['endUserMetadata'])) { + $request->setEndUserMetadata($optionalArgs['endUserMetadata']); + } + + if (isset($optionalArgs['searchConfig'])) { + $request->setSearchConfig($optionalArgs['searchConfig']); + } + + if (isset($optionalArgs['exactSearch'])) { + $request->setExactSearch($optionalArgs['exactSearch']); + } + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall('SearchKnowledge', SearchKnowledgeResponse::class, $optionalArgs, $request)->wait(); diff --git a/Dialogflow/src/V2/SearchKnowledgeAnswer/AnswerSource.php b/Dialogflow/src/V2/SearchKnowledgeAnswer/AnswerSource.php index 04ba0e360b24..e2e58f97ba53 100644 --- a/Dialogflow/src/V2/SearchKnowledgeAnswer/AnswerSource.php +++ b/Dialogflow/src/V2/SearchKnowledgeAnswer/AnswerSource.php @@ -33,6 +33,12 @@ class AnswerSource extends \Google\Protobuf\Internal\Message * Generated from protobuf field string snippet = 3; */ private $snippet = ''; + /** + * Metadata associated with the article. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 5; + */ + private $metadata = null; /** * Constructor. @@ -46,6 +52,8 @@ class AnswerSource extends \Google\Protobuf\Internal\Message * The URI of the article. * @type string $snippet * The relevant snippet of the article. + * @type \Google\Protobuf\Struct $metadata + * Metadata associated with the article. * } */ public function __construct($data = NULL) { @@ -131,6 +139,42 @@ public function setSnippet($var) return $this; } + /** + * Metadata associated with the article. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 5; + * @return \Google\Protobuf\Struct|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Metadata associated with the article. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 5; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->metadata = $var; + + return $this; + } + } diff --git a/Dialogflow/src/V2/SearchKnowledgeRequest.php b/Dialogflow/src/V2/SearchKnowledgeRequest.php index d07f899d2716..fb05ac3e62c3 100644 --- a/Dialogflow/src/V2/SearchKnowledgeRequest.php +++ b/Dialogflow/src/V2/SearchKnowledgeRequest.php @@ -67,6 +67,43 @@ class SearchKnowledgeRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field string latest_message = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ private $latest_message = ''; + /** + * Optional. The source of the query in the request. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.QuerySource query_source = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $query_source = 0; + /** + * Optional. Information about the end-user to improve the relevance and + * accuracy of generative answers. + * This will be interpreted and used by a language model, so, for good + * results, the data should be self-descriptive, and in a simple structure. + * Example: + * ```json + * { + * "subscription plan": "Business Premium Plus", + * "devices owned": [ + * {"model": "Google Pixel 7"}, + * {"model": "Google Pixel Tablet"} + * ] + * } + * ``` + * + * Generated from protobuf field .google.protobuf.Struct end_user_metadata = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $end_user_metadata = null; + /** + * Optional. Configuration specific to search queries with data stores. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig search_config = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $search_config = null; + /** + * Optional. Whether to search the query exactly without query rewrite. + * + * Generated from protobuf field bool exact_search = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $exact_search = false; /** * Constructor. @@ -101,6 +138,27 @@ class SearchKnowledgeRequest extends \Google\Protobuf\Internal\Message * triggered. * Format: `projects//locations//conversations//messages/`. + * @type int $query_source + * Optional. The source of the query in the request. + * @type \Google\Protobuf\Struct $end_user_metadata + * Optional. Information about the end-user to improve the relevance and + * accuracy of generative answers. + * This will be interpreted and used by a language model, so, for good + * results, the data should be self-descriptive, and in a simple structure. + * Example: + * ```json + * { + * "subscription plan": "Business Premium Plus", + * "devices owned": [ + * {"model": "Google Pixel 7"}, + * {"model": "Google Pixel Tablet"} + * ] + * } + * ``` + * @type \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig $search_config + * Optional. Configuration specific to search queries with data stores. + * @type bool $exact_search + * Optional. Whether to search the query exactly without query rewrite. * } */ public function __construct($data = NULL) { @@ -304,5 +362,155 @@ public function setLatestMessage($var) return $this; } + /** + * Optional. The source of the query in the request. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.QuerySource query_source = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getQuerySource() + { + return $this->query_source; + } + + /** + * Optional. The source of the query in the request. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.QuerySource query_source = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setQuerySource($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\QuerySource::class); + $this->query_source = $var; + + return $this; + } + + /** + * Optional. Information about the end-user to improve the relevance and + * accuracy of generative answers. + * This will be interpreted and used by a language model, so, for good + * results, the data should be self-descriptive, and in a simple structure. + * Example: + * ```json + * { + * "subscription plan": "Business Premium Plus", + * "devices owned": [ + * {"model": "Google Pixel 7"}, + * {"model": "Google Pixel Tablet"} + * ] + * } + * ``` + * + * Generated from protobuf field .google.protobuf.Struct end_user_metadata = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Struct|null + */ + public function getEndUserMetadata() + { + return $this->end_user_metadata; + } + + public function hasEndUserMetadata() + { + return isset($this->end_user_metadata); + } + + public function clearEndUserMetadata() + { + unset($this->end_user_metadata); + } + + /** + * Optional. Information about the end-user to improve the relevance and + * accuracy of generative answers. + * This will be interpreted and used by a language model, so, for good + * results, the data should be self-descriptive, and in a simple structure. + * Example: + * ```json + * { + * "subscription plan": "Business Premium Plus", + * "devices owned": [ + * {"model": "Google Pixel 7"}, + * {"model": "Google Pixel Tablet"} + * ] + * } + * ``` + * + * Generated from protobuf field .google.protobuf.Struct end_user_metadata = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setEndUserMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->end_user_metadata = $var; + + return $this; + } + + /** + * Optional. Configuration specific to search queries with data stores. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig search_config = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig|null + */ + public function getSearchConfig() + { + return $this->search_config; + } + + public function hasSearchConfig() + { + return isset($this->search_config); + } + + public function clearSearchConfig() + { + unset($this->search_config); + } + + /** + * Optional. Configuration specific to search queries with data stores. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig search_config = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig $var + * @return $this + */ + public function setSearchConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig::class); + $this->search_config = $var; + + return $this; + } + + /** + * Optional. Whether to search the query exactly without query rewrite. + * + * Generated from protobuf field bool exact_search = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getExactSearch() + { + return $this->exact_search; + } + + /** + * Optional. Whether to search the query exactly without query rewrite. + * + * Generated from protobuf field bool exact_search = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setExactSearch($var) + { + GPBUtil::checkBool($var); + $this->exact_search = $var; + + return $this; + } + } diff --git a/Dialogflow/src/V2/SearchKnowledgeRequest/QuerySource.php b/Dialogflow/src/V2/SearchKnowledgeRequest/QuerySource.php new file mode 100644 index 000000000000..447034161ad6 --- /dev/null +++ b/Dialogflow/src/V2/SearchKnowledgeRequest/QuerySource.php @@ -0,0 +1,67 @@ +google.cloud.dialogflow.v2.SearchKnowledgeRequest.QuerySource + */ +class QuerySource +{ + /** + * Unknown query source. + * + * Generated from protobuf enum QUERY_SOURCE_UNSPECIFIED = 0; + */ + const QUERY_SOURCE_UNSPECIFIED = 0; + /** + * The query is from agents. + * + * Generated from protobuf enum AGENT_QUERY = 1; + */ + const AGENT_QUERY = 1; + /** + * The query is a suggested query from + * [Participants.SuggestKnowledgeAssist][google.cloud.dialogflow.v2.Participants.SuggestKnowledgeAssist]. + * + * Generated from protobuf enum SUGGESTED_QUERY = 2; + */ + const SUGGESTED_QUERY = 2; + + private static $valueToName = [ + self::QUERY_SOURCE_UNSPECIFIED => 'QUERY_SOURCE_UNSPECIFIED', + self::AGENT_QUERY => 'AGENT_QUERY', + self::SUGGESTED_QUERY => 'SUGGESTED_QUERY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig.php b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig.php new file mode 100644 index 000000000000..8d33b52fadf2 --- /dev/null +++ b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig.php @@ -0,0 +1,102 @@ +google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig + */ +class SearchConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Boost specifications for data stores. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs boost_specs = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $boost_specs; + /** + * Optional. Filter specification for data store queries. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.FilterSpecs filter_specs = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $filter_specs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs>|\Google\Protobuf\Internal\RepeatedField $boost_specs + * Optional. Boost specifications for data stores. + * @type array<\Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\FilterSpecs>|\Google\Protobuf\Internal\RepeatedField $filter_specs + * Optional. Filter specification for data store queries. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\V2\Conversation::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Boost specifications for data stores. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs boost_specs = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBoostSpecs() + { + return $this->boost_specs; + } + + /** + * Optional. Boost specifications for data stores. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs boost_specs = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBoostSpecs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs::class); + $this->boost_specs = $arr; + + return $this; + } + + /** + * Optional. Filter specification for data store queries. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.FilterSpecs filter_specs = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFilterSpecs() + { + return $this->filter_specs; + } + + /** + * Optional. Filter specification for data store queries. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.FilterSpecs filter_specs = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\FilterSpecs>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFilterSpecs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\FilterSpecs::class); + $this->filter_specs = $arr; + + return $this; + } + +} + + diff --git a/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs.php b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs.php new file mode 100644 index 000000000000..0a70436e0753 --- /dev/null +++ b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs.php @@ -0,0 +1,114 @@ +google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs + */ +class BoostSpecs extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Data Stores where the boosting configuration is applied. The + * full names of the referenced data stores. Formats: + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}` + * `projects/{project}/locations/{location}/dataStores/{data_store}` + * + * Generated from protobuf field repeated string data_stores = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $data_stores; + /** + * Optional. A list of boosting specifications. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec spec = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $spec; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $data_stores + * Optional. Data Stores where the boosting configuration is applied. The + * full names of the referenced data stores. Formats: + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}` + * `projects/{project}/locations/{location}/dataStores/{data_store}` + * @type array<\Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec>|\Google\Protobuf\Internal\RepeatedField $spec + * Optional. A list of boosting specifications. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\V2\Conversation::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Data Stores where the boosting configuration is applied. The + * full names of the referenced data stores. Formats: + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}` + * `projects/{project}/locations/{location}/dataStores/{data_store}` + * + * Generated from protobuf field repeated string data_stores = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDataStores() + { + return $this->data_stores; + } + + /** + * Optional. Data Stores where the boosting configuration is applied. The + * full names of the referenced data stores. Formats: + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}` + * `projects/{project}/locations/{location}/dataStores/{data_store}` + * + * Generated from protobuf field repeated string data_stores = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDataStores($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->data_stores = $arr; + + return $this; + } + + /** + * Optional. A list of boosting specifications. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec spec = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSpec() + { + return $this->spec; + } + + /** + * Optional. A list of boosting specifications. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec spec = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSpec($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec::class); + $this->spec = $arr; + + return $this; + } + +} + + diff --git a/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec.php b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec.php new file mode 100644 index 000000000000..c35fc27af777 --- /dev/null +++ b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec.php @@ -0,0 +1,83 @@ +google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec + */ +class BoostSpec extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Condition boost specifications. If a document matches + * multiple conditions in the specifictions, boost scores from these + * specifications are all applied and combined in a non-linear way. + * Maximum number of specifications is 20. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec condition_boost_specs = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $condition_boost_specs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec\ConditionBoostSpec>|\Google\Protobuf\Internal\RepeatedField $condition_boost_specs + * Optional. Condition boost specifications. If a document matches + * multiple conditions in the specifictions, boost scores from these + * specifications are all applied and combined in a non-linear way. + * Maximum number of specifications is 20. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\V2\Conversation::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Condition boost specifications. If a document matches + * multiple conditions in the specifictions, boost scores from these + * specifications are all applied and combined in a non-linear way. + * Maximum number of specifications is 20. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec condition_boost_specs = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConditionBoostSpecs() + { + return $this->condition_boost_specs; + } + + /** + * Optional. Condition boost specifications. If a document matches + * multiple conditions in the specifictions, boost scores from these + * specifications are all applied and combined in a non-linear way. + * Maximum number of specifications is 20. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec condition_boost_specs = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec\ConditionBoostSpec>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConditionBoostSpecs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec\ConditionBoostSpec::class); + $this->condition_boost_specs = $arr; + + return $this; + } + +} + + diff --git a/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec.php b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec.php new file mode 100644 index 000000000000..31379ae8fb24 --- /dev/null +++ b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec.php @@ -0,0 +1,230 @@ +google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec + */ +class ConditionBoostSpec extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. An expression which specifies a boost condition. The + * syntax and supported fields are the same as a filter expression. + * Examples: + * * To boost documents with document ID "doc_1" or "doc_2", and + * color + * "Red" or "Blue": + * * (id: ANY("doc_1", "doc_2")) AND (color: ANY("Red","Blue")) + * + * Generated from protobuf field string condition = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $condition = ''; + /** + * Optional. Strength of the condition boost, which should be in [-1, + * 1]. Negative boost means demotion. Default is 0.0. + * Setting to 1.0 gives the document a big promotion. However, it does + * not necessarily mean that the boosted document will be the top + * result at all times, nor that other documents will be excluded. + * Results could still be shown even when none of them matches the + * condition. And results that are significantly more relevant to the + * search query can still trump your heavily favored but irrelevant + * documents. + * Setting to -1.0 gives the document a big demotion. However, results + * that are deeply relevant might still be shown. The document will + * have an upstream battle to get a fairly high ranking, but it is not + * blocked out completely. + * Setting to 0.0 means no boost applied. The boosting condition is + * ignored. + * + * Generated from protobuf field float boost = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $boost = 0.0; + /** + * Optional. Complex specification for custom ranking based on + * customer defined attribute value. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec boost_control_spec = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $boost_control_spec = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $condition + * Optional. An expression which specifies a boost condition. The + * syntax and supported fields are the same as a filter expression. + * Examples: + * * To boost documents with document ID "doc_1" or "doc_2", and + * color + * "Red" or "Blue": + * * (id: ANY("doc_1", "doc_2")) AND (color: ANY("Red","Blue")) + * @type float $boost + * Optional. Strength of the condition boost, which should be in [-1, + * 1]. Negative boost means demotion. Default is 0.0. + * Setting to 1.0 gives the document a big promotion. However, it does + * not necessarily mean that the boosted document will be the top + * result at all times, nor that other documents will be excluded. + * Results could still be shown even when none of them matches the + * condition. And results that are significantly more relevant to the + * search query can still trump your heavily favored but irrelevant + * documents. + * Setting to -1.0 gives the document a big demotion. However, results + * that are deeply relevant might still be shown. The document will + * have an upstream battle to get a fairly high ranking, but it is not + * blocked out completely. + * Setting to 0.0 means no boost applied. The boosting condition is + * ignored. + * @type \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec\ConditionBoostSpec\BoostControlSpec $boost_control_spec + * Optional. Complex specification for custom ranking based on + * customer defined attribute value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\V2\Conversation::initOnce(); + parent::__construct($data); + } + + /** + * Optional. An expression which specifies a boost condition. The + * syntax and supported fields are the same as a filter expression. + * Examples: + * * To boost documents with document ID "doc_1" or "doc_2", and + * color + * "Red" or "Blue": + * * (id: ANY("doc_1", "doc_2")) AND (color: ANY("Red","Blue")) + * + * Generated from protobuf field string condition = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getCondition() + { + return $this->condition; + } + + /** + * Optional. An expression which specifies a boost condition. The + * syntax and supported fields are the same as a filter expression. + * Examples: + * * To boost documents with document ID "doc_1" or "doc_2", and + * color + * "Red" or "Blue": + * * (id: ANY("doc_1", "doc_2")) AND (color: ANY("Red","Blue")) + * + * Generated from protobuf field string condition = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setCondition($var) + { + GPBUtil::checkString($var, True); + $this->condition = $var; + + return $this; + } + + /** + * Optional. Strength of the condition boost, which should be in [-1, + * 1]. Negative boost means demotion. Default is 0.0. + * Setting to 1.0 gives the document a big promotion. However, it does + * not necessarily mean that the boosted document will be the top + * result at all times, nor that other documents will be excluded. + * Results could still be shown even when none of them matches the + * condition. And results that are significantly more relevant to the + * search query can still trump your heavily favored but irrelevant + * documents. + * Setting to -1.0 gives the document a big demotion. However, results + * that are deeply relevant might still be shown. The document will + * have an upstream battle to get a fairly high ranking, but it is not + * blocked out completely. + * Setting to 0.0 means no boost applied. The boosting condition is + * ignored. + * + * Generated from protobuf field float boost = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getBoost() + { + return $this->boost; + } + + /** + * Optional. Strength of the condition boost, which should be in [-1, + * 1]. Negative boost means demotion. Default is 0.0. + * Setting to 1.0 gives the document a big promotion. However, it does + * not necessarily mean that the boosted document will be the top + * result at all times, nor that other documents will be excluded. + * Results could still be shown even when none of them matches the + * condition. And results that are significantly more relevant to the + * search query can still trump your heavily favored but irrelevant + * documents. + * Setting to -1.0 gives the document a big demotion. However, results + * that are deeply relevant might still be shown. The document will + * have an upstream battle to get a fairly high ranking, but it is not + * blocked out completely. + * Setting to 0.0 means no boost applied. The boosting condition is + * ignored. + * + * Generated from protobuf field float boost = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setBoost($var) + { + GPBUtil::checkFloat($var); + $this->boost = $var; + + return $this; + } + + /** + * Optional. Complex specification for custom ranking based on + * customer defined attribute value. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec boost_control_spec = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec\ConditionBoostSpec\BoostControlSpec|null + */ + public function getBoostControlSpec() + { + return $this->boost_control_spec; + } + + public function hasBoostControlSpec() + { + return isset($this->boost_control_spec); + } + + public function clearBoostControlSpec() + { + unset($this->boost_control_spec); + } + + /** + * Optional. Complex specification for custom ranking based on + * customer defined attribute value. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec boost_control_spec = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec\ConditionBoostSpec\BoostControlSpec $var + * @return $this + */ + public function setBoostControlSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec\ConditionBoostSpec\BoostControlSpec::class); + $this->boost_control_spec = $var; + + return $this; + } + +} + + diff --git a/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec/BoostControlSpec.php b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec/BoostControlSpec.php new file mode 100644 index 000000000000..856c5dfa4383 --- /dev/null +++ b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec/BoostControlSpec.php @@ -0,0 +1,209 @@ +google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec + */ +class BoostControlSpec extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The name of the field whose value will be used to + * determine the boost amount. + * + * Generated from protobuf field string field_name = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $field_name = ''; + /** + * Optional. The attribute type to be used to determine the boost + * amount. The attribute value can be derived from the field value + * of the specified field_name. In the case of numerical it is + * straightforward i.e. attribute_value = numerical_field_value. In + * the case of freshness however, attribute_value = (time.now() - + * datetime_field_value). + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.AttributeType attribute_type = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $attribute_type = 0; + /** + * Optional. The interpolation type to be applied to connect the + * control points listed below. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.InterpolationType interpolation_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $interpolation_type = 0; + /** + * Optional. The control points used to define the curve. The + * monotonic function (defined through the interpolation_type above) + * passes through the control points listed here. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.ControlPoint control_points = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $control_points; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $field_name + * Optional. The name of the field whose value will be used to + * determine the boost amount. + * @type int $attribute_type + * Optional. The attribute type to be used to determine the boost + * amount. The attribute value can be derived from the field value + * of the specified field_name. In the case of numerical it is + * straightforward i.e. attribute_value = numerical_field_value. In + * the case of freshness however, attribute_value = (time.now() - + * datetime_field_value). + * @type int $interpolation_type + * Optional. The interpolation type to be applied to connect the + * control points listed below. + * @type array<\Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec\ConditionBoostSpec\BoostControlSpec\ControlPoint>|\Google\Protobuf\Internal\RepeatedField $control_points + * Optional. The control points used to define the curve. The + * monotonic function (defined through the interpolation_type above) + * passes through the control points listed here. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\V2\Conversation::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The name of the field whose value will be used to + * determine the boost amount. + * + * Generated from protobuf field string field_name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFieldName() + { + return $this->field_name; + } + + /** + * Optional. The name of the field whose value will be used to + * determine the boost amount. + * + * Generated from protobuf field string field_name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFieldName($var) + { + GPBUtil::checkString($var, True); + $this->field_name = $var; + + return $this; + } + + /** + * Optional. The attribute type to be used to determine the boost + * amount. The attribute value can be derived from the field value + * of the specified field_name. In the case of numerical it is + * straightforward i.e. attribute_value = numerical_field_value. In + * the case of freshness however, attribute_value = (time.now() - + * datetime_field_value). + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.AttributeType attribute_type = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getAttributeType() + { + return $this->attribute_type; + } + + /** + * Optional. The attribute type to be used to determine the boost + * amount. The attribute value can be derived from the field value + * of the specified field_name. In the case of numerical it is + * straightforward i.e. attribute_value = numerical_field_value. In + * the case of freshness however, attribute_value = (time.now() - + * datetime_field_value). + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.AttributeType attribute_type = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setAttributeType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec\ConditionBoostSpec\BoostControlSpec\AttributeType::class); + $this->attribute_type = $var; + + return $this; + } + + /** + * Optional. The interpolation type to be applied to connect the + * control points listed below. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.InterpolationType interpolation_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getInterpolationType() + { + return $this->interpolation_type; + } + + /** + * Optional. The interpolation type to be applied to connect the + * control points listed below. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.InterpolationType interpolation_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setInterpolationType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec\ConditionBoostSpec\BoostControlSpec\InterpolationType::class); + $this->interpolation_type = $var; + + return $this; + } + + /** + * Optional. The control points used to define the curve. The + * monotonic function (defined through the interpolation_type above) + * passes through the control points listed here. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.ControlPoint control_points = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getControlPoints() + { + return $this->control_points; + } + + /** + * Optional. The control points used to define the curve. The + * monotonic function (defined through the interpolation_type above) + * passes through the control points listed here. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.ControlPoint control_points = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec\ConditionBoostSpec\BoostControlSpec\ControlPoint>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setControlPoints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\V2\SearchKnowledgeRequest\SearchConfig\BoostSpecs\BoostSpec\ConditionBoostSpec\BoostControlSpec\ControlPoint::class); + $this->control_points = $arr; + + return $this; + } + +} + + diff --git a/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec/BoostControlSpec/AttributeType.php b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec/BoostControlSpec/AttributeType.php new file mode 100644 index 000000000000..aa07719f5264 --- /dev/null +++ b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec/BoostControlSpec/AttributeType.php @@ -0,0 +1,71 @@ +google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.AttributeType + */ +class AttributeType +{ + /** + * Unspecified AttributeType. + * + * Generated from protobuf enum ATTRIBUTE_TYPE_UNSPECIFIED = 0; + */ + const ATTRIBUTE_TYPE_UNSPECIFIED = 0; + /** + * The value of the numerical field will be used to dynamically + * update the boost amount. In this case, the attribute_value (the + * x value) of the control point will be the actual value of the + * numerical field for which the boost_amount is specified. + * + * Generated from protobuf enum NUMERICAL = 1; + */ + const NUMERICAL = 1; + /** + * For the freshness use case the attribute value will be the + * duration between the current time and the date in the datetime + * field specified. The value must be formatted as an XSD + * `dayTimeDuration` value (a restricted subset of an ISO 8601 + * duration value). The pattern for this is: + * `[nD][T[nH][nM][nS]]`. E.g. `5D`, `3DT12H30M`, `T24H`. + * + * Generated from protobuf enum FRESHNESS = 2; + */ + const FRESHNESS = 2; + + private static $valueToName = [ + self::ATTRIBUTE_TYPE_UNSPECIFIED => 'ATTRIBUTE_TYPE_UNSPECIFIED', + self::NUMERICAL => 'NUMERICAL', + self::FRESHNESS => 'FRESHNESS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec/BoostControlSpec/ControlPoint.php b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec/BoostControlSpec/ControlPoint.php new file mode 100644 index 000000000000..2926da3bbba3 --- /dev/null +++ b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec/BoostControlSpec/ControlPoint.php @@ -0,0 +1,36 @@ +google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.ControlPoint + */ +class ControlPoint extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\V2\Conversation::initOnce(); + parent::__construct($data); + } + +} + + diff --git a/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec/BoostControlSpec/InterpolationType.php b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec/BoostControlSpec/InterpolationType.php new file mode 100644 index 000000000000..58ef4f0ef8d8 --- /dev/null +++ b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/BoostSpecs/BoostSpec/ConditionBoostSpec/BoostControlSpec/InterpolationType.php @@ -0,0 +1,57 @@ +google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.InterpolationType + */ +class InterpolationType +{ + /** + * Interpolation type is unspecified. In this case, it defaults to + * Linear. + * + * Generated from protobuf enum INTERPOLATION_TYPE_UNSPECIFIED = 0; + */ + const INTERPOLATION_TYPE_UNSPECIFIED = 0; + /** + * Piecewise linear interpolation will be applied. + * + * Generated from protobuf enum LINEAR = 1; + */ + const LINEAR = 1; + + private static $valueToName = [ + self::INTERPOLATION_TYPE_UNSPECIFIED => 'INTERPOLATION_TYPE_UNSPECIFIED', + self::LINEAR => 'LINEAR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/FilterSpecs.php b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/FilterSpecs.php new file mode 100644 index 000000000000..4ab29817ff1f --- /dev/null +++ b/Dialogflow/src/V2/SearchKnowledgeRequest/SearchConfig/FilterSpecs.php @@ -0,0 +1,122 @@ +google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.FilterSpecs + */ +class FilterSpecs extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The data store where the filter configuration is applied. + * Full resource name of data store, such as + * projects/{project}/locations/{location}/collections/{collectionId}/ + * dataStores/{dataStoreId}. + * + * Generated from protobuf field repeated string data_stores = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $data_stores; + /** + * Optional. The filter expression to be applied. + * Expression syntax is documented at + * https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $filter = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $data_stores + * Optional. The data store where the filter configuration is applied. + * Full resource name of data store, such as + * projects/{project}/locations/{location}/collections/{collectionId}/ + * dataStores/{dataStoreId}. + * @type string $filter + * Optional. The filter expression to be applied. + * Expression syntax is documented at + * https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\V2\Conversation::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The data store where the filter configuration is applied. + * Full resource name of data store, such as + * projects/{project}/locations/{location}/collections/{collectionId}/ + * dataStores/{dataStoreId}. + * + * Generated from protobuf field repeated string data_stores = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDataStores() + { + return $this->data_stores; + } + + /** + * Optional. The data store where the filter configuration is applied. + * Full resource name of data store, such as + * projects/{project}/locations/{location}/collections/{collectionId}/ + * dataStores/{dataStoreId}. + * + * Generated from protobuf field repeated string data_stores = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDataStores($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->data_stores = $arr; + + return $this; + } + + /** + * Optional. The filter expression to be applied. + * Expression syntax is documented at + * https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter expression to be applied. + * Expression syntax is documented at + * https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + + diff --git a/Dialogflow/src/V2/resources/conversations_descriptor_config.php b/Dialogflow/src/V2/resources/conversations_descriptor_config.php index 9dfedafbba9e..2a0c0935783e 100644 --- a/Dialogflow/src/V2/resources/conversations_descriptor_config.php +++ b/Dialogflow/src/V2/resources/conversations_descriptor_config.php @@ -194,6 +194,7 @@ 'conversation' => 'projects/{project}/conversations/{conversation}', 'conversationModel' => 'projects/{project}/locations/{location}/conversationModels/{conversation_model}', 'conversationProfile' => 'projects/{project}/conversationProfiles/{conversation_profile}', + 'dataStore' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}', 'document' => 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}', 'generator' => 'projects/{project}/locations/{location}/generators/{generator}', 'knowledgeBase' => 'projects/{project}/knowledgeBases/{knowledge_base}', @@ -209,10 +210,12 @@ 'projectKnowledgeBase' => 'projects/{project}/knowledgeBases/{knowledge_base}', 'projectKnowledgeBaseDocument' => 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}', 'projectLocationAgent' => 'projects/{project}/locations/{location}/agent', + 'projectLocationCollectionDataStore' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}', 'projectLocationConversation' => 'projects/{project}/locations/{location}/conversations/{conversation}', 'projectLocationConversationMessage' => 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}', 'projectLocationConversationModel' => 'projects/{project}/locations/{location}/conversationModels/{conversation_model}', 'projectLocationConversationProfile' => 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}', + 'projectLocationDataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', 'projectLocationKnowledgeBase' => 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}', 'projectLocationKnowledgeBaseDocument' => 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}', ],