From f405b9aece468145571fd4df756aa2165526cfa2 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:56:04 -0700 Subject: [PATCH] feat: add lite search API to allow public website search with API key (#27495) feat: add LOW_GROUNDED_ANSWER in answer skip reasons feat: support query regex in control match rules docs: keep the API doc up-to-date with recent changes chore: add selective gapic generation option for publishing --- .../.owlbot-manifest.json | 1 + .../gapic_metadata.json | 5 + .../v1/search_service/client.rb | 319 ++++++++++++++++++ .../v1/search_service/rest/client.rb | 311 +++++++++++++++++ .../v1/search_service/rest/service_stub.rb | 76 +++++ .../cloud/discoveryengine/v1/answer_pb.rb | 2 +- .../cloud/discoveryengine/v1/control_pb.rb | 2 +- .../discoveryengine/v1/search_service_pb.rb | 2 +- .../v1/search_service_services_pb.rb | 14 + .../proto_docs/google/api/client.rb | 14 + .../google/cloud/discoveryengine/v1/answer.rb | 6 + .../cloud/discoveryengine/v1/control.rb | 9 + .../discoveryengine/v1/document_service.rb | 2 +- .../snippets/search_service/search_lite.rb | 51 +++ ...adata_google.cloud.discoveryengine.v1.json | 40 +++ .../v1/search_service_rest_test.rb | 79 +++++ .../v1/search_service_test.rb | 113 +++++++ 17 files changed, 1042 insertions(+), 4 deletions(-) create mode 100644 google-cloud-discovery_engine-v1/snippets/search_service/search_lite.rb diff --git a/google-cloud-discovery_engine-v1/.owlbot-manifest.json b/google-cloud-discovery_engine-v1/.owlbot-manifest.json index 341da7d898cd..fae798d41083 100644 --- a/google-cloud-discovery_engine-v1/.owlbot-manifest.json +++ b/google-cloud-discovery_engine-v1/.owlbot-manifest.json @@ -292,6 +292,7 @@ "snippets/schema_service/list_schemas.rb", "snippets/schema_service/update_schema.rb", "snippets/search_service/search.rb", + "snippets/search_service/search_lite.rb", "snippets/search_tuning_service/list_custom_models.rb", "snippets/search_tuning_service/train_custom_model.rb", "snippets/site_search_engine_service/batch_create_target_sites.rb", diff --git a/google-cloud-discovery_engine-v1/gapic_metadata.json b/google-cloud-discovery_engine-v1/gapic_metadata.json index 922ac3801d50..92acbe914493 100644 --- a/google-cloud-discovery_engine-v1/gapic_metadata.json +++ b/google-cloud-discovery_engine-v1/gapic_metadata.json @@ -82,6 +82,11 @@ "methods": [ "search" ] + }, + "SearchLite": { + "methods": [ + "search_lite" + ] } } } diff --git a/google-cloud-discovery_engine-v1/lib/google/cloud/discovery_engine/v1/search_service/client.rb b/google-cloud-discovery_engine-v1/lib/google/cloud/discovery_engine/v1/search_service/client.rb index e4a89bcf85a3..799b5db52c5a 100644 --- a/google-cloud-discovery_engine-v1/lib/google/cloud/discovery_engine/v1/search_service/client.rb +++ b/google-cloud-discovery_engine-v1/lib/google/cloud/discovery_engine/v1/search_service/client.rb @@ -483,6 +483,318 @@ def search request, options = nil raise ::Google::Cloud::Error.from_error(e) end + ## + # Performs a search. Similar to the + # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search SearchService.Search} + # method, but a lite version that allows API key for authentication, where + # OAuth and IAM checks are not required. + # + # Only public website search is supported by this method. If data stores and + # engines not associated with public website search are specified, a + # `FAILED_PRECONDITION` error is returned. + # + # This method can be used for easy onboarding without having to implement an + # authentication backend. However, it is strongly recommended to use + # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search SearchService.Search} + # instead with required OAuth and IAM checks to provide better data security. + # + # @overload search_lite(request, options = nil) + # Pass arguments to `search_lite` via a request object, either of type + # {::Google::Cloud::DiscoveryEngine::V1::SearchRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::DiscoveryEngine::V1::SearchRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload search_lite(serving_config: nil, branch: nil, query: nil, image_query: nil, page_size: nil, page_token: nil, offset: nil, one_box_page_size: nil, data_store_specs: nil, filter: nil, canonical_filter: nil, order_by: nil, user_info: nil, language_code: nil, facet_specs: nil, boost_spec: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, safe_search: nil, user_labels: nil, search_as_you_type_spec: nil, session: nil, session_spec: nil) + # Pass arguments to `search_lite` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param serving_config [::String] + # Required. The resource name of the Search serving config, such as + # `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`, + # or + # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config`. + # This field is used to identify the serving configuration name, set + # of models used to make the search. + # @param branch [::String] + # The branch resource name, such as + # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/branches/0`. + # + # Use `default_branch` as the branch ID or leave this field empty, to search + # documents under the default branch. + # @param query [::String] + # Raw search query. + # @param image_query [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ImageQuery, ::Hash] + # Raw image query. + # @param page_size [::Integer] + # Maximum number of {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to + # return. The maximum allowed value depends on the data type. Values above + # the maximum value are coerced to the maximum value. + # + # * Websites with basic indexing: Default `10`, Maximum `25`. + # * Websites with advanced indexing: Default `25`, Maximum `50`. + # * Other: Default `50`, Maximum `100`. + # + # If this field is negative, an `INVALID_ARGUMENT` is returned. + # @param page_token [::String] + # A page token received from a previous + # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search SearchService.Search} + # call. Provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to + # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search SearchService.Search} + # must match the call that provided the page token. Otherwise, an + # `INVALID_ARGUMENT` error is returned. + # @param offset [::Integer] + # A 0-indexed integer that specifies the current offset (that is, starting + # result location, amongst the + # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s deemed by the API as + # relevant) in search results. This field is only considered if + # {::Google::Cloud::DiscoveryEngine::V1::SearchRequest#page_token page_token} is + # unset. + # + # If this field is negative, an `INVALID_ARGUMENT` is returned. + # @param one_box_page_size [::Integer] + # The maximum number of results to return for OneBox. + # This applies to each OneBox type individually. + # Default number is 10. + # @param data_store_specs [::Array<::Google::Cloud::DiscoveryEngine::V1::SearchRequest::DataStoreSpec, ::Hash>] + # Specs defining dataStores to filter on in a search call and configurations + # for those dataStores. This is only considered for engines with multiple + # dataStores use case. For single dataStore within an engine, they should + # use the specs at the top level. + # @param filter [::String] + # The filter syntax consists of an expression language for constructing a + # predicate from one or more fields of the documents being filtered. Filter + # expression is case-sensitive. + # + # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + # + # Filtering in Vertex AI Search is done by mapping the LHS filter key to a + # key property defined in the Vertex AI Search backend -- this mapping is + # defined by the customer in their schema. For example a media customer might + # have a field 'name' in their schema. In this case the filter would look + # like this: filter --> name:'ANY("king kong")' + # + # For more information about filtering including syntax and filter + # operators, see + # [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata) + # @param canonical_filter [::String] + # The default filter that is applied when a user performs a search without + # checking any filters on the search page. + # + # The filter applied to every search request when quality improvement such as + # query expansion is needed. In the case a query does not have a sufficient + # amount of results this filter will be used to determine whether or not to + # enable the query expansion flow. The original filter will still be used for + # the query expanded search. + # This field is strongly recommended to achieve high search quality. + # + # For more information about filter syntax, see + # {::Google::Cloud::DiscoveryEngine::V1::SearchRequest#filter SearchRequest.filter}. + # @param order_by [::String] + # The order in which documents are returned. Documents can be ordered by + # a field in an {::Google::Cloud::DiscoveryEngine::V1::Document Document} object. + # Leave it unset if ordered by relevance. `order_by` expression is + # case-sensitive. + # + # For more information on ordering the website search results, see + # [Order web search + # results](https://cloud.google.com/generative-ai-app-builder/docs/order-web-search-results). + # For more information on ordering the healthcare search results, see + # [Order healthcare search + # results](https://cloud.google.com/generative-ai-app-builder/docs/order-hc-results). + # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + # @param user_info [::Google::Cloud::DiscoveryEngine::V1::UserInfo, ::Hash] + # Information about the end user. + # Highly recommended for analytics. + # {::Google::Cloud::DiscoveryEngine::V1::UserInfo#user_agent UserInfo.user_agent} + # is used to deduce `device_type` for analytics. + # @param language_code [::String] + # The BCP-47 language code, such as "en-US" or "sr-Latn". For more + # information, see [Standard + # fields](https://cloud.google.com/apis/design/standard_fields). This field + # helps to better interpret the query. If a value isn't specified, the query + # language code is automatically detected, which may not be accurate. + # @param facet_specs [::Array<::Google::Cloud::DiscoveryEngine::V1::SearchRequest::FacetSpec, ::Hash>] + # Facet specifications for faceted search. If empty, no facets are returned. + # + # A maximum of 100 values are allowed. Otherwise, an `INVALID_ARGUMENT` + # error is returned. + # @param boost_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::BoostSpec, ::Hash] + # Boost specification to boost certain documents. + # For more information on boosting, see + # [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results) + # @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}] + # Additional search parameters. + # + # For public website search only, supported values are: + # + # * `user_country_code`: string. Default empty. If set to non-empty, results + # are restricted or boosted based on the location provided. + # For example, `user_country_code: "au"` + # + # For available codes see [Country + # Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) + # + # * `search_type`: double. Default empty. Enables non-webpage searching + # depending on the value. The only valid non-default value is 1, + # which enables image searching. + # For example, `search_type: 1` + # @param query_expansion_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::QueryExpansionSpec, ::Hash] + # The query expansion specification that specifies the conditions under which + # query expansion occurs. + # @param spell_correction_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SpellCorrectionSpec, ::Hash] + # The spell correction specification that specifies the mode under + # which spell correction takes effect. + # @param user_pseudo_id [::String] + # A unique identifier for tracking visitors. For example, this could be + # implemented with an HTTP cookie, which should be able to uniquely identify + # a visitor on a single device. This unique identifier should not change if + # the visitor logs in or out of the website. + # + # This field should NOT have a fixed value such as `unknown_visitor`. + # + # This should be the same identifier as + # {::Google::Cloud::DiscoveryEngine::V1::UserEvent#user_pseudo_id UserEvent.user_pseudo_id} + # and + # {::Google::Cloud::DiscoveryEngine::V1::CompleteQueryRequest#user_pseudo_id CompleteQueryRequest.user_pseudo_id} + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an `INVALID_ARGUMENT` error is returned. + # @param content_search_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ContentSearchSpec, ::Hash] + # A specification for configuring the behavior of content search. + # @param safe_search [::Boolean] + # Whether to turn on safe search. This is only supported for + # website search. + # @param user_labels [::Hash{::String => ::String}] + # The user labels applied to a resource must meet the following requirements: + # + # * Each resource can have multiple labels, up to a maximum of 64. + # * Each label must be a key-value pair. + # * Keys have a minimum length of 1 character and a maximum length of 63 + # characters and cannot be empty. Values can be empty and have a maximum + # length of 63 characters. + # * Keys and values can contain only lowercase letters, numeric characters, + # underscores, and dashes. All characters must use UTF-8 encoding, and + # international characters are allowed. + # * The key portion of a label must be unique. However, you can use the same + # key with multiple resources. + # * Keys must start with a lowercase letter or international character. + # + # See [Google Cloud + # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + # for more details. + # @param search_as_you_type_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SearchAsYouTypeSpec, ::Hash] + # Search as you type configuration. Only supported for the + # {::Google::Cloud::DiscoveryEngine::V1::IndustryVertical::MEDIA IndustryVertical.MEDIA} + # vertical. + # @param session [::String] + # The session resource name. Optional. + # + # Session allows users to do multi-turn /search API calls or coordination + # between /search API calls and /answer API calls. + # + # Example #1 (multi-turn /search API calls): + # 1. Call /search API with the auto-session mode (see below). + # 2. Call /search API with the session ID generated in the first call. + # Here, the previous search query gets considered in query + # standing. I.e., if the first query is "How did Alphabet do in 2022?" + # and the current query is "How about 2023?", the current query will + # be interpreted as "How did Alphabet do in 2023?". + # + # Example #2 (coordination between /search API calls and /answer API calls): + # 1. Call /search API with the auto-session mode (see below). + # 2. Call /answer API with the session ID generated in the first call. + # Here, the answer generation happens in the context of the search + # results from the first search call. + # + # Auto-session mode: when `projects/.../sessions/-` is used, a new session + # gets automatically created. Otherwise, users can use the create-session API + # to create a session manually. + # + # Multi-turn Search feature is currently at private GA stage. Please use + # v1alpha or v1beta version instead before we launch this feature to public + # GA. Or ask for allowlisting through Google Support team. + # @param session_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SessionSpec, ::Hash] + # Session specification. + # + # Can be used only when `session` is set. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/discovery_engine/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::DiscoveryEngine::V1::SearchService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::DiscoveryEngine::V1::SearchRequest.new + # + # # Call the search_lite method. + # result = client.search_lite request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult. + # p item + # end + # + def search_lite request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::SearchRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.search_lite.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.serving_config + header_params["serving_config"] = request.serving_config + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.search_lite.timeout, + metadata: metadata, + retry_policy: @config.rpcs.search_lite.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @search_service_stub.call_rpc :search_lite, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @search_service_stub, :search_lite, request, response, operation, options + yield response, operation if block_given? + return response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + ## # Configuration class for the SearchService API. # @@ -641,11 +953,18 @@ class Rpcs # @return [::Gapic::Config::Method] # attr_reader :search + ## + # RPC-specific configuration for `search_lite` + # @return [::Gapic::Config::Method] + # + attr_reader :search_lite # @private def initialize parent_rpcs = nil search_config = parent_rpcs.search if parent_rpcs.respond_to? :search @search = ::Gapic::Config::Method.new search_config + search_lite_config = parent_rpcs.search_lite if parent_rpcs.respond_to? :search_lite + @search_lite = ::Gapic::Config::Method.new search_lite_config yield self if block_given? end diff --git a/google-cloud-discovery_engine-v1/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb b/google-cloud-discovery_engine-v1/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb index 89a26ad7cb56..48b64f81c702 100644 --- a/google-cloud-discovery_engine-v1/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +++ b/google-cloud-discovery_engine-v1/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb @@ -468,6 +468,310 @@ def search request, options = nil raise ::Google::Cloud::Error.from_error(e) end + ## + # Performs a search. Similar to the + # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::Client#search SearchService.Search} + # method, but a lite version that allows API key for authentication, where + # OAuth and IAM checks are not required. + # + # Only public website search is supported by this method. If data stores and + # engines not associated with public website search are specified, a + # `FAILED_PRECONDITION` error is returned. + # + # This method can be used for easy onboarding without having to implement an + # authentication backend. However, it is strongly recommended to use + # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::Client#search SearchService.Search} + # instead with required OAuth and IAM checks to provide better data security. + # + # @overload search_lite(request, options = nil) + # Pass arguments to `search_lite` via a request object, either of type + # {::Google::Cloud::DiscoveryEngine::V1::SearchRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::DiscoveryEngine::V1::SearchRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload search_lite(serving_config: nil, branch: nil, query: nil, image_query: nil, page_size: nil, page_token: nil, offset: nil, one_box_page_size: nil, data_store_specs: nil, filter: nil, canonical_filter: nil, order_by: nil, user_info: nil, language_code: nil, facet_specs: nil, boost_spec: nil, params: nil, query_expansion_spec: nil, spell_correction_spec: nil, user_pseudo_id: nil, content_search_spec: nil, safe_search: nil, user_labels: nil, search_as_you_type_spec: nil, session: nil, session_spec: nil) + # Pass arguments to `search_lite` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param serving_config [::String] + # Required. The resource name of the Search serving config, such as + # `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`, + # or + # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config`. + # This field is used to identify the serving configuration name, set + # of models used to make the search. + # @param branch [::String] + # The branch resource name, such as + # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/branches/0`. + # + # Use `default_branch` as the branch ID or leave this field empty, to search + # documents under the default branch. + # @param query [::String] + # Raw search query. + # @param image_query [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ImageQuery, ::Hash] + # Raw image query. + # @param page_size [::Integer] + # Maximum number of {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to + # return. The maximum allowed value depends on the data type. Values above + # the maximum value are coerced to the maximum value. + # + # * Websites with basic indexing: Default `10`, Maximum `25`. + # * Websites with advanced indexing: Default `25`, Maximum `50`. + # * Other: Default `50`, Maximum `100`. + # + # If this field is negative, an `INVALID_ARGUMENT` is returned. + # @param page_token [::String] + # A page token received from a previous + # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::Client#search SearchService.Search} + # call. Provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to + # {::Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::Client#search SearchService.Search} + # must match the call that provided the page token. Otherwise, an + # `INVALID_ARGUMENT` error is returned. + # @param offset [::Integer] + # A 0-indexed integer that specifies the current offset (that is, starting + # result location, amongst the + # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s deemed by the API as + # relevant) in search results. This field is only considered if + # {::Google::Cloud::DiscoveryEngine::V1::SearchRequest#page_token page_token} is + # unset. + # + # If this field is negative, an `INVALID_ARGUMENT` is returned. + # @param one_box_page_size [::Integer] + # The maximum number of results to return for OneBox. + # This applies to each OneBox type individually. + # Default number is 10. + # @param data_store_specs [::Array<::Google::Cloud::DiscoveryEngine::V1::SearchRequest::DataStoreSpec, ::Hash>] + # Specs defining dataStores to filter on in a search call and configurations + # for those dataStores. This is only considered for engines with multiple + # dataStores use case. For single dataStore within an engine, they should + # use the specs at the top level. + # @param filter [::String] + # The filter syntax consists of an expression language for constructing a + # predicate from one or more fields of the documents being filtered. Filter + # expression is case-sensitive. + # + # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + # + # Filtering in Vertex AI Search is done by mapping the LHS filter key to a + # key property defined in the Vertex AI Search backend -- this mapping is + # defined by the customer in their schema. For example a media customer might + # have a field 'name' in their schema. In this case the filter would look + # like this: filter --> name:'ANY("king kong")' + # + # For more information about filtering including syntax and filter + # operators, see + # [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata) + # @param canonical_filter [::String] + # The default filter that is applied when a user performs a search without + # checking any filters on the search page. + # + # The filter applied to every search request when quality improvement such as + # query expansion is needed. In the case a query does not have a sufficient + # amount of results this filter will be used to determine whether or not to + # enable the query expansion flow. The original filter will still be used for + # the query expanded search. + # This field is strongly recommended to achieve high search quality. + # + # For more information about filter syntax, see + # {::Google::Cloud::DiscoveryEngine::V1::SearchRequest#filter SearchRequest.filter}. + # @param order_by [::String] + # The order in which documents are returned. Documents can be ordered by + # a field in an {::Google::Cloud::DiscoveryEngine::V1::Document Document} object. + # Leave it unset if ordered by relevance. `order_by` expression is + # case-sensitive. + # + # For more information on ordering the website search results, see + # [Order web search + # results](https://cloud.google.com/generative-ai-app-builder/docs/order-web-search-results). + # For more information on ordering the healthcare search results, see + # [Order healthcare search + # results](https://cloud.google.com/generative-ai-app-builder/docs/order-hc-results). + # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + # @param user_info [::Google::Cloud::DiscoveryEngine::V1::UserInfo, ::Hash] + # Information about the end user. + # Highly recommended for analytics. + # {::Google::Cloud::DiscoveryEngine::V1::UserInfo#user_agent UserInfo.user_agent} + # is used to deduce `device_type` for analytics. + # @param language_code [::String] + # The BCP-47 language code, such as "en-US" or "sr-Latn". For more + # information, see [Standard + # fields](https://cloud.google.com/apis/design/standard_fields). This field + # helps to better interpret the query. If a value isn't specified, the query + # language code is automatically detected, which may not be accurate. + # @param facet_specs [::Array<::Google::Cloud::DiscoveryEngine::V1::SearchRequest::FacetSpec, ::Hash>] + # Facet specifications for faceted search. If empty, no facets are returned. + # + # A maximum of 100 values are allowed. Otherwise, an `INVALID_ARGUMENT` + # error is returned. + # @param boost_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::BoostSpec, ::Hash] + # Boost specification to boost certain documents. + # For more information on boosting, see + # [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results) + # @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}] + # Additional search parameters. + # + # For public website search only, supported values are: + # + # * `user_country_code`: string. Default empty. If set to non-empty, results + # are restricted or boosted based on the location provided. + # For example, `user_country_code: "au"` + # + # For available codes see [Country + # Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) + # + # * `search_type`: double. Default empty. Enables non-webpage searching + # depending on the value. The only valid non-default value is 1, + # which enables image searching. + # For example, `search_type: 1` + # @param query_expansion_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::QueryExpansionSpec, ::Hash] + # The query expansion specification that specifies the conditions under which + # query expansion occurs. + # @param spell_correction_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SpellCorrectionSpec, ::Hash] + # The spell correction specification that specifies the mode under + # which spell correction takes effect. + # @param user_pseudo_id [::String] + # A unique identifier for tracking visitors. For example, this could be + # implemented with an HTTP cookie, which should be able to uniquely identify + # a visitor on a single device. This unique identifier should not change if + # the visitor logs in or out of the website. + # + # This field should NOT have a fixed value such as `unknown_visitor`. + # + # This should be the same identifier as + # {::Google::Cloud::DiscoveryEngine::V1::UserEvent#user_pseudo_id UserEvent.user_pseudo_id} + # and + # {::Google::Cloud::DiscoveryEngine::V1::CompleteQueryRequest#user_pseudo_id CompleteQueryRequest.user_pseudo_id} + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an `INVALID_ARGUMENT` error is returned. + # @param content_search_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ContentSearchSpec, ::Hash] + # A specification for configuring the behavior of content search. + # @param safe_search [::Boolean] + # Whether to turn on safe search. This is only supported for + # website search. + # @param user_labels [::Hash{::String => ::String}] + # The user labels applied to a resource must meet the following requirements: + # + # * Each resource can have multiple labels, up to a maximum of 64. + # * Each label must be a key-value pair. + # * Keys have a minimum length of 1 character and a maximum length of 63 + # characters and cannot be empty. Values can be empty and have a maximum + # length of 63 characters. + # * Keys and values can contain only lowercase letters, numeric characters, + # underscores, and dashes. All characters must use UTF-8 encoding, and + # international characters are allowed. + # * The key portion of a label must be unique. However, you can use the same + # key with multiple resources. + # * Keys must start with a lowercase letter or international character. + # + # See [Google Cloud + # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + # for more details. + # @param search_as_you_type_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SearchAsYouTypeSpec, ::Hash] + # Search as you type configuration. Only supported for the + # {::Google::Cloud::DiscoveryEngine::V1::IndustryVertical::MEDIA IndustryVertical.MEDIA} + # vertical. + # @param session [::String] + # The session resource name. Optional. + # + # Session allows users to do multi-turn /search API calls or coordination + # between /search API calls and /answer API calls. + # + # Example #1 (multi-turn /search API calls): + # 1. Call /search API with the auto-session mode (see below). + # 2. Call /search API with the session ID generated in the first call. + # Here, the previous search query gets considered in query + # standing. I.e., if the first query is "How did Alphabet do in 2022?" + # and the current query is "How about 2023?", the current query will + # be interpreted as "How did Alphabet do in 2023?". + # + # Example #2 (coordination between /search API calls and /answer API calls): + # 1. Call /search API with the auto-session mode (see below). + # 2. Call /answer API with the session ID generated in the first call. + # Here, the answer generation happens in the context of the search + # results from the first search call. + # + # Auto-session mode: when `projects/.../sessions/-` is used, a new session + # gets automatically created. Otherwise, users can use the create-session API + # to create a session manually. + # + # Multi-turn Search feature is currently at private GA stage. Please use + # v1alpha or v1beta version instead before we launch this feature to public + # GA. Or ask for allowlisting through Google Support team. + # @param session_spec [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SessionSpec, ::Hash] + # Session specification. + # + # Can be used only when `session` is set. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::SearchResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::DiscoveryEngine::V1::SearchResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/discovery_engine/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::DiscoveryEngine::V1::SearchRequest.new + # + # # Call the search_lite method. + # result = client.search_lite request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult. + # p item + # end + # + def search_lite request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::SearchRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.search_lite.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.search_lite.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.search_lite.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @search_service_stub.search_lite request, options do |result, operation| + yield result, operation if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + ## # Configuration class for the SearchService REST API. # @@ -606,11 +910,18 @@ class Rpcs # @return [::Gapic::Config::Method] # attr_reader :search + ## + # RPC-specific configuration for `search_lite` + # @return [::Gapic::Config::Method] + # + attr_reader :search_lite # @private def initialize parent_rpcs = nil search_config = parent_rpcs.search if parent_rpcs.respond_to? :search @search = ::Gapic::Config::Method.new search_config + search_lite_config = parent_rpcs.search_lite if parent_rpcs.respond_to? :search_lite + @search_lite = ::Gapic::Config::Method.new search_lite_config yield self if block_given? end diff --git a/google-cloud-discovery_engine-v1/lib/google/cloud/discovery_engine/v1/search_service/rest/service_stub.rb b/google-cloud-discovery_engine-v1/lib/google/cloud/discovery_engine/v1/search_service/rest/service_stub.rb index 1bce744d4e65..5edaf87ecff5 100644 --- a/google-cloud-discovery_engine-v1/lib/google/cloud/discovery_engine/v1/search_service/rest/service_stub.rb +++ b/google-cloud-discovery_engine-v1/lib/google/cloud/discovery_engine/v1/search_service/rest/service_stub.rb @@ -99,6 +99,44 @@ def search request_pb, options = nil result end + ## + # Baseline implementation for the search_lite REST call + # + # @param request_pb [::Google::Cloud::DiscoveryEngine::V1::SearchRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::SearchResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::DiscoveryEngine::V1::SearchResponse] + # A result object deserialized from the server's reply + def search_lite request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_search_lite_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::DiscoveryEngine::V1::SearchResponse.decode_json response.body, ignore_unknown_fields: true + + yield result, operation if block_given? + result + end + ## # @private # @@ -136,6 +174,44 @@ def self.transcode_search_request request_pb ) transcoder.transcode request_pb end + + ## + # @private + # + # GRPC transcoding helper method for the search_lite REST call + # + # @param request_pb [::Google::Cloud::DiscoveryEngine::V1::SearchRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_search_lite_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{serving_config}:searchLite", + body: "*", + matches: [ + ["serving_config", %r{^projects/[^/]+/locations/[^/]+/dataStores/[^/]+/servingConfigs/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :post, + uri_template: "/v1/{serving_config}:searchLite", + body: "*", + matches: [ + ["serving_config", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/servingConfigs/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :post, + uri_template: "/v1/{serving_config}:searchLite", + body: "*", + matches: [ + ["serving_config", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/servingConfigs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end end end end diff --git a/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/answer_pb.rb b/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/answer_pb.rb index 3c20c241208a..959779ec8d29 100644 --- a/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/answer_pb.rb +++ b/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/answer_pb.rb @@ -10,7 +10,7 @@ require 'google/protobuf/timestamp_pb' -descriptor_data = "\n,google/cloud/discoveryengine/v1/answer.proto\x12\x1fgoogle.cloud.discoveryengine.v1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xc0\"\n\x06\x41nswer\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x05\x12<\n\x05state\x18\x02 \x01(\x0e\x32-.google.cloud.discoveryengine.v1.Answer.State\x12\x13\n\x0b\x61nswer_text\x18\x03 \x01(\t\x12\x43\n\tcitations\x18\x04 \x03(\x0b\x32\x30.google.cloud.discoveryengine.v1.Answer.Citation\x12\x45\n\nreferences\x18\x05 \x03(\x0b\x32\x31.google.cloud.discoveryengine.v1.Answer.Reference\x12\x19\n\x11related_questions\x18\x06 \x03(\t\x12;\n\x05steps\x18\x07 \x03(\x0b\x32,.google.cloud.discoveryengine.v1.Answer.Step\x12`\n\x18query_understanding_info\x18\n \x01(\x0b\x32>.google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo\x12[\n\x16\x61nswer_skipped_reasons\x18\x0b \x03(\x0e\x32;.google.cloud.discoveryengine.v1.Answer.AnswerSkippedReason\x12\x34\n\x0b\x63reate_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x36\n\rcomplete_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x1a{\n\x08\x43itation\x12\x13\n\x0bstart_index\x18\x01 \x01(\x03\x12\x11\n\tend_index\x18\x02 \x01(\x03\x12G\n\x07sources\x18\x03 \x03(\x0b\x32\x36.google.cloud.discoveryengine.v1.Answer.CitationSource\x1a&\n\x0e\x43itationSource\x12\x14\n\x0creference_id\x18\x01 \x01(\t\x1a\x82\n\n\tReference\x12p\n\x1aunstructured_document_info\x18\x01 \x01(\x0b\x32J.google.cloud.discoveryengine.v1.Answer.Reference.UnstructuredDocumentInfoH\x00\x12Q\n\nchunk_info\x18\x02 \x01(\x0b\x32;.google.cloud.discoveryengine.v1.Answer.Reference.ChunkInfoH\x00\x12l\n\x18structured_document_info\x18\x03 \x01(\x0b\x32H.google.cloud.discoveryengine.v1.Answer.Reference.StructuredDocumentInfoH\x00\x1a\x81\x03\n\x18UnstructuredDocumentInfo\x12>\n\x08\x64ocument\x18\x01 \x01(\tB,\xfa\x41)\n\'discoveryengine.googleapis.com/Document\x12\x0b\n\x03uri\x18\x02 \x01(\t\x12\r\n\x05title\x18\x03 \x01(\t\x12o\n\x0e\x63hunk_contents\x18\x04 \x03(\x0b\x32W.google.cloud.discoveryengine.v1.Answer.Reference.UnstructuredDocumentInfo.ChunkContent\x12,\n\x0bstruct_data\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\x1aj\n\x0c\x43hunkContent\x12\x0f\n\x07\x63ontent\x18\x01 \x01(\t\x12\x17\n\x0fpage_identifier\x18\x02 \x01(\t\x12\x1c\n\x0frelevance_score\x18\x03 \x01(\x02H\x00\x88\x01\x01\x42\x12\n\x10_relevance_score\x1a\xa9\x03\n\tChunkInfo\x12\x38\n\x05\x63hunk\x18\x01 \x01(\tB)\xfa\x41&\n$discoveryengine.googleapis.com/Chunk\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\t\x12\x1c\n\x0frelevance_score\x18\x03 \x01(\x02H\x00\x88\x01\x01\x12g\n\x11\x64ocument_metadata\x18\x04 \x01(\x0b\x32L.google.cloud.discoveryengine.v1.Answer.Reference.ChunkInfo.DocumentMetadata\x1a\xb5\x01\n\x10\x44ocumentMetadata\x12>\n\x08\x64ocument\x18\x01 \x01(\tB,\xfa\x41)\n\'discoveryengine.googleapis.com/Document\x12\x0b\n\x03uri\x18\x02 \x01(\t\x12\r\n\x05title\x18\x03 \x01(\t\x12\x17\n\x0fpage_identifier\x18\x04 \x01(\t\x12,\n\x0bstruct_data\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructB\x12\n\x10_relevance_score\x1a\x86\x01\n\x16StructuredDocumentInfo\x12>\n\x08\x64ocument\x18\x01 \x01(\tB,\xfa\x41)\n\'discoveryengine.googleapis.com/Document\x12,\n\x0bstruct_data\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructB\t\n\x07\x63ontent\x1a\xbc\x08\n\x04Step\x12\x41\n\x05state\x18\x01 \x01(\x0e\x32\x32.google.cloud.discoveryengine.v1.Answer.Step.State\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0f\n\x07thought\x18\x03 \x01(\t\x12\x44\n\x07\x61\x63tions\x18\x04 \x03(\x0b\x32\x33.google.cloud.discoveryengine.v1.Answer.Step.Action\x1a\xb8\x06\n\x06\x41\x63tion\x12Y\n\rsearch_action\x18\x02 \x01(\x0b\x32@.google.cloud.discoveryengine.v1.Answer.Step.Action.SearchActionH\x00\x12T\n\x0bobservation\x18\x03 \x01(\x0b\x32?.google.cloud.discoveryengine.v1.Answer.Step.Action.Observation\x1a\x1d\n\x0cSearchAction\x12\r\n\x05query\x18\x01 \x01(\t\x1a\xd3\x04\n\x0bObservation\x12\x64\n\x0esearch_results\x18\x02 \x03(\x0b\x32L.google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult\x1a\xdd\x03\n\x0cSearchResult\x12\x10\n\x08\x64ocument\x18\x01 \x01(\t\x12\x0b\n\x03uri\x18\x02 \x01(\t\x12\r\n\x05title\x18\x03 \x01(\t\x12n\n\x0csnippet_info\x18\x04 \x03(\x0b\x32X.google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult.SnippetInfo\x12j\n\nchunk_info\x18\x05 \x03(\x0b\x32V.google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult.ChunkInfo\x12,\n\x0bstruct_data\x18\x06 \x01(\x0b\x32\x17.google.protobuf.Struct\x1a\x36\n\x0bSnippetInfo\x12\x0f\n\x07snippet\x18\x01 \x01(\t\x12\x16\n\x0esnippet_status\x18\x02 \x01(\t\x1a]\n\tChunkInfo\x12\r\n\x05\x63hunk\x18\x01 \x01(\t\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\t\x12\x1c\n\x0frelevance_score\x18\x03 \x01(\x02H\x00\x88\x01\x01\x42\x12\n\x10_relevance_scoreB\x08\n\x06\x61\x63tion\"J\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0f\n\x0bIN_PROGRESS\x10\x01\x12\n\n\x06\x46\x41ILED\x10\x02\x12\r\n\tSUCCEEDED\x10\x03\x1a\xba\x03\n\x16QueryUnderstandingInfo\x12y\n\x19query_classification_info\x18\x01 \x03(\x0b\x32V.google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo.QueryClassificationInfo\x1a\xa4\x02\n\x17QueryClassificationInfo\x12i\n\x04type\x18\x01 \x01(\x0e\x32[.google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo.QueryClassificationInfo.Type\x12\x10\n\x08positive\x18\x02 \x01(\x08\"\x8b\x01\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x41\x44VERSARIAL_QUERY\x10\x01\x12\x1c\n\x18NON_ANSWER_SEEKING_QUERY\x10\x02\x12\x17\n\x13JAIL_BREAKING_QUERY\x10\x03\x12\x1f\n\x1bNON_ANSWER_SEEKING_QUERY_V2\x10\x04\"J\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0f\n\x0bIN_PROGRESS\x10\x01\x12\n\n\x06\x46\x41ILED\x10\x02\x12\r\n\tSUCCEEDED\x10\x03\"\xc4\x02\n\x13\x41nswerSkippedReason\x12%\n!ANSWER_SKIPPED_REASON_UNSPECIFIED\x10\x00\x12\x1d\n\x19\x41\x44VERSARIAL_QUERY_IGNORED\x10\x01\x12$\n NON_ANSWER_SEEKING_QUERY_IGNORED\x10\x02\x12\x1f\n\x1bOUT_OF_DOMAIN_QUERY_IGNORED\x10\x03\x12\x1e\n\x1aPOTENTIAL_POLICY_VIOLATION\x10\x04\x12\x17\n\x13NO_RELEVANT_CONTENT\x10\x05\x12\x1f\n\x1bJAIL_BREAKING_QUERY_IGNORED\x10\x06\x12\x1d\n\x19\x43USTOMER_POLICY_VIOLATION\x10\x07\x12\'\n#NON_ANSWER_SEEKING_QUERY_IGNORED_V2\x10\x08:\x85\x03\xea\x41\x81\x03\n%discoveryengine.googleapis.com/Answer\x12\x63projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}/answers/{answer}\x12|projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/sessions/{session}/answers/{answer}\x12uprojects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}/answers/{answer}B\xfe\x01\n#com.google.cloud.discoveryengine.v1B\x0b\x41nswerProtoP\x01ZMcloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb\xa2\x02\x0f\x44ISCOVERYENGINE\xaa\x02\x1fGoogle.Cloud.DiscoveryEngine.V1\xca\x02\x1fGoogle\\Cloud\\DiscoveryEngine\\V1\xea\x02\"Google::Cloud::DiscoveryEngine::V1b\x06proto3" +descriptor_data = "\n,google/cloud/discoveryengine/v1/answer.proto\x12\x1fgoogle.cloud.discoveryengine.v1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xd9\"\n\x06\x41nswer\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x05\x12<\n\x05state\x18\x02 \x01(\x0e\x32-.google.cloud.discoveryengine.v1.Answer.State\x12\x13\n\x0b\x61nswer_text\x18\x03 \x01(\t\x12\x43\n\tcitations\x18\x04 \x03(\x0b\x32\x30.google.cloud.discoveryengine.v1.Answer.Citation\x12\x45\n\nreferences\x18\x05 \x03(\x0b\x32\x31.google.cloud.discoveryengine.v1.Answer.Reference\x12\x19\n\x11related_questions\x18\x06 \x03(\t\x12;\n\x05steps\x18\x07 \x03(\x0b\x32,.google.cloud.discoveryengine.v1.Answer.Step\x12`\n\x18query_understanding_info\x18\n \x01(\x0b\x32>.google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo\x12[\n\x16\x61nswer_skipped_reasons\x18\x0b \x03(\x0e\x32;.google.cloud.discoveryengine.v1.Answer.AnswerSkippedReason\x12\x34\n\x0b\x63reate_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x36\n\rcomplete_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x1a{\n\x08\x43itation\x12\x13\n\x0bstart_index\x18\x01 \x01(\x03\x12\x11\n\tend_index\x18\x02 \x01(\x03\x12G\n\x07sources\x18\x03 \x03(\x0b\x32\x36.google.cloud.discoveryengine.v1.Answer.CitationSource\x1a&\n\x0e\x43itationSource\x12\x14\n\x0creference_id\x18\x01 \x01(\t\x1a\x82\n\n\tReference\x12p\n\x1aunstructured_document_info\x18\x01 \x01(\x0b\x32J.google.cloud.discoveryengine.v1.Answer.Reference.UnstructuredDocumentInfoH\x00\x12Q\n\nchunk_info\x18\x02 \x01(\x0b\x32;.google.cloud.discoveryengine.v1.Answer.Reference.ChunkInfoH\x00\x12l\n\x18structured_document_info\x18\x03 \x01(\x0b\x32H.google.cloud.discoveryengine.v1.Answer.Reference.StructuredDocumentInfoH\x00\x1a\x81\x03\n\x18UnstructuredDocumentInfo\x12>\n\x08\x64ocument\x18\x01 \x01(\tB,\xfa\x41)\n\'discoveryengine.googleapis.com/Document\x12\x0b\n\x03uri\x18\x02 \x01(\t\x12\r\n\x05title\x18\x03 \x01(\t\x12o\n\x0e\x63hunk_contents\x18\x04 \x03(\x0b\x32W.google.cloud.discoveryengine.v1.Answer.Reference.UnstructuredDocumentInfo.ChunkContent\x12,\n\x0bstruct_data\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\x1aj\n\x0c\x43hunkContent\x12\x0f\n\x07\x63ontent\x18\x01 \x01(\t\x12\x17\n\x0fpage_identifier\x18\x02 \x01(\t\x12\x1c\n\x0frelevance_score\x18\x03 \x01(\x02H\x00\x88\x01\x01\x42\x12\n\x10_relevance_score\x1a\xa9\x03\n\tChunkInfo\x12\x38\n\x05\x63hunk\x18\x01 \x01(\tB)\xfa\x41&\n$discoveryengine.googleapis.com/Chunk\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\t\x12\x1c\n\x0frelevance_score\x18\x03 \x01(\x02H\x00\x88\x01\x01\x12g\n\x11\x64ocument_metadata\x18\x04 \x01(\x0b\x32L.google.cloud.discoveryengine.v1.Answer.Reference.ChunkInfo.DocumentMetadata\x1a\xb5\x01\n\x10\x44ocumentMetadata\x12>\n\x08\x64ocument\x18\x01 \x01(\tB,\xfa\x41)\n\'discoveryengine.googleapis.com/Document\x12\x0b\n\x03uri\x18\x02 \x01(\t\x12\r\n\x05title\x18\x03 \x01(\t\x12\x17\n\x0fpage_identifier\x18\x04 \x01(\t\x12,\n\x0bstruct_data\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructB\x12\n\x10_relevance_score\x1a\x86\x01\n\x16StructuredDocumentInfo\x12>\n\x08\x64ocument\x18\x01 \x01(\tB,\xfa\x41)\n\'discoveryengine.googleapis.com/Document\x12,\n\x0bstruct_data\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructB\t\n\x07\x63ontent\x1a\xbc\x08\n\x04Step\x12\x41\n\x05state\x18\x01 \x01(\x0e\x32\x32.google.cloud.discoveryengine.v1.Answer.Step.State\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0f\n\x07thought\x18\x03 \x01(\t\x12\x44\n\x07\x61\x63tions\x18\x04 \x03(\x0b\x32\x33.google.cloud.discoveryengine.v1.Answer.Step.Action\x1a\xb8\x06\n\x06\x41\x63tion\x12Y\n\rsearch_action\x18\x02 \x01(\x0b\x32@.google.cloud.discoveryengine.v1.Answer.Step.Action.SearchActionH\x00\x12T\n\x0bobservation\x18\x03 \x01(\x0b\x32?.google.cloud.discoveryengine.v1.Answer.Step.Action.Observation\x1a\x1d\n\x0cSearchAction\x12\r\n\x05query\x18\x01 \x01(\t\x1a\xd3\x04\n\x0bObservation\x12\x64\n\x0esearch_results\x18\x02 \x03(\x0b\x32L.google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult\x1a\xdd\x03\n\x0cSearchResult\x12\x10\n\x08\x64ocument\x18\x01 \x01(\t\x12\x0b\n\x03uri\x18\x02 \x01(\t\x12\r\n\x05title\x18\x03 \x01(\t\x12n\n\x0csnippet_info\x18\x04 \x03(\x0b\x32X.google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult.SnippetInfo\x12j\n\nchunk_info\x18\x05 \x03(\x0b\x32V.google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult.ChunkInfo\x12,\n\x0bstruct_data\x18\x06 \x01(\x0b\x32\x17.google.protobuf.Struct\x1a\x36\n\x0bSnippetInfo\x12\x0f\n\x07snippet\x18\x01 \x01(\t\x12\x16\n\x0esnippet_status\x18\x02 \x01(\t\x1a]\n\tChunkInfo\x12\r\n\x05\x63hunk\x18\x01 \x01(\t\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\t\x12\x1c\n\x0frelevance_score\x18\x03 \x01(\x02H\x00\x88\x01\x01\x42\x12\n\x10_relevance_scoreB\x08\n\x06\x61\x63tion\"J\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0f\n\x0bIN_PROGRESS\x10\x01\x12\n\n\x06\x46\x41ILED\x10\x02\x12\r\n\tSUCCEEDED\x10\x03\x1a\xba\x03\n\x16QueryUnderstandingInfo\x12y\n\x19query_classification_info\x18\x01 \x03(\x0b\x32V.google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo.QueryClassificationInfo\x1a\xa4\x02\n\x17QueryClassificationInfo\x12i\n\x04type\x18\x01 \x01(\x0e\x32[.google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo.QueryClassificationInfo.Type\x12\x10\n\x08positive\x18\x02 \x01(\x08\"\x8b\x01\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x41\x44VERSARIAL_QUERY\x10\x01\x12\x1c\n\x18NON_ANSWER_SEEKING_QUERY\x10\x02\x12\x17\n\x13JAIL_BREAKING_QUERY\x10\x03\x12\x1f\n\x1bNON_ANSWER_SEEKING_QUERY_V2\x10\x04\"J\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0f\n\x0bIN_PROGRESS\x10\x01\x12\n\n\x06\x46\x41ILED\x10\x02\x12\r\n\tSUCCEEDED\x10\x03\"\xdd\x02\n\x13\x41nswerSkippedReason\x12%\n!ANSWER_SKIPPED_REASON_UNSPECIFIED\x10\x00\x12\x1d\n\x19\x41\x44VERSARIAL_QUERY_IGNORED\x10\x01\x12$\n NON_ANSWER_SEEKING_QUERY_IGNORED\x10\x02\x12\x1f\n\x1bOUT_OF_DOMAIN_QUERY_IGNORED\x10\x03\x12\x1e\n\x1aPOTENTIAL_POLICY_VIOLATION\x10\x04\x12\x17\n\x13NO_RELEVANT_CONTENT\x10\x05\x12\x1f\n\x1bJAIL_BREAKING_QUERY_IGNORED\x10\x06\x12\x1d\n\x19\x43USTOMER_POLICY_VIOLATION\x10\x07\x12\'\n#NON_ANSWER_SEEKING_QUERY_IGNORED_V2\x10\x08\x12\x17\n\x13LOW_GROUNDED_ANSWER\x10\t:\x85\x03\xea\x41\x81\x03\n%discoveryengine.googleapis.com/Answer\x12\x63projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}/answers/{answer}\x12|projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/sessions/{session}/answers/{answer}\x12uprojects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}/answers/{answer}B\xfe\x01\n#com.google.cloud.discoveryengine.v1B\x0b\x41nswerProtoP\x01ZMcloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb\xa2\x02\x0f\x44ISCOVERYENGINE\xaa\x02\x1fGoogle.Cloud.DiscoveryEngine.V1\xca\x02\x1fGoogle\\Cloud\\DiscoveryEngine\\V1\xea\x02\"Google::Cloud::DiscoveryEngine::V1b\x06proto3" pool = Google::Protobuf::DescriptorPool.generated_pool diff --git a/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/control_pb.rb b/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/control_pb.rb index 70a8092f9bd4..389413ca34df 100644 --- a/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/control_pb.rb +++ b/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/control_pb.rb @@ -10,7 +10,7 @@ require 'google/protobuf/timestamp_pb' -descriptor_data = "\n-google/cloud/discoveryengine/v1/control.proto\x12\x1fgoogle.cloud.discoveryengine.v1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a,google/cloud/discoveryengine/v1/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xc2\x02\n\tCondition\x12I\n\x0bquery_terms\x18\x02 \x03(\x0b\x32\x34.google.cloud.discoveryengine.v1.Condition.QueryTerm\x12O\n\x11\x61\x63tive_time_range\x18\x03 \x03(\x0b\x32\x34.google.cloud.discoveryengine.v1.Condition.TimeRange\x1a.\n\tQueryTerm\x12\r\n\x05value\x18\x01 \x01(\t\x12\x12\n\nfull_match\x18\x02 \x01(\x08\x1ai\n\tTimeRange\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x94\n\n\x07\x43ontrol\x12L\n\x0c\x62oost_action\x18\x06 \x01(\x0b\x32\x34.google.cloud.discoveryengine.v1.Control.BoostActionH\x00\x12N\n\rfilter_action\x18\x07 \x01(\x0b\x32\x35.google.cloud.discoveryengine.v1.Control.FilterActionH\x00\x12R\n\x0fredirect_action\x18\t \x01(\x0b\x32\x37.google.cloud.discoveryengine.v1.Control.RedirectActionH\x00\x12R\n\x0fsynonyms_action\x18\n \x01(\x0b\x32\x37.google.cloud.discoveryengine.v1.Control.SynonymsActionH\x00\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x05\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12*\n\x1d\x61ssociated_serving_config_ids\x18\x03 \x03(\tB\x03\xe0\x41\x03\x12L\n\rsolution_type\x18\x04 \x01(\x0e\x32-.google.cloud.discoveryengine.v1.SolutionTypeB\x06\xe0\x41\x02\xe0\x41\x05\x12\x41\n\tuse_cases\x18\x08 \x03(\x0e\x32..google.cloud.discoveryengine.v1.SearchUseCase\x12>\n\nconditions\x18\x05 \x03(\x0b\x32*.google.cloud.discoveryengine.v1.Condition\x1a|\n\x0b\x42oostAction\x12\x12\n\x05\x62oost\x18\x01 \x01(\x02\x42\x03\xe0\x41\x02\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x44\n\ndata_store\x18\x03 \x01(\tB0\xe0\x41\x02\xfa\x41*\n(discoveryengine.googleapis.com/DataStore\x1ai\n\x0c\x46ilterAction\x12\x13\n\x06\x66ilter\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x44\n\ndata_store\x18\x02 \x01(\tB0\xe0\x41\x02\xfa\x41*\n(discoveryengine.googleapis.com/DataStore\x1a+\n\x0eRedirectAction\x12\x19\n\x0credirect_uri\x18\x01 \x01(\tB\x03\xe0\x41\x02\x1a\"\n\x0eSynonymsAction\x12\x10\n\x08synonyms\x18\x01 \x03(\t:\xd3\x02\xea\x41\xcf\x02\n&discoveryengine.googleapis.com/Control\x12Rprojects/{project}/locations/{location}/dataStores/{data_store}/controls/{control}\x12kprojects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/controls/{control}\x12\x64projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/controls/{control}B\x08\n\x06\x61\x63tionB\xff\x01\n#com.google.cloud.discoveryengine.v1B\x0c\x43ontrolProtoP\x01ZMcloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb\xa2\x02\x0f\x44ISCOVERYENGINE\xaa\x02\x1fGoogle.Cloud.DiscoveryEngine.V1\xca\x02\x1fGoogle\\Cloud\\DiscoveryEngine\\V1\xea\x02\"Google::Cloud::DiscoveryEngine::V1b\x06proto3" +descriptor_data = "\n-google/cloud/discoveryengine/v1/control.proto\x12\x1fgoogle.cloud.discoveryengine.v1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a,google/cloud/discoveryengine/v1/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xdc\x02\n\tCondition\x12I\n\x0bquery_terms\x18\x02 \x03(\x0b\x32\x34.google.cloud.discoveryengine.v1.Condition.QueryTerm\x12O\n\x11\x61\x63tive_time_range\x18\x03 \x03(\x0b\x32\x34.google.cloud.discoveryengine.v1.Condition.TimeRange\x12\x18\n\x0bquery_regex\x18\x04 \x01(\tB\x03\xe0\x41\x01\x1a.\n\tQueryTerm\x12\r\n\x05value\x18\x01 \x01(\t\x12\x12\n\nfull_match\x18\x02 \x01(\x08\x1ai\n\tTimeRange\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x94\n\n\x07\x43ontrol\x12L\n\x0c\x62oost_action\x18\x06 \x01(\x0b\x32\x34.google.cloud.discoveryengine.v1.Control.BoostActionH\x00\x12N\n\rfilter_action\x18\x07 \x01(\x0b\x32\x35.google.cloud.discoveryengine.v1.Control.FilterActionH\x00\x12R\n\x0fredirect_action\x18\t \x01(\x0b\x32\x37.google.cloud.discoveryengine.v1.Control.RedirectActionH\x00\x12R\n\x0fsynonyms_action\x18\n \x01(\x0b\x32\x37.google.cloud.discoveryengine.v1.Control.SynonymsActionH\x00\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x05\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12*\n\x1d\x61ssociated_serving_config_ids\x18\x03 \x03(\tB\x03\xe0\x41\x03\x12L\n\rsolution_type\x18\x04 \x01(\x0e\x32-.google.cloud.discoveryengine.v1.SolutionTypeB\x06\xe0\x41\x02\xe0\x41\x05\x12\x41\n\tuse_cases\x18\x08 \x03(\x0e\x32..google.cloud.discoveryengine.v1.SearchUseCase\x12>\n\nconditions\x18\x05 \x03(\x0b\x32*.google.cloud.discoveryengine.v1.Condition\x1a|\n\x0b\x42oostAction\x12\x12\n\x05\x62oost\x18\x01 \x01(\x02\x42\x03\xe0\x41\x02\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x44\n\ndata_store\x18\x03 \x01(\tB0\xe0\x41\x02\xfa\x41*\n(discoveryengine.googleapis.com/DataStore\x1ai\n\x0c\x46ilterAction\x12\x13\n\x06\x66ilter\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x44\n\ndata_store\x18\x02 \x01(\tB0\xe0\x41\x02\xfa\x41*\n(discoveryengine.googleapis.com/DataStore\x1a+\n\x0eRedirectAction\x12\x19\n\x0credirect_uri\x18\x01 \x01(\tB\x03\xe0\x41\x02\x1a\"\n\x0eSynonymsAction\x12\x10\n\x08synonyms\x18\x01 \x03(\t:\xd3\x02\xea\x41\xcf\x02\n&discoveryengine.googleapis.com/Control\x12Rprojects/{project}/locations/{location}/dataStores/{data_store}/controls/{control}\x12kprojects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/controls/{control}\x12\x64projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/controls/{control}B\x08\n\x06\x61\x63tionB\xff\x01\n#com.google.cloud.discoveryengine.v1B\x0c\x43ontrolProtoP\x01ZMcloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb\xa2\x02\x0f\x44ISCOVERYENGINE\xaa\x02\x1fGoogle.Cloud.DiscoveryEngine.V1\xca\x02\x1fGoogle\\Cloud\\DiscoveryEngine\\V1\xea\x02\"Google::Cloud::DiscoveryEngine::V1b\x06proto3" pool = Google::Protobuf::DescriptorPool.generated_pool diff --git a/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/search_service_pb.rb b/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/search_service_pb.rb index 59aeaafa7434..ffbf637b012f 100644 --- a/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +++ b/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/search_service_pb.rb @@ -14,7 +14,7 @@ require 'google/protobuf/struct_pb' -descriptor_data = "\n4google/cloud/discoveryengine/v1/search_service.proto\x12\x1fgoogle.cloud.discoveryengine.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a+google/cloud/discoveryengine/v1/chunk.proto\x1a,google/cloud/discoveryengine/v1/common.proto\x1a.google/cloud/discoveryengine/v1/document.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xdf)\n\rSearchRequest\x12L\n\x0eserving_config\x18\x01 \x01(\tB4\xe0\x41\x02\xfa\x41.\n,discoveryengine.googleapis.com/ServingConfig\x12:\n\x06\x62ranch\x18\x02 \x01(\tB*\xfa\x41\'\n%discoveryengine.googleapis.com/Branch\x12\r\n\x05query\x18\x03 \x01(\t\x12N\n\x0bimage_query\x18\x13 \x01(\x0b\x32\x39.google.cloud.discoveryengine.v1.SearchRequest.ImageQuery\x12\x11\n\tpage_size\x18\x04 \x01(\x05\x12\x12\n\npage_token\x18\x05 \x01(\t\x12\x0e\n\x06offset\x18\x06 \x01(\x05\x12\x19\n\x11one_box_page_size\x18/ \x01(\x05\x12V\n\x10\x64\x61ta_store_specs\x18 \x03(\x0b\x32<.google.cloud.discoveryengine.v1.SearchRequest.DataStoreSpec\x12\x0e\n\x06\x66ilter\x18\x07 \x01(\t\x12\x18\n\x10\x63\x61nonical_filter\x18\x1d \x01(\t\x12\x10\n\x08order_by\x18\x08 \x01(\t\x12<\n\tuser_info\x18\x15 \x01(\x0b\x32).google.cloud.discoveryengine.v1.UserInfo\x12\x15\n\rlanguage_code\x18# \x01(\t\x12M\n\x0b\x66\x61\x63\x65t_specs\x18\t \x03(\x0b\x32\x38.google.cloud.discoveryengine.v1.SearchRequest.FacetSpec\x12L\n\nboost_spec\x18\n \x01(\x0b\x32\x38.google.cloud.discoveryengine.v1.SearchRequest.BoostSpec\x12J\n\x06params\x18\x0b \x03(\x0b\x32:.google.cloud.discoveryengine.v1.SearchRequest.ParamsEntry\x12_\n\x14query_expansion_spec\x18\r \x01(\x0b\x32\x41.google.cloud.discoveryengine.v1.SearchRequest.QueryExpansionSpec\x12\x61\n\x15spell_correction_spec\x18\x0e \x01(\x0b\x32\x42.google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec\x12\x16\n\x0euser_pseudo_id\x18\x0f \x01(\t\x12]\n\x13\x63ontent_search_spec\x18\x18 \x01(\x0b\x32@.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec\x12\x13\n\x0bsafe_search\x18\x14 \x01(\x08\x12S\n\x0buser_labels\x18\x16 \x03(\x0b\x32>.google.cloud.discoveryengine.v1.SearchRequest.UserLabelsEntry\x12\x63\n\x17search_as_you_type_spec\x18\x1f \x01(\x0b\x32\x42.google.cloud.discoveryengine.v1.SearchRequest.SearchAsYouTypeSpec\x12<\n\x07session\x18) \x01(\tB+\xfa\x41(\n&discoveryengine.googleapis.com/Session\x12P\n\x0csession_spec\x18* \x01(\x0b\x32:.google.cloud.discoveryengine.v1.SearchRequest.SessionSpec\x1a,\n\nImageQuery\x12\x15\n\x0bimage_bytes\x18\x01 \x01(\tH\x00\x42\x07\n\x05image\x1aj\n\rDataStoreSpec\x12\x44\n\ndata_store\x18\x01 \x01(\tB0\xe0\x41\x02\xfa\x41*\n(discoveryengine.googleapis.com/DataStore\x12\x13\n\x06\x66ilter\x18\x05 \x01(\tB\x03\xe0\x41\x01\x1a\xfc\x02\n\tFacetSpec\x12Y\n\tfacet_key\x18\x01 \x01(\x0b\x32\x41.google.cloud.discoveryengine.v1.SearchRequest.FacetSpec.FacetKeyB\x03\xe0\x41\x02\x12\r\n\x05limit\x18\x02 \x01(\x05\x12\x1c\n\x14\x65xcluded_filter_keys\x18\x03 \x03(\t\x12\x1f\n\x17\x65nable_dynamic_position\x18\x04 \x01(\x08\x1a\xc5\x01\n\x08\x46\x61\x63\x65tKey\x12\x10\n\x03key\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12<\n\tintervals\x18\x02 \x03(\x0b\x32).google.cloud.discoveryengine.v1.Interval\x12\x19\n\x11restricted_values\x18\x03 \x03(\t\x12\x10\n\x08prefixes\x18\x04 \x03(\t\x12\x10\n\x08\x63ontains\x18\x05 \x03(\t\x12\x18\n\x10\x63\x61se_insensitive\x18\x06 \x01(\x08\x12\x10\n\x08order_by\x18\x07 \x01(\t\x1a\xbc\x07\n\tBoostSpec\x12j\n\x15\x63ondition_boost_specs\x18\x01 \x03(\x0b\x32K.google.cloud.discoveryengine.v1.SearchRequest.BoostSpec.ConditionBoostSpec\x1a\xc2\x06\n\x12\x43onditionBoostSpec\x12\x11\n\tcondition\x18\x01 \x01(\t\x12\r\n\x05\x62oost\x18\x02 \x01(\x02\x12x\n\x12\x62oost_control_spec\x18\x03 \x01(\x0b\x32\\.google.cloud.discoveryengine.v1.SearchRequest.BoostSpec.ConditionBoostSpec.BoostControlSpec\x1a\x8f\x05\n\x10\x42oostControlSpec\x12\x12\n\nfield_name\x18\x01 \x01(\t\x12\x82\x01\n\x0e\x61ttribute_type\x18\x02 \x01(\x0e\x32j.google.cloud.discoveryengine.v1.SearchRequest.BoostSpec.ConditionBoostSpec.BoostControlSpec.AttributeType\x12\x8a\x01\n\x12interpolation_type\x18\x03 \x01(\x0e\x32n.google.cloud.discoveryengine.v1.SearchRequest.BoostSpec.ConditionBoostSpec.BoostControlSpec.InterpolationType\x12\x81\x01\n\x0e\x63ontrol_points\x18\x04 \x03(\x0b\x32i.google.cloud.discoveryengine.v1.SearchRequest.BoostSpec.ConditionBoostSpec.BoostControlSpec.ControlPoint\x1a=\n\x0c\x43ontrolPoint\x12\x17\n\x0f\x61ttribute_value\x18\x01 \x01(\t\x12\x14\n\x0c\x62oost_amount\x18\x02 \x01(\x02\"M\n\rAttributeType\x12\x1e\n\x1a\x41TTRIBUTE_TYPE_UNSPECIFIED\x10\x00\x12\r\n\tNUMERICAL\x10\x01\x12\r\n\tFRESHNESS\x10\x02\"C\n\x11InterpolationType\x12\"\n\x1eINTERPOLATION_TYPE_UNSPECIFIED\x10\x00\x12\n\n\x06LINEAR\x10\x01\x1a\xd4\x01\n\x12QueryExpansionSpec\x12^\n\tcondition\x18\x01 \x01(\x0e\x32K.google.cloud.discoveryengine.v1.SearchRequest.QueryExpansionSpec.Condition\x12\x1e\n\x16pin_unexpanded_results\x18\x02 \x01(\x08\">\n\tCondition\x12\x19\n\x15\x43ONDITION_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\x08\n\x04\x41UTO\x10\x02\x1a\xa9\x01\n\x13SpellCorrectionSpec\x12U\n\x04mode\x18\x01 \x01(\x0e\x32G.google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec.Mode\";\n\x04Mode\x12\x14\n\x10MODE_UNSPECIFIED\x10\x00\x12\x13\n\x0fSUGGESTION_ONLY\x10\x01\x12\x08\n\x04\x41UTO\x10\x02\x1a\xa2\x0c\n\x11\x43ontentSearchSpec\x12\x62\n\x0csnippet_spec\x18\x01 \x01(\x0b\x32L.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SnippetSpec\x12\x62\n\x0csummary_spec\x18\x02 \x01(\x0b\x32L.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SummarySpec\x12w\n\x17\x65xtractive_content_spec\x18\x03 \x01(\x0b\x32V.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.ExtractiveContentSpec\x12m\n\x12search_result_mode\x18\x04 \x01(\x0e\x32Q.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SearchResultMode\x12^\n\nchunk_spec\x18\x05 \x01(\x0b\x32J.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.ChunkSpec\x1a`\n\x0bSnippetSpec\x12\x1d\n\x11max_snippet_count\x18\x01 \x01(\x05\x42\x02\x18\x01\x12\x1a\n\x0ereference_only\x18\x02 \x01(\x08\x42\x02\x18\x01\x12\x16\n\x0ereturn_snippet\x18\x03 \x01(\x08\x1a\xbc\x04\n\x0bSummarySpec\x12\x1c\n\x14summary_result_count\x18\x01 \x01(\x05\x12\x19\n\x11include_citations\x18\x02 \x01(\x08\x12 \n\x18ignore_adversarial_query\x18\x03 \x01(\x08\x12(\n ignore_non_summary_seeking_query\x18\x04 \x01(\x08\x12#\n\x1bignore_low_relevant_content\x18\t \x01(\x08\x12\'\n\x1aignore_jail_breaking_query\x18\n \x01(\x08\x42\x03\xe0\x41\x01\x12w\n\x11model_prompt_spec\x18\x05 \x01(\x0b\x32\\.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SummarySpec.ModelPromptSpec\x12\x15\n\rlanguage_code\x18\x06 \x01(\t\x12j\n\nmodel_spec\x18\x07 \x01(\x0b\x32V.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SummarySpec.ModelSpec\x12\x1b\n\x13use_semantic_chunks\x18\x08 \x01(\x08\x1a#\n\x0fModelPromptSpec\x12\x10\n\x08preamble\x18\x01 \x01(\t\x1a\x1c\n\tModelSpec\x12\x0f\n\x07version\x18\x01 \x01(\t\x1a\xc5\x01\n\x15\x45xtractiveContentSpec\x12#\n\x1bmax_extractive_answer_count\x18\x01 \x01(\x05\x12$\n\x1cmax_extractive_segment_count\x18\x02 \x01(\x05\x12\'\n\x1freturn_extractive_segment_score\x18\x03 \x01(\x08\x12\x1d\n\x15num_previous_segments\x18\x04 \x01(\x05\x12\x19\n\x11num_next_segments\x18\x05 \x01(\x05\x1a\x41\n\tChunkSpec\x12\x1b\n\x13num_previous_chunks\x18\x01 \x01(\x05\x12\x17\n\x0fnum_next_chunks\x18\x02 \x01(\x05\"Q\n\x10SearchResultMode\x12\"\n\x1eSEARCH_RESULT_MODE_UNSPECIFIED\x10\x00\x12\r\n\tDOCUMENTS\x10\x01\x12\n\n\x06\x43HUNKS\x10\x02\x1a\xb9\x01\n\x13SearchAsYouTypeSpec\x12_\n\tcondition\x18\x01 \x01(\x0e\x32L.google.cloud.discoveryengine.v1.SearchRequest.SearchAsYouTypeSpec.Condition\"A\n\tCondition\x12\x19\n\x15\x43ONDITION_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\x0b\n\x07\x45NABLED\x10\x02\x1aq\n\x0bSessionSpec\x12\x10\n\x08query_id\x18\x01 \x01(\t\x12,\n\x1fsearch_result_persistence_count\x18\x02 \x01(\x05H\x00\x88\x01\x01\x42\"\n _search_result_persistence_count\x1a\x45\n\x0bParamsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\x1a\x31\n\x0fUserLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xb9\x14\n\x0eSearchResponse\x12M\n\x07results\x18\x01 \x03(\x0b\x32<.google.cloud.discoveryengine.v1.SearchResponse.SearchResult\x12\x45\n\x06\x66\x61\x63\x65ts\x18\x02 \x03(\x0b\x32\x35.google.cloud.discoveryengine.v1.SearchResponse.Facet\x12\x12\n\ntotal_size\x18\x03 \x01(\x05\x12\x19\n\x11\x61ttribution_token\x18\x04 \x01(\t\x12\x14\n\x0credirect_uri\x18\x0c \x01(\t\x12\x17\n\x0fnext_page_token\x18\x05 \x01(\t\x12\x17\n\x0f\x63orrected_query\x18\x07 \x01(\t\x12H\n\x07summary\x18\t \x01(\x0b\x32\x37.google.cloud.discoveryengine.v1.SearchResponse.Summary\x12`\n\x14query_expansion_info\x18\x0e \x01(\x0b\x32\x42.google.cloud.discoveryengine.v1.SearchResponse.QueryExpansionInfo\x12Q\n\x0csession_info\x18\x13 \x01(\x0b\x32;.google.cloud.discoveryengine.v1.SearchResponse.SessionInfo\x1a\x8e\x01\n\x0cSearchResult\x12\n\n\x02id\x18\x01 \x01(\t\x12;\n\x08\x64ocument\x18\x02 \x01(\x0b\x32).google.cloud.discoveryengine.v1.Document\x12\x35\n\x05\x63hunk\x18\x12 \x01(\x0b\x32&.google.cloud.discoveryengine.v1.Chunk\x1a\xf9\x01\n\x05\x46\x61\x63\x65t\x12\x0b\n\x03key\x18\x01 \x01(\t\x12P\n\x06values\x18\x02 \x03(\x0b\x32@.google.cloud.discoveryengine.v1.SearchResponse.Facet.FacetValue\x12\x15\n\rdynamic_facet\x18\x03 \x01(\x08\x1az\n\nFacetValue\x12\x0f\n\x05value\x18\x01 \x01(\tH\x00\x12=\n\x08interval\x18\x02 \x01(\x0b\x32).google.cloud.discoveryengine.v1.IntervalH\x00\x12\r\n\x05\x63ount\x18\x03 \x01(\x03\x42\r\n\x0b\x66\x61\x63\x65t_value\x1a\x93\x0c\n\x07Summary\x12\x14\n\x0csummary_text\x18\x01 \x01(\t\x12m\n\x17summary_skipped_reasons\x18\x02 \x03(\x0e\x32L.google.cloud.discoveryengine.v1.SearchResponse.Summary.SummarySkippedReason\x12\x63\n\x11safety_attributes\x18\x03 \x01(\x0b\x32H.google.cloud.discoveryengine.v1.SearchResponse.Summary.SafetyAttributes\x12j\n\x15summary_with_metadata\x18\x04 \x01(\x0b\x32K.google.cloud.discoveryengine.v1.SearchResponse.Summary.SummaryWithMetadata\x1a\x36\n\x10SafetyAttributes\x12\x12\n\ncategories\x18\x01 \x03(\t\x12\x0e\n\x06scores\x18\x02 \x03(\x02\x1ag\n\x10\x43itationMetadata\x12S\n\tcitations\x18\x01 \x03(\x0b\x32@.google.cloud.discoveryengine.v1.SearchResponse.Summary.Citation\x1a\x8b\x01\n\x08\x43itation\x12\x13\n\x0bstart_index\x18\x01 \x01(\x03\x12\x11\n\tend_index\x18\x02 \x01(\x03\x12W\n\x07sources\x18\x03 \x03(\x0b\x32\x46.google.cloud.discoveryengine.v1.SearchResponse.Summary.CitationSource\x1a)\n\x0e\x43itationSource\x12\x17\n\x0freference_index\x18\x04 \x01(\x03\x1a\x8c\x02\n\tReference\x12\r\n\x05title\x18\x01 \x01(\t\x12\x41\n\x08\x64ocument\x18\x02 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'discoveryengine.googleapis.com/Document\x12\x0b\n\x03uri\x18\x03 \x01(\t\x12\x66\n\x0e\x63hunk_contents\x18\x04 \x03(\x0b\x32N.google.cloud.discoveryengine.v1.SearchResponse.Summary.Reference.ChunkContent\x1a\x38\n\x0c\x43hunkContent\x12\x0f\n\x07\x63ontent\x18\x01 \x01(\t\x12\x17\n\x0fpage_identifier\x18\x02 \x01(\t\x1a\xe2\x01\n\x13SummaryWithMetadata\x12\x0f\n\x07summary\x18\x01 \x01(\t\x12\x63\n\x11\x63itation_metadata\x18\x02 \x01(\x0b\x32H.google.cloud.discoveryengine.v1.SearchResponse.Summary.CitationMetadata\x12U\n\nreferences\x18\x03 \x03(\x0b\x32\x41.google.cloud.discoveryengine.v1.SearchResponse.Summary.Reference\"\xe3\x02\n\x14SummarySkippedReason\x12&\n\"SUMMARY_SKIPPED_REASON_UNSPECIFIED\x10\x00\x12\x1d\n\x19\x41\x44VERSARIAL_QUERY_IGNORED\x10\x01\x12%\n!NON_SUMMARY_SEEKING_QUERY_IGNORED\x10\x02\x12\x1f\n\x1bOUT_OF_DOMAIN_QUERY_IGNORED\x10\x03\x12\x1e\n\x1aPOTENTIAL_POLICY_VIOLATION\x10\x04\x12\x19\n\x15LLM_ADDON_NOT_ENABLED\x10\x05\x12\x17\n\x13NO_RELEVANT_CONTENT\x10\x06\x12\x1f\n\x1bJAIL_BREAKING_QUERY_IGNORED\x10\x07\x12\x1d\n\x19\x43USTOMER_POLICY_VIOLATION\x10\x08\x12(\n$NON_SUMMARY_SEEKING_QUERY_IGNORED_V2\x10\t\x1aI\n\x12QueryExpansionInfo\x12\x16\n\x0e\x65xpanded_query\x18\x01 \x01(\x08\x12\x1b\n\x13pinned_result_count\x18\x02 \x01(\x03\x1a-\n\x0bSessionInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x10\n\x08query_id\x18\x02 \x01(\t2\xf5\x03\n\rSearchService\x12\x8f\x03\n\x06Search\x12..google.cloud.discoveryengine.v1.SearchRequest\x1a/.google.cloud.discoveryengine.v1.SearchResponse\"\xa3\x02\x82\xd3\xe4\x93\x02\x9c\x02\"P/v1/{serving_config=projects/*/locations/*/dataStores/*/servingConfigs/*}:search:\x01*Zc\"^/v1/{serving_config=projects/*/locations/*/collections/*/dataStores/*/servingConfigs/*}:search:\x01*Z`\"[/v1/{serving_config=projects/*/locations/*/collections/*/engines/*/servingConfigs/*}:search:\x01*\x1aR\xca\x41\x1e\x64iscoveryengine.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\x85\x02\n#com.google.cloud.discoveryengine.v1B\x12SearchServiceProtoP\x01ZMcloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb\xa2\x02\x0f\x44ISCOVERYENGINE\xaa\x02\x1fGoogle.Cloud.DiscoveryEngine.V1\xca\x02\x1fGoogle\\Cloud\\DiscoveryEngine\\V1\xea\x02\"Google::Cloud::DiscoveryEngine::V1b\x06proto3" +descriptor_data = "\n4google/cloud/discoveryengine/v1/search_service.proto\x12\x1fgoogle.cloud.discoveryengine.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a+google/cloud/discoveryengine/v1/chunk.proto\x1a,google/cloud/discoveryengine/v1/common.proto\x1a.google/cloud/discoveryengine/v1/document.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xdf)\n\rSearchRequest\x12L\n\x0eserving_config\x18\x01 \x01(\tB4\xe0\x41\x02\xfa\x41.\n,discoveryengine.googleapis.com/ServingConfig\x12:\n\x06\x62ranch\x18\x02 \x01(\tB*\xfa\x41\'\n%discoveryengine.googleapis.com/Branch\x12\r\n\x05query\x18\x03 \x01(\t\x12N\n\x0bimage_query\x18\x13 \x01(\x0b\x32\x39.google.cloud.discoveryengine.v1.SearchRequest.ImageQuery\x12\x11\n\tpage_size\x18\x04 \x01(\x05\x12\x12\n\npage_token\x18\x05 \x01(\t\x12\x0e\n\x06offset\x18\x06 \x01(\x05\x12\x19\n\x11one_box_page_size\x18/ \x01(\x05\x12V\n\x10\x64\x61ta_store_specs\x18 \x03(\x0b\x32<.google.cloud.discoveryengine.v1.SearchRequest.DataStoreSpec\x12\x0e\n\x06\x66ilter\x18\x07 \x01(\t\x12\x18\n\x10\x63\x61nonical_filter\x18\x1d \x01(\t\x12\x10\n\x08order_by\x18\x08 \x01(\t\x12<\n\tuser_info\x18\x15 \x01(\x0b\x32).google.cloud.discoveryengine.v1.UserInfo\x12\x15\n\rlanguage_code\x18# \x01(\t\x12M\n\x0b\x66\x61\x63\x65t_specs\x18\t \x03(\x0b\x32\x38.google.cloud.discoveryengine.v1.SearchRequest.FacetSpec\x12L\n\nboost_spec\x18\n \x01(\x0b\x32\x38.google.cloud.discoveryengine.v1.SearchRequest.BoostSpec\x12J\n\x06params\x18\x0b \x03(\x0b\x32:.google.cloud.discoveryengine.v1.SearchRequest.ParamsEntry\x12_\n\x14query_expansion_spec\x18\r \x01(\x0b\x32\x41.google.cloud.discoveryengine.v1.SearchRequest.QueryExpansionSpec\x12\x61\n\x15spell_correction_spec\x18\x0e \x01(\x0b\x32\x42.google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec\x12\x16\n\x0euser_pseudo_id\x18\x0f \x01(\t\x12]\n\x13\x63ontent_search_spec\x18\x18 \x01(\x0b\x32@.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec\x12\x13\n\x0bsafe_search\x18\x14 \x01(\x08\x12S\n\x0buser_labels\x18\x16 \x03(\x0b\x32>.google.cloud.discoveryengine.v1.SearchRequest.UserLabelsEntry\x12\x63\n\x17search_as_you_type_spec\x18\x1f \x01(\x0b\x32\x42.google.cloud.discoveryengine.v1.SearchRequest.SearchAsYouTypeSpec\x12<\n\x07session\x18) \x01(\tB+\xfa\x41(\n&discoveryengine.googleapis.com/Session\x12P\n\x0csession_spec\x18* \x01(\x0b\x32:.google.cloud.discoveryengine.v1.SearchRequest.SessionSpec\x1a,\n\nImageQuery\x12\x15\n\x0bimage_bytes\x18\x01 \x01(\tH\x00\x42\x07\n\x05image\x1aj\n\rDataStoreSpec\x12\x44\n\ndata_store\x18\x01 \x01(\tB0\xe0\x41\x02\xfa\x41*\n(discoveryengine.googleapis.com/DataStore\x12\x13\n\x06\x66ilter\x18\x05 \x01(\tB\x03\xe0\x41\x01\x1a\xfc\x02\n\tFacetSpec\x12Y\n\tfacet_key\x18\x01 \x01(\x0b\x32\x41.google.cloud.discoveryengine.v1.SearchRequest.FacetSpec.FacetKeyB\x03\xe0\x41\x02\x12\r\n\x05limit\x18\x02 \x01(\x05\x12\x1c\n\x14\x65xcluded_filter_keys\x18\x03 \x03(\t\x12\x1f\n\x17\x65nable_dynamic_position\x18\x04 \x01(\x08\x1a\xc5\x01\n\x08\x46\x61\x63\x65tKey\x12\x10\n\x03key\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12<\n\tintervals\x18\x02 \x03(\x0b\x32).google.cloud.discoveryengine.v1.Interval\x12\x19\n\x11restricted_values\x18\x03 \x03(\t\x12\x10\n\x08prefixes\x18\x04 \x03(\t\x12\x10\n\x08\x63ontains\x18\x05 \x03(\t\x12\x18\n\x10\x63\x61se_insensitive\x18\x06 \x01(\x08\x12\x10\n\x08order_by\x18\x07 \x01(\t\x1a\xbc\x07\n\tBoostSpec\x12j\n\x15\x63ondition_boost_specs\x18\x01 \x03(\x0b\x32K.google.cloud.discoveryengine.v1.SearchRequest.BoostSpec.ConditionBoostSpec\x1a\xc2\x06\n\x12\x43onditionBoostSpec\x12\x11\n\tcondition\x18\x01 \x01(\t\x12\r\n\x05\x62oost\x18\x02 \x01(\x02\x12x\n\x12\x62oost_control_spec\x18\x03 \x01(\x0b\x32\\.google.cloud.discoveryengine.v1.SearchRequest.BoostSpec.ConditionBoostSpec.BoostControlSpec\x1a\x8f\x05\n\x10\x42oostControlSpec\x12\x12\n\nfield_name\x18\x01 \x01(\t\x12\x82\x01\n\x0e\x61ttribute_type\x18\x02 \x01(\x0e\x32j.google.cloud.discoveryengine.v1.SearchRequest.BoostSpec.ConditionBoostSpec.BoostControlSpec.AttributeType\x12\x8a\x01\n\x12interpolation_type\x18\x03 \x01(\x0e\x32n.google.cloud.discoveryengine.v1.SearchRequest.BoostSpec.ConditionBoostSpec.BoostControlSpec.InterpolationType\x12\x81\x01\n\x0e\x63ontrol_points\x18\x04 \x03(\x0b\x32i.google.cloud.discoveryengine.v1.SearchRequest.BoostSpec.ConditionBoostSpec.BoostControlSpec.ControlPoint\x1a=\n\x0c\x43ontrolPoint\x12\x17\n\x0f\x61ttribute_value\x18\x01 \x01(\t\x12\x14\n\x0c\x62oost_amount\x18\x02 \x01(\x02\"M\n\rAttributeType\x12\x1e\n\x1a\x41TTRIBUTE_TYPE_UNSPECIFIED\x10\x00\x12\r\n\tNUMERICAL\x10\x01\x12\r\n\tFRESHNESS\x10\x02\"C\n\x11InterpolationType\x12\"\n\x1eINTERPOLATION_TYPE_UNSPECIFIED\x10\x00\x12\n\n\x06LINEAR\x10\x01\x1a\xd4\x01\n\x12QueryExpansionSpec\x12^\n\tcondition\x18\x01 \x01(\x0e\x32K.google.cloud.discoveryengine.v1.SearchRequest.QueryExpansionSpec.Condition\x12\x1e\n\x16pin_unexpanded_results\x18\x02 \x01(\x08\">\n\tCondition\x12\x19\n\x15\x43ONDITION_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\x08\n\x04\x41UTO\x10\x02\x1a\xa9\x01\n\x13SpellCorrectionSpec\x12U\n\x04mode\x18\x01 \x01(\x0e\x32G.google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec.Mode\";\n\x04Mode\x12\x14\n\x10MODE_UNSPECIFIED\x10\x00\x12\x13\n\x0fSUGGESTION_ONLY\x10\x01\x12\x08\n\x04\x41UTO\x10\x02\x1a\xa2\x0c\n\x11\x43ontentSearchSpec\x12\x62\n\x0csnippet_spec\x18\x01 \x01(\x0b\x32L.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SnippetSpec\x12\x62\n\x0csummary_spec\x18\x02 \x01(\x0b\x32L.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SummarySpec\x12w\n\x17\x65xtractive_content_spec\x18\x03 \x01(\x0b\x32V.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.ExtractiveContentSpec\x12m\n\x12search_result_mode\x18\x04 \x01(\x0e\x32Q.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SearchResultMode\x12^\n\nchunk_spec\x18\x05 \x01(\x0b\x32J.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.ChunkSpec\x1a`\n\x0bSnippetSpec\x12\x1d\n\x11max_snippet_count\x18\x01 \x01(\x05\x42\x02\x18\x01\x12\x1a\n\x0ereference_only\x18\x02 \x01(\x08\x42\x02\x18\x01\x12\x16\n\x0ereturn_snippet\x18\x03 \x01(\x08\x1a\xbc\x04\n\x0bSummarySpec\x12\x1c\n\x14summary_result_count\x18\x01 \x01(\x05\x12\x19\n\x11include_citations\x18\x02 \x01(\x08\x12 \n\x18ignore_adversarial_query\x18\x03 \x01(\x08\x12(\n ignore_non_summary_seeking_query\x18\x04 \x01(\x08\x12#\n\x1bignore_low_relevant_content\x18\t \x01(\x08\x12\'\n\x1aignore_jail_breaking_query\x18\n \x01(\x08\x42\x03\xe0\x41\x01\x12w\n\x11model_prompt_spec\x18\x05 \x01(\x0b\x32\\.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SummarySpec.ModelPromptSpec\x12\x15\n\rlanguage_code\x18\x06 \x01(\t\x12j\n\nmodel_spec\x18\x07 \x01(\x0b\x32V.google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SummarySpec.ModelSpec\x12\x1b\n\x13use_semantic_chunks\x18\x08 \x01(\x08\x1a#\n\x0fModelPromptSpec\x12\x10\n\x08preamble\x18\x01 \x01(\t\x1a\x1c\n\tModelSpec\x12\x0f\n\x07version\x18\x01 \x01(\t\x1a\xc5\x01\n\x15\x45xtractiveContentSpec\x12#\n\x1bmax_extractive_answer_count\x18\x01 \x01(\x05\x12$\n\x1cmax_extractive_segment_count\x18\x02 \x01(\x05\x12\'\n\x1freturn_extractive_segment_score\x18\x03 \x01(\x08\x12\x1d\n\x15num_previous_segments\x18\x04 \x01(\x05\x12\x19\n\x11num_next_segments\x18\x05 \x01(\x05\x1a\x41\n\tChunkSpec\x12\x1b\n\x13num_previous_chunks\x18\x01 \x01(\x05\x12\x17\n\x0fnum_next_chunks\x18\x02 \x01(\x05\"Q\n\x10SearchResultMode\x12\"\n\x1eSEARCH_RESULT_MODE_UNSPECIFIED\x10\x00\x12\r\n\tDOCUMENTS\x10\x01\x12\n\n\x06\x43HUNKS\x10\x02\x1a\xb9\x01\n\x13SearchAsYouTypeSpec\x12_\n\tcondition\x18\x01 \x01(\x0e\x32L.google.cloud.discoveryengine.v1.SearchRequest.SearchAsYouTypeSpec.Condition\"A\n\tCondition\x12\x19\n\x15\x43ONDITION_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\x0b\n\x07\x45NABLED\x10\x02\x1aq\n\x0bSessionSpec\x12\x10\n\x08query_id\x18\x01 \x01(\t\x12,\n\x1fsearch_result_persistence_count\x18\x02 \x01(\x05H\x00\x88\x01\x01\x42\"\n _search_result_persistence_count\x1a\x45\n\x0bParamsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\x1a\x31\n\x0fUserLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xb9\x14\n\x0eSearchResponse\x12M\n\x07results\x18\x01 \x03(\x0b\x32<.google.cloud.discoveryengine.v1.SearchResponse.SearchResult\x12\x45\n\x06\x66\x61\x63\x65ts\x18\x02 \x03(\x0b\x32\x35.google.cloud.discoveryengine.v1.SearchResponse.Facet\x12\x12\n\ntotal_size\x18\x03 \x01(\x05\x12\x19\n\x11\x61ttribution_token\x18\x04 \x01(\t\x12\x14\n\x0credirect_uri\x18\x0c \x01(\t\x12\x17\n\x0fnext_page_token\x18\x05 \x01(\t\x12\x17\n\x0f\x63orrected_query\x18\x07 \x01(\t\x12H\n\x07summary\x18\t \x01(\x0b\x32\x37.google.cloud.discoveryengine.v1.SearchResponse.Summary\x12`\n\x14query_expansion_info\x18\x0e \x01(\x0b\x32\x42.google.cloud.discoveryengine.v1.SearchResponse.QueryExpansionInfo\x12Q\n\x0csession_info\x18\x13 \x01(\x0b\x32;.google.cloud.discoveryengine.v1.SearchResponse.SessionInfo\x1a\x8e\x01\n\x0cSearchResult\x12\n\n\x02id\x18\x01 \x01(\t\x12;\n\x08\x64ocument\x18\x02 \x01(\x0b\x32).google.cloud.discoveryengine.v1.Document\x12\x35\n\x05\x63hunk\x18\x12 \x01(\x0b\x32&.google.cloud.discoveryengine.v1.Chunk\x1a\xf9\x01\n\x05\x46\x61\x63\x65t\x12\x0b\n\x03key\x18\x01 \x01(\t\x12P\n\x06values\x18\x02 \x03(\x0b\x32@.google.cloud.discoveryengine.v1.SearchResponse.Facet.FacetValue\x12\x15\n\rdynamic_facet\x18\x03 \x01(\x08\x1az\n\nFacetValue\x12\x0f\n\x05value\x18\x01 \x01(\tH\x00\x12=\n\x08interval\x18\x02 \x01(\x0b\x32).google.cloud.discoveryengine.v1.IntervalH\x00\x12\r\n\x05\x63ount\x18\x03 \x01(\x03\x42\r\n\x0b\x66\x61\x63\x65t_value\x1a\x93\x0c\n\x07Summary\x12\x14\n\x0csummary_text\x18\x01 \x01(\t\x12m\n\x17summary_skipped_reasons\x18\x02 \x03(\x0e\x32L.google.cloud.discoveryengine.v1.SearchResponse.Summary.SummarySkippedReason\x12\x63\n\x11safety_attributes\x18\x03 \x01(\x0b\x32H.google.cloud.discoveryengine.v1.SearchResponse.Summary.SafetyAttributes\x12j\n\x15summary_with_metadata\x18\x04 \x01(\x0b\x32K.google.cloud.discoveryengine.v1.SearchResponse.Summary.SummaryWithMetadata\x1a\x36\n\x10SafetyAttributes\x12\x12\n\ncategories\x18\x01 \x03(\t\x12\x0e\n\x06scores\x18\x02 \x03(\x02\x1ag\n\x10\x43itationMetadata\x12S\n\tcitations\x18\x01 \x03(\x0b\x32@.google.cloud.discoveryengine.v1.SearchResponse.Summary.Citation\x1a\x8b\x01\n\x08\x43itation\x12\x13\n\x0bstart_index\x18\x01 \x01(\x03\x12\x11\n\tend_index\x18\x02 \x01(\x03\x12W\n\x07sources\x18\x03 \x03(\x0b\x32\x46.google.cloud.discoveryengine.v1.SearchResponse.Summary.CitationSource\x1a)\n\x0e\x43itationSource\x12\x17\n\x0freference_index\x18\x04 \x01(\x03\x1a\x8c\x02\n\tReference\x12\r\n\x05title\x18\x01 \x01(\t\x12\x41\n\x08\x64ocument\x18\x02 \x01(\tB/\xe0\x41\x02\xfa\x41)\n\'discoveryengine.googleapis.com/Document\x12\x0b\n\x03uri\x18\x03 \x01(\t\x12\x66\n\x0e\x63hunk_contents\x18\x04 \x03(\x0b\x32N.google.cloud.discoveryengine.v1.SearchResponse.Summary.Reference.ChunkContent\x1a\x38\n\x0c\x43hunkContent\x12\x0f\n\x07\x63ontent\x18\x01 \x01(\t\x12\x17\n\x0fpage_identifier\x18\x02 \x01(\t\x1a\xe2\x01\n\x13SummaryWithMetadata\x12\x0f\n\x07summary\x18\x01 \x01(\t\x12\x63\n\x11\x63itation_metadata\x18\x02 \x01(\x0b\x32H.google.cloud.discoveryengine.v1.SearchResponse.Summary.CitationMetadata\x12U\n\nreferences\x18\x03 \x03(\x0b\x32\x41.google.cloud.discoveryengine.v1.SearchResponse.Summary.Reference\"\xe3\x02\n\x14SummarySkippedReason\x12&\n\"SUMMARY_SKIPPED_REASON_UNSPECIFIED\x10\x00\x12\x1d\n\x19\x41\x44VERSARIAL_QUERY_IGNORED\x10\x01\x12%\n!NON_SUMMARY_SEEKING_QUERY_IGNORED\x10\x02\x12\x1f\n\x1bOUT_OF_DOMAIN_QUERY_IGNORED\x10\x03\x12\x1e\n\x1aPOTENTIAL_POLICY_VIOLATION\x10\x04\x12\x19\n\x15LLM_ADDON_NOT_ENABLED\x10\x05\x12\x17\n\x13NO_RELEVANT_CONTENT\x10\x06\x12\x1f\n\x1bJAIL_BREAKING_QUERY_IGNORED\x10\x07\x12\x1d\n\x19\x43USTOMER_POLICY_VIOLATION\x10\x08\x12(\n$NON_SUMMARY_SEEKING_QUERY_IGNORED_V2\x10\t\x1aI\n\x12QueryExpansionInfo\x12\x16\n\x0e\x65xpanded_query\x18\x01 \x01(\x08\x12\x1b\n\x13pinned_result_count\x18\x02 \x01(\x03\x1a-\n\x0bSessionInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x10\n\x08query_id\x18\x02 \x01(\t2\x97\x07\n\rSearchService\x12\x8f\x03\n\x06Search\x12..google.cloud.discoveryengine.v1.SearchRequest\x1a/.google.cloud.discoveryengine.v1.SearchResponse\"\xa3\x02\x82\xd3\xe4\x93\x02\x9c\x02\"P/v1/{serving_config=projects/*/locations/*/dataStores/*/servingConfigs/*}:search:\x01*Zc\"^/v1/{serving_config=projects/*/locations/*/collections/*/dataStores/*/servingConfigs/*}:search:\x01*Z`\"[/v1/{serving_config=projects/*/locations/*/collections/*/engines/*/servingConfigs/*}:search:\x01*\x12\x9f\x03\n\nSearchLite\x12..google.cloud.discoveryengine.v1.SearchRequest\x1a/.google.cloud.discoveryengine.v1.SearchResponse\"\xaf\x02\x82\xd3\xe4\x93\x02\xa8\x02\"T/v1/{serving_config=projects/*/locations/*/dataStores/*/servingConfigs/*}:searchLite:\x01*Zg\"b/v1/{serving_config=projects/*/locations/*/collections/*/dataStores/*/servingConfigs/*}:searchLite:\x01*Zd\"_/v1/{serving_config=projects/*/locations/*/collections/*/engines/*/servingConfigs/*}:searchLite:\x01*\x1aR\xca\x41\x1e\x64iscoveryengine.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\x85\x02\n#com.google.cloud.discoveryengine.v1B\x12SearchServiceProtoP\x01ZMcloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb\xa2\x02\x0f\x44ISCOVERYENGINE\xaa\x02\x1fGoogle.Cloud.DiscoveryEngine.V1\xca\x02\x1fGoogle\\Cloud\\DiscoveryEngine\\V1\xea\x02\"Google::Cloud::DiscoveryEngine::V1b\x06proto3" pool = Google::Protobuf::DescriptorPool.generated_pool diff --git a/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/search_service_services_pb.rb b/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/search_service_services_pb.rb index 4e5623811049..1f889c7e58f8 100644 --- a/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/search_service_services_pb.rb +++ b/google-cloud-discovery_engine-v1/lib/google/cloud/discoveryengine/v1/search_service_services_pb.rb @@ -35,6 +35,20 @@ class Service # Performs a search. rpc :Search, ::Google::Cloud::DiscoveryEngine::V1::SearchRequest, ::Google::Cloud::DiscoveryEngine::V1::SearchResponse + # Performs a search. Similar to the + # [SearchService.Search][google.cloud.discoveryengine.v1.SearchService.Search] + # method, but a lite version that allows API key for authentication, where + # OAuth and IAM checks are not required. + # + # Only public website search is supported by this method. If data stores and + # engines not associated with public website search are specified, a + # `FAILED_PRECONDITION` error is returned. + # + # This method can be used for easy onboarding without having to implement an + # authentication backend. However, it is strongly recommended to use + # [SearchService.Search][google.cloud.discoveryengine.v1.SearchService.Search] + # instead with required OAuth and IAM checks to provide better data security. + rpc :SearchLite, ::Google::Cloud::DiscoveryEngine::V1::SearchRequest, ::Google::Cloud::DiscoveryEngine::V1::SearchResponse end Stub = Service.rpc_stub_class diff --git a/google-cloud-discovery_engine-v1/proto_docs/google/api/client.rb b/google-cloud-discovery_engine-v1/proto_docs/google/api/client.rb index 55644af5902d..c8f20732db7f 100644 --- a/google-cloud-discovery_engine-v1/proto_docs/google/api/client.rb +++ b/google-cloud-discovery_engine-v1/proto_docs/google/api/client.rb @@ -28,6 +28,9 @@ module Api # @!attribute [rw] destinations # @return [::Array<::Google::Api::ClientLibraryDestination>] # The destination where API teams want this client library to be published. + # @!attribute [rw] selective_gapic_generation + # @return [::Google::Api::SelectiveGapicGeneration] + # Configuration for which RPCs should be generated in the GAPIC client. class CommonLanguageSettings include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods @@ -375,6 +378,17 @@ class LongRunning end end + # This message is used to configure the generation of a subset of the RPCs in + # a service for client libraries. + # @!attribute [rw] methods + # @return [::Array<::String>] + # An allowlist of the fully qualified names of RPCs that should be included + # on public client surfaces. + class SelectiveGapicGeneration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + # The organization for which the client libraries are being published. # Affects the url where generated docs are published, etc. module ClientLibraryOrganization diff --git a/google-cloud-discovery_engine-v1/proto_docs/google/cloud/discoveryengine/v1/answer.rb b/google-cloud-discovery_engine-v1/proto_docs/google/cloud/discoveryengine/v1/answer.rb index 787498880fbe..2de006ba767b 100644 --- a/google-cloud-discovery_engine-v1/proto_docs/google/cloud/discoveryengine/v1/answer.rb +++ b/google-cloud-discovery_engine-v1/proto_docs/google/cloud/discoveryengine/v1/answer.rb @@ -422,6 +422,12 @@ module AnswerSkippedReason # # Google skips the answer if the query doesn't have clear intent. NON_ANSWER_SEEKING_QUERY_IGNORED_V2 = 8 + + # The low-grounded answer case. + # + # Google skips the answer if a well grounded answer was unable to be + # generated. + LOW_GROUNDED_ANSWER = 9 end end end diff --git a/google-cloud-discovery_engine-v1/proto_docs/google/cloud/discoveryengine/v1/control.rb b/google-cloud-discovery_engine-v1/proto_docs/google/cloud/discoveryengine/v1/control.rb index ba50feea649d..d9c2161d2d13 100644 --- a/google-cloud-discovery_engine-v1/proto_docs/google/cloud/discoveryengine/v1/control.rb +++ b/google-cloud-discovery_engine-v1/proto_docs/google/cloud/discoveryengine/v1/control.rb @@ -26,6 +26,9 @@ module V1 # @return [::Array<::Google::Cloud::DiscoveryEngine::V1::Condition::QueryTerm>] # Search only # A list of terms to match the query on. + # Cannot be set when + # {::Google::Cloud::DiscoveryEngine::V1::Condition#query_regex Condition.query_regex} + # is set. # # Maximum of 10 query terms. # @!attribute [rw] active_time_range @@ -33,6 +36,12 @@ module V1 # Range of time(s) specifying when condition is active. # # Maximum of 10 time ranges. + # @!attribute [rw] query_regex + # @return [::String] + # Optional. Query regex to match the whole search query. + # Cannot be set when + # {::Google::Cloud::DiscoveryEngine::V1::Condition#query_terms Condition.query_terms} + # is set. This is currently supporting promotion use case. class Condition include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods diff --git a/google-cloud-discovery_engine-v1/proto_docs/google/cloud/discoveryengine/v1/document_service.rb b/google-cloud-discovery_engine-v1/proto_docs/google/cloud/discoveryengine/v1/document_service.rb index 08358d28490d..e074104c764b 100644 --- a/google-cloud-discovery_engine-v1/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +++ b/google-cloud-discovery_engine-v1/proto_docs/google/cloud/discoveryengine/v1/document_service.rb @@ -274,7 +274,7 @@ class DocumentMetadata # {::Google::Cloud::DiscoveryEngine::V1::Document Document}. # @!attribute [rw] fhir_resource # @return [::String] - # Required. Format: + # Format: # projects/\\{project}/locations/\\{location}/datasets/\\{dataset}/fhirStores/\\{fhir_store}/fhir/\\{resource_type}/\\{fhir_resource_id} class MatcherValue include ::Google::Protobuf::MessageExts diff --git a/google-cloud-discovery_engine-v1/snippets/search_service/search_lite.rb b/google-cloud-discovery_engine-v1/snippets/search_service/search_lite.rb new file mode 100644 index 000000000000..133513071314 --- /dev/null +++ b/google-cloud-discovery_engine-v1/snippets/search_service/search_lite.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2024 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. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START discoveryengine_v1_generated_SearchService_SearchLite_sync] +require "google/cloud/discovery_engine/v1" + +## +# Snippet for the search_lite call in the SearchService service +# +# This snippet 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 as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search_lite. +# +def search_lite + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::DiscoveryEngine::V1::SearchService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::DiscoveryEngine::V1::SearchRequest.new + + # Call the search_lite method. + result = client.search_lite request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult. + p item + end +end +# [END discoveryengine_v1_generated_SearchService_SearchLite_sync] diff --git a/google-cloud-discovery_engine-v1/snippets/snippet_metadata_google.cloud.discoveryengine.v1.json b/google-cloud-discovery_engine-v1/snippets/snippet_metadata_google.cloud.discoveryengine.v1.json index 580a8154e459..5945e687c952 100644 --- a/google-cloud-discovery_engine-v1/snippets/snippet_metadata_google.cloud.discoveryengine.v1.json +++ b/google-cloud-discovery_engine-v1/snippets/snippet_metadata_google.cloud.discoveryengine.v1.json @@ -451,6 +451,46 @@ } ] }, + { + "region_tag": "discoveryengine_v1_generated_SearchService_SearchLite_sync", + "title": "Snippet for the search_lite call in the SearchService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search_lite.", + "file": "search_service/search_lite.rb", + "language": "RUBY", + "client_method": { + "short_name": "search_lite", + "full_name": "::Google::Cloud::DiscoveryEngine::V1::SearchService::Client#search_lite", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::DiscoveryEngine::V1::SearchRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::DiscoveryEngine::V1::SearchResponse", + "client": { + "short_name": "SearchService::Client", + "full_name": "::Google::Cloud::DiscoveryEngine::V1::SearchService::Client" + }, + "method": { + "short_name": "SearchLite", + "full_name": "google.cloud.discoveryengine.v1.SearchService.SearchLite", + "service": { + "short_name": "SearchService", + "full_name": "google.cloud.discoveryengine.v1.SearchService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, { "region_tag": "discoveryengine_v1_generated_ConversationalSearchService_ConverseConversation_sync", "title": "Snippet for the converse_conversation call in the ConversationalSearchService service", diff --git a/google-cloud-discovery_engine-v1/test/google/cloud/discovery_engine/v1/search_service_rest_test.rb b/google-cloud-discovery_engine-v1/test/google/cloud/discovery_engine/v1/search_service_rest_test.rb index 6c53c9979a13..66a4e2f58668 100644 --- a/google-cloud-discovery_engine-v1/test/google/cloud/discovery_engine/v1/search_service_rest_test.rb +++ b/google-cloud-discovery_engine-v1/test/google/cloud/discovery_engine/v1/search_service_rest_test.rb @@ -149,6 +149,85 @@ def test_search end end + def test_search_lite + # Create test objects. + client_result = ::Google::Cloud::DiscoveryEngine::V1::SearchResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + serving_config = "hello world" + branch = "hello world" + query = "hello world" + image_query = {} + page_size = 42 + page_token = "hello world" + offset = 42 + one_box_page_size = 42 + data_store_specs = [{}] + filter = "hello world" + canonical_filter = "hello world" + order_by = "hello world" + user_info = {} + language_code = "hello world" + facet_specs = [{}] + boost_spec = {} + params = {} + query_expansion_spec = {} + spell_correction_spec = {} + user_pseudo_id = "hello world" + content_search_spec = {} + safe_search = true + user_labels = {} + search_as_you_type_spec = {} + session = "hello world" + session_spec = {} + + search_lite_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::ServiceStub.stub :transcode_search_lite_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, search_lite_client_stub do + # Create client + client = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.search_lite({ serving_config: serving_config, branch: branch, query: query, image_query: image_query, page_size: page_size, page_token: page_token, offset: offset, one_box_page_size: one_box_page_size, data_store_specs: data_store_specs, filter: filter, canonical_filter: canonical_filter, order_by: order_by, user_info: user_info, language_code: language_code, facet_specs: facet_specs, boost_spec: boost_spec, params: params, query_expansion_spec: query_expansion_spec, spell_correction_spec: spell_correction_spec, user_pseudo_id: user_pseudo_id, content_search_spec: content_search_spec, safe_search: safe_search, user_labels: user_labels, search_as_you_type_spec: search_as_you_type_spec, session: session, session_spec: session_spec }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.search_lite serving_config: serving_config, branch: branch, query: query, image_query: image_query, page_size: page_size, page_token: page_token, offset: offset, one_box_page_size: one_box_page_size, data_store_specs: data_store_specs, filter: filter, canonical_filter: canonical_filter, order_by: order_by, user_info: user_info, language_code: language_code, facet_specs: facet_specs, boost_spec: boost_spec, params: params, query_expansion_spec: query_expansion_spec, spell_correction_spec: spell_correction_spec, user_pseudo_id: user_pseudo_id, content_search_spec: content_search_spec, safe_search: safe_search, user_labels: user_labels, search_as_you_type_spec: search_as_you_type_spec, session: session, session_spec: session_spec do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.search_lite ::Google::Cloud::DiscoveryEngine::V1::SearchRequest.new(serving_config: serving_config, branch: branch, query: query, image_query: image_query, page_size: page_size, page_token: page_token, offset: offset, one_box_page_size: one_box_page_size, data_store_specs: data_store_specs, filter: filter, canonical_filter: canonical_filter, order_by: order_by, user_info: user_info, language_code: language_code, facet_specs: facet_specs, boost_spec: boost_spec, params: params, query_expansion_spec: query_expansion_spec, spell_correction_spec: spell_correction_spec, user_pseudo_id: user_pseudo_id, content_search_spec: content_search_spec, safe_search: safe_search, user_labels: user_labels, search_as_you_type_spec: search_as_you_type_spec, session: session, session_spec: session_spec) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.search_lite({ serving_config: serving_config, branch: branch, query: query, image_query: image_query, page_size: page_size, page_token: page_token, offset: offset, one_box_page_size: one_box_page_size, data_store_specs: data_store_specs, filter: filter, canonical_filter: canonical_filter, order_by: order_by, user_info: user_info, language_code: language_code, facet_specs: facet_specs, boost_spec: boost_spec, params: params, query_expansion_spec: query_expansion_spec, spell_correction_spec: spell_correction_spec, user_pseudo_id: user_pseudo_id, content_search_spec: content_search_spec, safe_search: safe_search, user_labels: user_labels, search_as_you_type_spec: search_as_you_type_spec, session: session, session_spec: session_spec }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.search_lite(::Google::Cloud::DiscoveryEngine::V1::SearchRequest.new(serving_config: serving_config, branch: branch, query: query, image_query: image_query, page_size: page_size, page_token: page_token, offset: offset, one_box_page_size: one_box_page_size, data_store_specs: data_store_specs, filter: filter, canonical_filter: canonical_filter, order_by: order_by, user_info: user_info, language_code: language_code, facet_specs: facet_specs, boost_spec: boost_spec, params: params, query_expansion_spec: query_expansion_spec, spell_correction_spec: spell_correction_spec, user_pseudo_id: user_pseudo_id, content_search_spec: content_search_spec, safe_search: safe_search, user_labels: user_labels, search_as_you_type_spec: search_as_you_type_spec, session: session, session_spec: session_spec), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, search_lite_client_stub.call_count + end + end + end + def test_configure credentials_token = :dummy_value diff --git a/google-cloud-discovery_engine-v1/test/google/cloud/discovery_engine/v1/search_service_test.rb b/google-cloud-discovery_engine-v1/test/google/cloud/discovery_engine/v1/search_service_test.rb index bd4690915d8c..65e385607ccb 100644 --- a/google-cloud-discovery_engine-v1/test/google/cloud/discovery_engine/v1/search_service_test.rb +++ b/google-cloud-discovery_engine-v1/test/google/cloud/discovery_engine/v1/search_service_test.rb @@ -168,6 +168,119 @@ def test_search end end + def test_search_lite + # Create GRPC objects. + grpc_response = ::Google::Cloud::DiscoveryEngine::V1::SearchResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + serving_config = "hello world" + branch = "hello world" + query = "hello world" + image_query = {} + page_size = 42 + page_token = "hello world" + offset = 42 + one_box_page_size = 42 + data_store_specs = [{}] + filter = "hello world" + canonical_filter = "hello world" + order_by = "hello world" + user_info = {} + language_code = "hello world" + facet_specs = [{}] + boost_spec = {} + params = {} + query_expansion_spec = {} + spell_correction_spec = {} + user_pseudo_id = "hello world" + content_search_spec = {} + safe_search = true + user_labels = {} + search_as_you_type_spec = {} + session = "hello world" + session_spec = {} + + search_lite_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :search_lite, name + assert_kind_of ::Google::Cloud::DiscoveryEngine::V1::SearchRequest, request + assert_equal "hello world", request["serving_config"] + assert_equal "hello world", request["branch"] + assert_equal "hello world", request["query"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ImageQuery), request["image_query"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal 42, request["offset"] + assert_equal 42, request["one_box_page_size"] + assert_kind_of ::Google::Cloud::DiscoveryEngine::V1::SearchRequest::DataStoreSpec, request["data_store_specs"].first + assert_equal "hello world", request["filter"] + assert_equal "hello world", request["canonical_filter"] + assert_equal "hello world", request["order_by"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::DiscoveryEngine::V1::UserInfo), request["user_info"] + assert_equal "hello world", request["language_code"] + assert_kind_of ::Google::Cloud::DiscoveryEngine::V1::SearchRequest::FacetSpec, request["facet_specs"].first + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::DiscoveryEngine::V1::SearchRequest::BoostSpec), request["boost_spec"] + assert_equal({}, request["params"].to_h) + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::DiscoveryEngine::V1::SearchRequest::QueryExpansionSpec), request["query_expansion_spec"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SpellCorrectionSpec), request["spell_correction_spec"] + assert_equal "hello world", request["user_pseudo_id"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::DiscoveryEngine::V1::SearchRequest::ContentSearchSpec), request["content_search_spec"] + assert_equal true, request["safe_search"] + assert_equal({}, request["user_labels"].to_h) + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SearchAsYouTypeSpec), request["search_as_you_type_spec"] + assert_equal "hello world", request["session"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::DiscoveryEngine::V1::SearchRequest::SessionSpec), request["session_spec"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, search_lite_client_stub do + # Create client + client = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.search_lite({ serving_config: serving_config, branch: branch, query: query, image_query: image_query, page_size: page_size, page_token: page_token, offset: offset, one_box_page_size: one_box_page_size, data_store_specs: data_store_specs, filter: filter, canonical_filter: canonical_filter, order_by: order_by, user_info: user_info, language_code: language_code, facet_specs: facet_specs, boost_spec: boost_spec, params: params, query_expansion_spec: query_expansion_spec, spell_correction_spec: spell_correction_spec, user_pseudo_id: user_pseudo_id, content_search_spec: content_search_spec, safe_search: safe_search, user_labels: user_labels, search_as_you_type_spec: search_as_you_type_spec, session: session, session_spec: session_spec }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.search_lite serving_config: serving_config, branch: branch, query: query, image_query: image_query, page_size: page_size, page_token: page_token, offset: offset, one_box_page_size: one_box_page_size, data_store_specs: data_store_specs, filter: filter, canonical_filter: canonical_filter, order_by: order_by, user_info: user_info, language_code: language_code, facet_specs: facet_specs, boost_spec: boost_spec, params: params, query_expansion_spec: query_expansion_spec, spell_correction_spec: spell_correction_spec, user_pseudo_id: user_pseudo_id, content_search_spec: content_search_spec, safe_search: safe_search, user_labels: user_labels, search_as_you_type_spec: search_as_you_type_spec, session: session, session_spec: session_spec do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.search_lite ::Google::Cloud::DiscoveryEngine::V1::SearchRequest.new(serving_config: serving_config, branch: branch, query: query, image_query: image_query, page_size: page_size, page_token: page_token, offset: offset, one_box_page_size: one_box_page_size, data_store_specs: data_store_specs, filter: filter, canonical_filter: canonical_filter, order_by: order_by, user_info: user_info, language_code: language_code, facet_specs: facet_specs, boost_spec: boost_spec, params: params, query_expansion_spec: query_expansion_spec, spell_correction_spec: spell_correction_spec, user_pseudo_id: user_pseudo_id, content_search_spec: content_search_spec, safe_search: safe_search, user_labels: user_labels, search_as_you_type_spec: search_as_you_type_spec, session: session, session_spec: session_spec) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.search_lite({ serving_config: serving_config, branch: branch, query: query, image_query: image_query, page_size: page_size, page_token: page_token, offset: offset, one_box_page_size: one_box_page_size, data_store_specs: data_store_specs, filter: filter, canonical_filter: canonical_filter, order_by: order_by, user_info: user_info, language_code: language_code, facet_specs: facet_specs, boost_spec: boost_spec, params: params, query_expansion_spec: query_expansion_spec, spell_correction_spec: spell_correction_spec, user_pseudo_id: user_pseudo_id, content_search_spec: content_search_spec, safe_search: safe_search, user_labels: user_labels, search_as_you_type_spec: search_as_you_type_spec, session: session, session_spec: session_spec }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.search_lite(::Google::Cloud::DiscoveryEngine::V1::SearchRequest.new(serving_config: serving_config, branch: branch, query: query, image_query: image_query, page_size: page_size, page_token: page_token, offset: offset, one_box_page_size: one_box_page_size, data_store_specs: data_store_specs, filter: filter, canonical_filter: canonical_filter, order_by: order_by, user_info: user_info, language_code: language_code, facet_specs: facet_specs, boost_spec: boost_spec, params: params, query_expansion_spec: query_expansion_spec, spell_correction_spec: spell_correction_spec, user_pseudo_id: user_pseudo_id, content_search_spec: content_search_spec, safe_search: safe_search, user_labels: user_labels, search_as_you_type_spec: search_as_you_type_spec, session: session, session_spec: session_spec), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, search_lite_client_stub.call_rpc_count + end + end + def test_configure grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure