google-cloud-discovery_engine-v1beta 0.14.2 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +155 -0
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/paths.rb +62 -0
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +148 -0
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/service_stub.rb +76 -0
- data/lib/google/cloud/discovery_engine/v1beta/control_service/client.rb +6 -6
- data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/client.rb +6 -6
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +18 -13
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +18 -13
- data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +109 -1
- data/lib/google/cloud/discovery_engine/v1beta/document_service/paths.rb +25 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +102 -1
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/service_stub.rb +66 -0
- data/lib/google/cloud/discovery_engine/v1beta/engine_service/client.rb +3 -3
- data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/client.rb +3 -3
- data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/client.rb +218 -4
- data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/paths.rb +85 -0
- data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/client.rb +125 -4
- data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/service_stub.rb +60 -0
- data/lib/google/cloud/discovery_engine/v1beta/rank_service/client.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/client.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +410 -4
- data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +402 -4
- data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/service_stub.rb +76 -0
- data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/client.rb +2 -2
- data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/client.rb +2 -2
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/client.rb +324 -1
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/paths.rb +49 -0
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/client.rb +303 -1
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/service_stub.rb +193 -0
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/answer_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/completion_service_pb.rb +18 -1
- data/lib/google/cloud/discoveryengine/v1beta/completion_service_services_pb.rb +2 -0
- data/lib/google/cloud/discoveryengine/v1beta/control_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +4 -1
- data/lib/google/cloud/discoveryengine/v1beta/custom_tuning_model_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/data_store_pb.rb +7 -1
- data/lib/google/cloud/discoveryengine/v1beta/document_pb.rb +4 -1
- data/lib/google/cloud/discoveryengine/v1beta/document_service_pb.rb +11 -1
- data/lib/google/cloud/discoveryengine/v1beta/document_service_services_pb.rb +4 -0
- data/lib/google/cloud/discoveryengine/v1beta/engine_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_pb.rb +24 -1
- data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_services_pb.rb +4 -0
- data/lib/google/cloud/discoveryengine/v1beta/grounding_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1beta/import_config_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/purge_config_pb.rb +5 -1
- data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +6 -1
- data/lib/google/cloud/discoveryengine/v1beta/search_service_services_pb.rb +14 -0
- data/lib/google/cloud/discoveryengine/v1beta/serving_config_pb.rb +2 -2
- data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_service_pb.rb +10 -1
- data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_service_services_pb.rb +7 -0
- data/lib/google/cloud/discoveryengine/v1beta/user_event_pb.rb +1 -1
- data/proto_docs/google/api/client.rb +20 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/answer.rb +68 -8
- data/proto_docs/google/cloud/discoveryengine/v1beta/completion_service.rb +268 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/control.rb +10 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/control_service.rb +6 -6
- data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +98 -15
- data/proto_docs/google/cloud/discoveryengine/v1beta/custom_tuning_model.rb +11 -3
- data/proto_docs/google/cloud/discoveryengine/v1beta/data_store.rb +131 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/document.rb +22 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/document_processing_config.rb +9 -5
- data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +123 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/engine.rb +5 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/engine_service.rb +4 -4
- data/proto_docs/google/cloud/discoveryengine/v1beta/grounded_generation_service.rb +398 -2
- data/proto_docs/google/cloud/discoveryengine/v1beta/grounding.rb +10 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/import_config.rb +13 -7
- data/proto_docs/google/cloud/discoveryengine/v1beta/project.rb +1 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/purge_config.rb +39 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/rank_service.rb +1 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +175 -6
- data/proto_docs/google/cloud/discoveryengine/v1beta/serving_config.rb +16 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/serving_config_service.rb +2 -2
- data/proto_docs/google/cloud/discoveryengine/v1beta/site_search_engine.rb +17 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/site_search_engine_service.rb +147 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +13 -1
- metadata +3 -3
@@ -196,7 +196,7 @@ module Google
|
|
196
196
|
# @param options [::Gapic::CallOptions, ::Hash]
|
197
197
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
198
198
|
#
|
199
|
-
# @overload search(serving_config: nil, branch: nil, query: nil, image_query: nil, page_size: nil, page_token: nil, offset: nil, data_store_specs: nil, filter: nil, canonical_filter: nil, order_by: nil, user_info: nil, language_code: nil, region_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, embedding_spec: nil, ranking_expression: nil, safe_search: nil, user_labels: nil, natural_language_query_understanding_spec: nil, search_as_you_type_spec: nil, session: nil, session_spec: nil)
|
199
|
+
# @overload search(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, region_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, embedding_spec: nil, ranking_expression: nil, safe_search: nil, user_labels: nil, natural_language_query_understanding_spec: nil, search_as_you_type_spec: nil, session: nil, session_spec: nil, relevance_threshold: nil, personalization_spec: nil)
|
200
200
|
# Pass arguments to `search` via keyword arguments. Note that at
|
201
201
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
202
202
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -246,6 +246,10 @@ module Google
|
|
246
246
|
# is unset.
|
247
247
|
#
|
248
248
|
# If this field is negative, an `INVALID_ARGUMENT` is returned.
|
249
|
+
# @param one_box_page_size [::Integer]
|
250
|
+
# The maximum number of results to return for OneBox.
|
251
|
+
# This applies to each OneBox type individually.
|
252
|
+
# Default number is 10.
|
249
253
|
# @param data_store_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::DataStoreSpec, ::Hash>]
|
250
254
|
# Specs defining dataStores to filter on in a search call and configurations
|
251
255
|
# for those dataStores. This is only considered for engines with multiple
|
@@ -286,9 +290,12 @@ module Google
|
|
286
290
|
# object. Leave it unset if ordered by relevance. `order_by` expression is
|
287
291
|
# case-sensitive.
|
288
292
|
#
|
289
|
-
# For more information on ordering
|
290
|
-
# [
|
291
|
-
#
|
293
|
+
# For more information on ordering the website search results, see
|
294
|
+
# [Order web search
|
295
|
+
# results](https://cloud.google.com/generative-ai-app-builder/docs/order-web-search-results).
|
296
|
+
# For more information on ordering the healthcare search results, see
|
297
|
+
# [Order healthcare search
|
298
|
+
# results](https://cloud.google.com/generative-ai-app-builder/docs/order-hc-results).
|
292
299
|
# If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
|
293
300
|
# @param user_info [::Google::Cloud::DiscoveryEngine::V1beta::UserInfo, ::Hash]
|
294
301
|
# Information about the end user.
|
@@ -451,6 +458,23 @@ module Google
|
|
451
458
|
# Session specification.
|
452
459
|
#
|
453
460
|
# Can be used only when `session` is set.
|
461
|
+
# @param relevance_threshold [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::RelevanceThreshold]
|
462
|
+
# The relevance threshold of the search results.
|
463
|
+
#
|
464
|
+
# Default to Google defined threshold, leveraging a balance of
|
465
|
+
# precision and recall to deliver both highly accurate results and
|
466
|
+
# comprehensive coverage of relevant information.
|
467
|
+
# @param personalization_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::PersonalizationSpec, ::Hash]
|
468
|
+
# The specification for personalization.
|
469
|
+
#
|
470
|
+
# Notice that if both
|
471
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}
|
472
|
+
# and
|
473
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
|
474
|
+
# are set,
|
475
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
|
476
|
+
# overrides
|
477
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}.
|
454
478
|
#
|
455
479
|
# @yield [response, operation] Access the result along with the RPC operation
|
456
480
|
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult>]
|
@@ -522,6 +546,381 @@ module Google
|
|
522
546
|
raise ::Google::Cloud::Error.from_error(e)
|
523
547
|
end
|
524
548
|
|
549
|
+
##
|
550
|
+
# Performs a search. Similar to the
|
551
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client#search SearchService.Search}
|
552
|
+
# method, but a lite version that allows API key for authentication, where
|
553
|
+
# OAuth and IAM checks are not required.
|
554
|
+
#
|
555
|
+
# Only public website search is supported by this method. If data stores and
|
556
|
+
# engines not associated with public website search are specified, a
|
557
|
+
# `FAILED_PRECONDITION` error is returned.
|
558
|
+
#
|
559
|
+
# This method can be used for easy onboarding without having to implement an
|
560
|
+
# authentication backend. However, it is strongly recommended to use
|
561
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client#search SearchService.Search}
|
562
|
+
# instead with required OAuth and IAM checks to provide better data security.
|
563
|
+
#
|
564
|
+
# @overload search_lite(request, options = nil)
|
565
|
+
# Pass arguments to `search_lite` via a request object, either of type
|
566
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest} or an equivalent Hash.
|
567
|
+
#
|
568
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest, ::Hash]
|
569
|
+
# A request object representing the call parameters. Required. To specify no
|
570
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
571
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
572
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
573
|
+
#
|
574
|
+
# @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, region_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, embedding_spec: nil, ranking_expression: nil, safe_search: nil, user_labels: nil, natural_language_query_understanding_spec: nil, search_as_you_type_spec: nil, session: nil, session_spec: nil, relevance_threshold: nil, personalization_spec: nil)
|
575
|
+
# Pass arguments to `search_lite` via keyword arguments. Note that at
|
576
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
577
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
578
|
+
#
|
579
|
+
# @param serving_config [::String]
|
580
|
+
# Required. The resource name of the Search serving config, such as
|
581
|
+
# `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`,
|
582
|
+
# or
|
583
|
+
# `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config`.
|
584
|
+
# This field is used to identify the serving configuration name, set
|
585
|
+
# of models used to make the search.
|
586
|
+
# @param branch [::String]
|
587
|
+
# The branch resource name, such as
|
588
|
+
# `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/branches/0`.
|
589
|
+
#
|
590
|
+
# Use `default_branch` as the branch ID or leave this field empty, to search
|
591
|
+
# documents under the default branch.
|
592
|
+
# @param query [::String]
|
593
|
+
# Raw search query.
|
594
|
+
# @param image_query [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ImageQuery, ::Hash]
|
595
|
+
# Raw image query.
|
596
|
+
# @param page_size [::Integer]
|
597
|
+
# Maximum number of {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s
|
598
|
+
# to return. The maximum allowed value depends on the data type. Values above
|
599
|
+
# the maximum value are coerced to the maximum value.
|
600
|
+
#
|
601
|
+
# * Websites with basic indexing: Default `10`, Maximum `25`.
|
602
|
+
# * Websites with advanced indexing: Default `25`, Maximum `50`.
|
603
|
+
# * Other: Default `50`, Maximum `100`.
|
604
|
+
#
|
605
|
+
# If this field is negative, an `INVALID_ARGUMENT` is returned.
|
606
|
+
# @param page_token [::String]
|
607
|
+
# A page token received from a previous
|
608
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client#search SearchService.Search}
|
609
|
+
# call. Provide this to retrieve the subsequent page.
|
610
|
+
#
|
611
|
+
# When paginating, all other parameters provided to
|
612
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client#search SearchService.Search}
|
613
|
+
# must match the call that provided the page token. Otherwise, an
|
614
|
+
# `INVALID_ARGUMENT` error is returned.
|
615
|
+
# @param offset [::Integer]
|
616
|
+
# A 0-indexed integer that specifies the current offset (that is, starting
|
617
|
+
# result location, amongst the
|
618
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s deemed by the API
|
619
|
+
# as relevant) in search results. This field is only considered if
|
620
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#page_token page_token}
|
621
|
+
# is unset.
|
622
|
+
#
|
623
|
+
# If this field is negative, an `INVALID_ARGUMENT` is returned.
|
624
|
+
# @param one_box_page_size [::Integer]
|
625
|
+
# The maximum number of results to return for OneBox.
|
626
|
+
# This applies to each OneBox type individually.
|
627
|
+
# Default number is 10.
|
628
|
+
# @param data_store_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::DataStoreSpec, ::Hash>]
|
629
|
+
# Specs defining dataStores to filter on in a search call and configurations
|
630
|
+
# for those dataStores. This is only considered for engines with multiple
|
631
|
+
# dataStores use case. For single dataStore within an engine, they should
|
632
|
+
# use the specs at the top level.
|
633
|
+
# @param filter [::String]
|
634
|
+
# The filter syntax consists of an expression language for constructing a
|
635
|
+
# predicate from one or more fields of the documents being filtered. Filter
|
636
|
+
# expression is case-sensitive.
|
637
|
+
#
|
638
|
+
# If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
|
639
|
+
#
|
640
|
+
# Filtering in Vertex AI Search is done by mapping the LHS filter key to a
|
641
|
+
# key property defined in the Vertex AI Search backend -- this mapping is
|
642
|
+
# defined by the customer in their schema. For example a media customer might
|
643
|
+
# have a field 'name' in their schema. In this case the filter would look
|
644
|
+
# like this: filter --> name:'ANY("king kong")'
|
645
|
+
#
|
646
|
+
# For more information about filtering including syntax and filter
|
647
|
+
# operators, see
|
648
|
+
# [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)
|
649
|
+
# @param canonical_filter [::String]
|
650
|
+
# The default filter that is applied when a user performs a search without
|
651
|
+
# checking any filters on the search page.
|
652
|
+
#
|
653
|
+
# The filter applied to every search request when quality improvement such as
|
654
|
+
# query expansion is needed. In the case a query does not have a sufficient
|
655
|
+
# amount of results this filter will be used to determine whether or not to
|
656
|
+
# enable the query expansion flow. The original filter will still be used for
|
657
|
+
# the query expanded search.
|
658
|
+
# This field is strongly recommended to achieve high search quality.
|
659
|
+
#
|
660
|
+
# For more information about filter syntax, see
|
661
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}.
|
662
|
+
# @param order_by [::String]
|
663
|
+
# The order in which documents are returned. Documents can be ordered by
|
664
|
+
# a field in an {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}
|
665
|
+
# object. Leave it unset if ordered by relevance. `order_by` expression is
|
666
|
+
# case-sensitive.
|
667
|
+
#
|
668
|
+
# For more information on ordering the website search results, see
|
669
|
+
# [Order web search
|
670
|
+
# results](https://cloud.google.com/generative-ai-app-builder/docs/order-web-search-results).
|
671
|
+
# For more information on ordering the healthcare search results, see
|
672
|
+
# [Order healthcare search
|
673
|
+
# results](https://cloud.google.com/generative-ai-app-builder/docs/order-hc-results).
|
674
|
+
# If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
|
675
|
+
# @param user_info [::Google::Cloud::DiscoveryEngine::V1beta::UserInfo, ::Hash]
|
676
|
+
# Information about the end user.
|
677
|
+
# Highly recommended for analytics.
|
678
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::UserInfo#user_agent UserInfo.user_agent}
|
679
|
+
# is used to deduce `device_type` for analytics.
|
680
|
+
# @param language_code [::String]
|
681
|
+
# The BCP-47 language code, such as "en-US" or "sr-Latn". For more
|
682
|
+
# information, see [Standard
|
683
|
+
# fields](https://cloud.google.com/apis/design/standard_fields). This field
|
684
|
+
# helps to better interpret the query. If a value isn't specified, the query
|
685
|
+
# language code is automatically detected, which may not be accurate.
|
686
|
+
# @param region_code [::String]
|
687
|
+
# The Unicode country/region code (CLDR) of a location, such as "US" and
|
688
|
+
# "419". For more information, see [Standard
|
689
|
+
# fields](https://cloud.google.com/apis/design/standard_fields). If set,
|
690
|
+
# then results will be boosted based on the region_code provided.
|
691
|
+
# @param facet_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec, ::Hash>]
|
692
|
+
# Facet specifications for faceted search. If empty, no facets are returned.
|
693
|
+
#
|
694
|
+
# A maximum of 100 values are allowed. Otherwise, an `INVALID_ARGUMENT`
|
695
|
+
# error is returned.
|
696
|
+
# @param boost_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec, ::Hash]
|
697
|
+
# Boost specification to boost certain documents.
|
698
|
+
# For more information on boosting, see
|
699
|
+
# [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results)
|
700
|
+
# @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}]
|
701
|
+
# Additional search parameters.
|
702
|
+
#
|
703
|
+
# For public website search only, supported values are:
|
704
|
+
#
|
705
|
+
# * `user_country_code`: string. Default empty. If set to non-empty, results
|
706
|
+
# are restricted or boosted based on the location provided.
|
707
|
+
# For example, `user_country_code: "au"`
|
708
|
+
#
|
709
|
+
# For available codes see [Country
|
710
|
+
# Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes)
|
711
|
+
#
|
712
|
+
# * `search_type`: double. Default empty. Enables non-webpage searching
|
713
|
+
# depending on the value. The only valid non-default value is 1,
|
714
|
+
# which enables image searching.
|
715
|
+
# For example, `search_type: 1`
|
716
|
+
# @param query_expansion_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec, ::Hash]
|
717
|
+
# The query expansion specification that specifies the conditions under which
|
718
|
+
# query expansion occurs.
|
719
|
+
# @param spell_correction_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec, ::Hash]
|
720
|
+
# The spell correction specification that specifies the mode under
|
721
|
+
# which spell correction takes effect.
|
722
|
+
# @param user_pseudo_id [::String]
|
723
|
+
# A unique identifier for tracking visitors. For example, this could be
|
724
|
+
# implemented with an HTTP cookie, which should be able to uniquely identify
|
725
|
+
# a visitor on a single device. This unique identifier should not change if
|
726
|
+
# the visitor logs in or out of the website.
|
727
|
+
#
|
728
|
+
# This field should NOT have a fixed value such as `unknown_visitor`.
|
729
|
+
#
|
730
|
+
# This should be the same identifier as
|
731
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::UserEvent#user_pseudo_id UserEvent.user_pseudo_id}
|
732
|
+
# and
|
733
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest#user_pseudo_id CompleteQueryRequest.user_pseudo_id}
|
734
|
+
#
|
735
|
+
# The field must be a UTF-8 encoded string with a length limit of 128
|
736
|
+
# characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
|
737
|
+
# @param content_search_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec, ::Hash]
|
738
|
+
# A specification for configuring the behavior of content search.
|
739
|
+
# @param embedding_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec, ::Hash]
|
740
|
+
# Uses the provided embedding to do additional semantic document retrieval.
|
741
|
+
# The retrieval is based on the dot product of
|
742
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector#vector SearchRequest.EmbeddingSpec.EmbeddingVector.vector}
|
743
|
+
# and the document embedding that is provided in
|
744
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector#field_path SearchRequest.EmbeddingSpec.EmbeddingVector.field_path}.
|
745
|
+
#
|
746
|
+
# If
|
747
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector#field_path SearchRequest.EmbeddingSpec.EmbeddingVector.field_path}
|
748
|
+
# is not provided, it will use
|
749
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#embedding_config ServingConfig.EmbeddingConfig.field_path}.
|
750
|
+
# @param ranking_expression [::String]
|
751
|
+
# The ranking expression controls the customized ranking on retrieval
|
752
|
+
# documents. This overrides
|
753
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#ranking_expression ServingConfig.ranking_expression}.
|
754
|
+
# The ranking expression is a single function or multiple functions that are
|
755
|
+
# joined by "+".
|
756
|
+
#
|
757
|
+
# * ranking_expression = function, { " + ", function };
|
758
|
+
#
|
759
|
+
# Supported functions:
|
760
|
+
#
|
761
|
+
# * double * relevance_score
|
762
|
+
# * double * dotProduct(embedding_field_path)
|
763
|
+
#
|
764
|
+
# Function variables:
|
765
|
+
#
|
766
|
+
# * `relevance_score`: pre-defined keywords, used for measure relevance
|
767
|
+
# between query and document.
|
768
|
+
# * `embedding_field_path`: the document embedding field
|
769
|
+
# used with query embedding vector.
|
770
|
+
# * `dotProduct`: embedding function between embedding_field_path and query
|
771
|
+
# embedding vector.
|
772
|
+
#
|
773
|
+
# Example ranking expression:
|
774
|
+
#
|
775
|
+
# If document has an embedding field doc_embedding, the ranking expression
|
776
|
+
# could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
777
|
+
# @param safe_search [::Boolean]
|
778
|
+
# Whether to turn on safe search. This is only supported for
|
779
|
+
# website search.
|
780
|
+
# @param user_labels [::Hash{::String => ::String}]
|
781
|
+
# The user labels applied to a resource must meet the following requirements:
|
782
|
+
#
|
783
|
+
# * Each resource can have multiple labels, up to a maximum of 64.
|
784
|
+
# * Each label must be a key-value pair.
|
785
|
+
# * Keys have a minimum length of 1 character and a maximum length of 63
|
786
|
+
# characters and cannot be empty. Values can be empty and have a maximum
|
787
|
+
# length of 63 characters.
|
788
|
+
# * Keys and values can contain only lowercase letters, numeric characters,
|
789
|
+
# underscores, and dashes. All characters must use UTF-8 encoding, and
|
790
|
+
# international characters are allowed.
|
791
|
+
# * The key portion of a label must be unique. However, you can use the same
|
792
|
+
# key with multiple resources.
|
793
|
+
# * Keys must start with a lowercase letter or international character.
|
794
|
+
#
|
795
|
+
# See [Google Cloud
|
796
|
+
# Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
|
797
|
+
# for more details.
|
798
|
+
# @param natural_language_query_understanding_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::NaturalLanguageQueryUnderstandingSpec, ::Hash]
|
799
|
+
# If `naturalLanguageQueryUnderstandingSpec` is not specified, no additional
|
800
|
+
# natural language query understanding will be done.
|
801
|
+
# @param search_as_you_type_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SearchAsYouTypeSpec, ::Hash]
|
802
|
+
# Search as you type configuration. Only supported for the
|
803
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::IndustryVertical::MEDIA IndustryVertical.MEDIA}
|
804
|
+
# vertical.
|
805
|
+
# @param session [::String]
|
806
|
+
# The session resource name. Optional.
|
807
|
+
#
|
808
|
+
# Session allows users to do multi-turn /search API calls or coordination
|
809
|
+
# between /search API calls and /answer API calls.
|
810
|
+
#
|
811
|
+
# Example #1 (multi-turn /search API calls):
|
812
|
+
# 1. Call /search API with the auto-session mode (see below).
|
813
|
+
# 2. Call /search API with the session ID generated in the first call.
|
814
|
+
# Here, the previous search query gets considered in query
|
815
|
+
# standing. I.e., if the first query is "How did Alphabet do in 2022?"
|
816
|
+
# and the current query is "How about 2023?", the current query will
|
817
|
+
# be interpreted as "How did Alphabet do in 2023?".
|
818
|
+
#
|
819
|
+
# Example #2 (coordination between /search API calls and /answer API calls):
|
820
|
+
# 1. Call /search API with the auto-session mode (see below).
|
821
|
+
# 2. Call /answer API with the session ID generated in the first call.
|
822
|
+
# Here, the answer generation happens in the context of the search
|
823
|
+
# results from the first search call.
|
824
|
+
#
|
825
|
+
# Auto-session mode: when `projects/.../sessions/-` is used, a new session
|
826
|
+
# gets automatically created. Otherwise, users can use the create-session API
|
827
|
+
# to create a session manually.
|
828
|
+
#
|
829
|
+
# Multi-turn Search feature is currently at private GA stage. Please use
|
830
|
+
# v1alpha or v1beta version instead before we launch this feature to public
|
831
|
+
# GA. Or ask for allowlisting through Google Support team.
|
832
|
+
# @param session_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SessionSpec, ::Hash]
|
833
|
+
# Session specification.
|
834
|
+
#
|
835
|
+
# Can be used only when `session` is set.
|
836
|
+
# @param relevance_threshold [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::RelevanceThreshold]
|
837
|
+
# The relevance threshold of the search results.
|
838
|
+
#
|
839
|
+
# Default to Google defined threshold, leveraging a balance of
|
840
|
+
# precision and recall to deliver both highly accurate results and
|
841
|
+
# comprehensive coverage of relevant information.
|
842
|
+
# @param personalization_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::PersonalizationSpec, ::Hash]
|
843
|
+
# The specification for personalization.
|
844
|
+
#
|
845
|
+
# Notice that if both
|
846
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}
|
847
|
+
# and
|
848
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
|
849
|
+
# are set,
|
850
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
|
851
|
+
# overrides
|
852
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}.
|
853
|
+
#
|
854
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
855
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult>]
|
856
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
857
|
+
#
|
858
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult>]
|
859
|
+
#
|
860
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
861
|
+
#
|
862
|
+
# @example Basic example
|
863
|
+
# require "google/cloud/discovery_engine/v1beta"
|
864
|
+
#
|
865
|
+
# # Create a client object. The client can be reused for multiple calls.
|
866
|
+
# client = Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client.new
|
867
|
+
#
|
868
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
869
|
+
# request = Google::Cloud::DiscoveryEngine::V1beta::SearchRequest.new
|
870
|
+
#
|
871
|
+
# # Call the search_lite method.
|
872
|
+
# result = client.search_lite request
|
873
|
+
#
|
874
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
875
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
876
|
+
# result.each do |item|
|
877
|
+
# # Each element is of type ::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult.
|
878
|
+
# p item
|
879
|
+
# end
|
880
|
+
#
|
881
|
+
def search_lite request, options = nil
|
882
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
883
|
+
|
884
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest
|
885
|
+
|
886
|
+
# Converts hash and nil to an options object
|
887
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
888
|
+
|
889
|
+
# Customize the options with defaults
|
890
|
+
metadata = @config.rpcs.search_lite.metadata.to_h
|
891
|
+
|
892
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
893
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
894
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
895
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
|
896
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
897
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
898
|
+
|
899
|
+
header_params = {}
|
900
|
+
if request.serving_config
|
901
|
+
header_params["serving_config"] = request.serving_config
|
902
|
+
end
|
903
|
+
|
904
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
905
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
906
|
+
|
907
|
+
options.apply_defaults timeout: @config.rpcs.search_lite.timeout,
|
908
|
+
metadata: metadata,
|
909
|
+
retry_policy: @config.rpcs.search_lite.retry_policy
|
910
|
+
|
911
|
+
options.apply_defaults timeout: @config.timeout,
|
912
|
+
metadata: @config.metadata,
|
913
|
+
retry_policy: @config.retry_policy
|
914
|
+
|
915
|
+
@search_service_stub.call_rpc :search_lite, request, options: options do |response, operation|
|
916
|
+
response = ::Gapic::PagedEnumerable.new @search_service_stub, :search_lite, request, response, operation, options
|
917
|
+
yield response, operation if block_given?
|
918
|
+
return response
|
919
|
+
end
|
920
|
+
rescue ::GRPC::BadStatus => e
|
921
|
+
raise ::Google::Cloud::Error.from_error(e)
|
922
|
+
end
|
923
|
+
|
525
924
|
##
|
526
925
|
# Configuration class for the SearchService API.
|
527
926
|
#
|
@@ -680,11 +1079,18 @@ module Google
|
|
680
1079
|
# @return [::Gapic::Config::Method]
|
681
1080
|
#
|
682
1081
|
attr_reader :search
|
1082
|
+
##
|
1083
|
+
# RPC-specific configuration for `search_lite`
|
1084
|
+
# @return [::Gapic::Config::Method]
|
1085
|
+
#
|
1086
|
+
attr_reader :search_lite
|
683
1087
|
|
684
1088
|
# @private
|
685
1089
|
def initialize parent_rpcs = nil
|
686
1090
|
search_config = parent_rpcs.search if parent_rpcs.respond_to? :search
|
687
1091
|
@search = ::Gapic::Config::Method.new search_config
|
1092
|
+
search_lite_config = parent_rpcs.search_lite if parent_rpcs.respond_to? :search_lite
|
1093
|
+
@search_lite = ::Gapic::Config::Method.new search_lite_config
|
688
1094
|
|
689
1095
|
yield self if block_given?
|
690
1096
|
end
|