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
@@ -189,7 +189,7 @@ module Google
|
|
189
189
|
# @param options [::Gapic::CallOptions, ::Hash]
|
190
190
|
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
191
191
|
#
|
192
|
-
# @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)
|
192
|
+
# @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)
|
193
193
|
# Pass arguments to `search` via keyword arguments. Note that at
|
194
194
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
195
195
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -239,6 +239,10 @@ module Google
|
|
239
239
|
# is unset.
|
240
240
|
#
|
241
241
|
# If this field is negative, an `INVALID_ARGUMENT` is returned.
|
242
|
+
# @param one_box_page_size [::Integer]
|
243
|
+
# The maximum number of results to return for OneBox.
|
244
|
+
# This applies to each OneBox type individually.
|
245
|
+
# Default number is 10.
|
242
246
|
# @param data_store_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::DataStoreSpec, ::Hash>]
|
243
247
|
# Specs defining dataStores to filter on in a search call and configurations
|
244
248
|
# for those dataStores. This is only considered for engines with multiple
|
@@ -279,9 +283,12 @@ module Google
|
|
279
283
|
# object. Leave it unset if ordered by relevance. `order_by` expression is
|
280
284
|
# case-sensitive.
|
281
285
|
#
|
282
|
-
# For more information on ordering
|
283
|
-
# [
|
284
|
-
#
|
286
|
+
# For more information on ordering the website search results, see
|
287
|
+
# [Order web search
|
288
|
+
# results](https://cloud.google.com/generative-ai-app-builder/docs/order-web-search-results).
|
289
|
+
# For more information on ordering the healthcare search results, see
|
290
|
+
# [Order healthcare search
|
291
|
+
# results](https://cloud.google.com/generative-ai-app-builder/docs/order-hc-results).
|
285
292
|
# If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
|
286
293
|
# @param user_info [::Google::Cloud::DiscoveryEngine::V1beta::UserInfo, ::Hash]
|
287
294
|
# Information about the end user.
|
@@ -444,6 +451,23 @@ module Google
|
|
444
451
|
# Session specification.
|
445
452
|
#
|
446
453
|
# Can be used only when `session` is set.
|
454
|
+
# @param relevance_threshold [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::RelevanceThreshold]
|
455
|
+
# The relevance threshold of the search results.
|
456
|
+
#
|
457
|
+
# Default to Google defined threshold, leveraging a balance of
|
458
|
+
# precision and recall to deliver both highly accurate results and
|
459
|
+
# comprehensive coverage of relevant information.
|
460
|
+
# @param personalization_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::PersonalizationSpec, ::Hash]
|
461
|
+
# The specification for personalization.
|
462
|
+
#
|
463
|
+
# Notice that if both
|
464
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}
|
465
|
+
# and
|
466
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
|
467
|
+
# are set,
|
468
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
|
469
|
+
# overrides
|
470
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}.
|
447
471
|
# @yield [result, operation] Access the result along with the TransportOperation object
|
448
472
|
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse]
|
449
473
|
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
@@ -507,6 +531,373 @@ module Google
|
|
507
531
|
raise ::Google::Cloud::Error.from_error(e)
|
508
532
|
end
|
509
533
|
|
534
|
+
##
|
535
|
+
# Performs a search. Similar to the
|
536
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client#search SearchService.Search}
|
537
|
+
# method, but a lite version that allows API key for authentication, where
|
538
|
+
# OAuth and IAM checks are not required.
|
539
|
+
#
|
540
|
+
# Only public website search is supported by this method. If data stores and
|
541
|
+
# engines not associated with public website search are specified, a
|
542
|
+
# `FAILED_PRECONDITION` error is returned.
|
543
|
+
#
|
544
|
+
# This method can be used for easy onboarding without having to implement an
|
545
|
+
# authentication backend. However, it is strongly recommended to use
|
546
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client#search SearchService.Search}
|
547
|
+
# instead with required OAuth and IAM checks to provide better data security.
|
548
|
+
#
|
549
|
+
# @overload search_lite(request, options = nil)
|
550
|
+
# Pass arguments to `search_lite` via a request object, either of type
|
551
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest} or an equivalent Hash.
|
552
|
+
#
|
553
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest, ::Hash]
|
554
|
+
# A request object representing the call parameters. Required. To specify no
|
555
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
556
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
557
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
558
|
+
#
|
559
|
+
# @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)
|
560
|
+
# Pass arguments to `search_lite` via keyword arguments. Note that at
|
561
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
562
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
563
|
+
#
|
564
|
+
# @param serving_config [::String]
|
565
|
+
# Required. The resource name of the Search serving config, such as
|
566
|
+
# `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`,
|
567
|
+
# or
|
568
|
+
# `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config`.
|
569
|
+
# This field is used to identify the serving configuration name, set
|
570
|
+
# of models used to make the search.
|
571
|
+
# @param branch [::String]
|
572
|
+
# The branch resource name, such as
|
573
|
+
# `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/branches/0`.
|
574
|
+
#
|
575
|
+
# Use `default_branch` as the branch ID or leave this field empty, to search
|
576
|
+
# documents under the default branch.
|
577
|
+
# @param query [::String]
|
578
|
+
# Raw search query.
|
579
|
+
# @param image_query [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ImageQuery, ::Hash]
|
580
|
+
# Raw image query.
|
581
|
+
# @param page_size [::Integer]
|
582
|
+
# Maximum number of {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s
|
583
|
+
# to return. The maximum allowed value depends on the data type. Values above
|
584
|
+
# the maximum value are coerced to the maximum value.
|
585
|
+
#
|
586
|
+
# * Websites with basic indexing: Default `10`, Maximum `25`.
|
587
|
+
# * Websites with advanced indexing: Default `25`, Maximum `50`.
|
588
|
+
# * Other: Default `50`, Maximum `100`.
|
589
|
+
#
|
590
|
+
# If this field is negative, an `INVALID_ARGUMENT` is returned.
|
591
|
+
# @param page_token [::String]
|
592
|
+
# A page token received from a previous
|
593
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client#search SearchService.Search}
|
594
|
+
# call. Provide this to retrieve the subsequent page.
|
595
|
+
#
|
596
|
+
# When paginating, all other parameters provided to
|
597
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client#search SearchService.Search}
|
598
|
+
# must match the call that provided the page token. Otherwise, an
|
599
|
+
# `INVALID_ARGUMENT` error is returned.
|
600
|
+
# @param offset [::Integer]
|
601
|
+
# A 0-indexed integer that specifies the current offset (that is, starting
|
602
|
+
# result location, amongst the
|
603
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s deemed by the API
|
604
|
+
# as relevant) in search results. This field is only considered if
|
605
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#page_token page_token}
|
606
|
+
# is unset.
|
607
|
+
#
|
608
|
+
# If this field is negative, an `INVALID_ARGUMENT` is returned.
|
609
|
+
# @param one_box_page_size [::Integer]
|
610
|
+
# The maximum number of results to return for OneBox.
|
611
|
+
# This applies to each OneBox type individually.
|
612
|
+
# Default number is 10.
|
613
|
+
# @param data_store_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::DataStoreSpec, ::Hash>]
|
614
|
+
# Specs defining dataStores to filter on in a search call and configurations
|
615
|
+
# for those dataStores. This is only considered for engines with multiple
|
616
|
+
# dataStores use case. For single dataStore within an engine, they should
|
617
|
+
# use the specs at the top level.
|
618
|
+
# @param filter [::String]
|
619
|
+
# The filter syntax consists of an expression language for constructing a
|
620
|
+
# predicate from one or more fields of the documents being filtered. Filter
|
621
|
+
# expression is case-sensitive.
|
622
|
+
#
|
623
|
+
# If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
|
624
|
+
#
|
625
|
+
# Filtering in Vertex AI Search is done by mapping the LHS filter key to a
|
626
|
+
# key property defined in the Vertex AI Search backend -- this mapping is
|
627
|
+
# defined by the customer in their schema. For example a media customer might
|
628
|
+
# have a field 'name' in their schema. In this case the filter would look
|
629
|
+
# like this: filter --> name:'ANY("king kong")'
|
630
|
+
#
|
631
|
+
# For more information about filtering including syntax and filter
|
632
|
+
# operators, see
|
633
|
+
# [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)
|
634
|
+
# @param canonical_filter [::String]
|
635
|
+
# The default filter that is applied when a user performs a search without
|
636
|
+
# checking any filters on the search page.
|
637
|
+
#
|
638
|
+
# The filter applied to every search request when quality improvement such as
|
639
|
+
# query expansion is needed. In the case a query does not have a sufficient
|
640
|
+
# amount of results this filter will be used to determine whether or not to
|
641
|
+
# enable the query expansion flow. The original filter will still be used for
|
642
|
+
# the query expanded search.
|
643
|
+
# This field is strongly recommended to achieve high search quality.
|
644
|
+
#
|
645
|
+
# For more information about filter syntax, see
|
646
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}.
|
647
|
+
# @param order_by [::String]
|
648
|
+
# The order in which documents are returned. Documents can be ordered by
|
649
|
+
# a field in an {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}
|
650
|
+
# object. Leave it unset if ordered by relevance. `order_by` expression is
|
651
|
+
# case-sensitive.
|
652
|
+
#
|
653
|
+
# For more information on ordering the website search results, see
|
654
|
+
# [Order web search
|
655
|
+
# results](https://cloud.google.com/generative-ai-app-builder/docs/order-web-search-results).
|
656
|
+
# For more information on ordering the healthcare search results, see
|
657
|
+
# [Order healthcare search
|
658
|
+
# results](https://cloud.google.com/generative-ai-app-builder/docs/order-hc-results).
|
659
|
+
# If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
|
660
|
+
# @param user_info [::Google::Cloud::DiscoveryEngine::V1beta::UserInfo, ::Hash]
|
661
|
+
# Information about the end user.
|
662
|
+
# Highly recommended for analytics.
|
663
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::UserInfo#user_agent UserInfo.user_agent}
|
664
|
+
# is used to deduce `device_type` for analytics.
|
665
|
+
# @param language_code [::String]
|
666
|
+
# The BCP-47 language code, such as "en-US" or "sr-Latn". For more
|
667
|
+
# information, see [Standard
|
668
|
+
# fields](https://cloud.google.com/apis/design/standard_fields). This field
|
669
|
+
# helps to better interpret the query. If a value isn't specified, the query
|
670
|
+
# language code is automatically detected, which may not be accurate.
|
671
|
+
# @param region_code [::String]
|
672
|
+
# The Unicode country/region code (CLDR) of a location, such as "US" and
|
673
|
+
# "419". For more information, see [Standard
|
674
|
+
# fields](https://cloud.google.com/apis/design/standard_fields). If set,
|
675
|
+
# then results will be boosted based on the region_code provided.
|
676
|
+
# @param facet_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec, ::Hash>]
|
677
|
+
# Facet specifications for faceted search. If empty, no facets are returned.
|
678
|
+
#
|
679
|
+
# A maximum of 100 values are allowed. Otherwise, an `INVALID_ARGUMENT`
|
680
|
+
# error is returned.
|
681
|
+
# @param boost_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec, ::Hash]
|
682
|
+
# Boost specification to boost certain documents.
|
683
|
+
# For more information on boosting, see
|
684
|
+
# [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results)
|
685
|
+
# @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}]
|
686
|
+
# Additional search parameters.
|
687
|
+
#
|
688
|
+
# For public website search only, supported values are:
|
689
|
+
#
|
690
|
+
# * `user_country_code`: string. Default empty. If set to non-empty, results
|
691
|
+
# are restricted or boosted based on the location provided.
|
692
|
+
# For example, `user_country_code: "au"`
|
693
|
+
#
|
694
|
+
# For available codes see [Country
|
695
|
+
# Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes)
|
696
|
+
#
|
697
|
+
# * `search_type`: double. Default empty. Enables non-webpage searching
|
698
|
+
# depending on the value. The only valid non-default value is 1,
|
699
|
+
# which enables image searching.
|
700
|
+
# For example, `search_type: 1`
|
701
|
+
# @param query_expansion_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec, ::Hash]
|
702
|
+
# The query expansion specification that specifies the conditions under which
|
703
|
+
# query expansion occurs.
|
704
|
+
# @param spell_correction_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec, ::Hash]
|
705
|
+
# The spell correction specification that specifies the mode under
|
706
|
+
# which spell correction takes effect.
|
707
|
+
# @param user_pseudo_id [::String]
|
708
|
+
# A unique identifier for tracking visitors. For example, this could be
|
709
|
+
# implemented with an HTTP cookie, which should be able to uniquely identify
|
710
|
+
# a visitor on a single device. This unique identifier should not change if
|
711
|
+
# the visitor logs in or out of the website.
|
712
|
+
#
|
713
|
+
# This field should NOT have a fixed value such as `unknown_visitor`.
|
714
|
+
#
|
715
|
+
# This should be the same identifier as
|
716
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::UserEvent#user_pseudo_id UserEvent.user_pseudo_id}
|
717
|
+
# and
|
718
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest#user_pseudo_id CompleteQueryRequest.user_pseudo_id}
|
719
|
+
#
|
720
|
+
# The field must be a UTF-8 encoded string with a length limit of 128
|
721
|
+
# characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
|
722
|
+
# @param content_search_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec, ::Hash]
|
723
|
+
# A specification for configuring the behavior of content search.
|
724
|
+
# @param embedding_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec, ::Hash]
|
725
|
+
# Uses the provided embedding to do additional semantic document retrieval.
|
726
|
+
# The retrieval is based on the dot product of
|
727
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector#vector SearchRequest.EmbeddingSpec.EmbeddingVector.vector}
|
728
|
+
# and the document embedding that is provided in
|
729
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector#field_path SearchRequest.EmbeddingSpec.EmbeddingVector.field_path}.
|
730
|
+
#
|
731
|
+
# If
|
732
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector#field_path SearchRequest.EmbeddingSpec.EmbeddingVector.field_path}
|
733
|
+
# is not provided, it will use
|
734
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#embedding_config ServingConfig.EmbeddingConfig.field_path}.
|
735
|
+
# @param ranking_expression [::String]
|
736
|
+
# The ranking expression controls the customized ranking on retrieval
|
737
|
+
# documents. This overrides
|
738
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#ranking_expression ServingConfig.ranking_expression}.
|
739
|
+
# The ranking expression is a single function or multiple functions that are
|
740
|
+
# joined by "+".
|
741
|
+
#
|
742
|
+
# * ranking_expression = function, { " + ", function };
|
743
|
+
#
|
744
|
+
# Supported functions:
|
745
|
+
#
|
746
|
+
# * double * relevance_score
|
747
|
+
# * double * dotProduct(embedding_field_path)
|
748
|
+
#
|
749
|
+
# Function variables:
|
750
|
+
#
|
751
|
+
# * `relevance_score`: pre-defined keywords, used for measure relevance
|
752
|
+
# between query and document.
|
753
|
+
# * `embedding_field_path`: the document embedding field
|
754
|
+
# used with query embedding vector.
|
755
|
+
# * `dotProduct`: embedding function between embedding_field_path and query
|
756
|
+
# embedding vector.
|
757
|
+
#
|
758
|
+
# Example ranking expression:
|
759
|
+
#
|
760
|
+
# If document has an embedding field doc_embedding, the ranking expression
|
761
|
+
# could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
762
|
+
# @param safe_search [::Boolean]
|
763
|
+
# Whether to turn on safe search. This is only supported for
|
764
|
+
# website search.
|
765
|
+
# @param user_labels [::Hash{::String => ::String}]
|
766
|
+
# The user labels applied to a resource must meet the following requirements:
|
767
|
+
#
|
768
|
+
# * Each resource can have multiple labels, up to a maximum of 64.
|
769
|
+
# * Each label must be a key-value pair.
|
770
|
+
# * Keys have a minimum length of 1 character and a maximum length of 63
|
771
|
+
# characters and cannot be empty. Values can be empty and have a maximum
|
772
|
+
# length of 63 characters.
|
773
|
+
# * Keys and values can contain only lowercase letters, numeric characters,
|
774
|
+
# underscores, and dashes. All characters must use UTF-8 encoding, and
|
775
|
+
# international characters are allowed.
|
776
|
+
# * The key portion of a label must be unique. However, you can use the same
|
777
|
+
# key with multiple resources.
|
778
|
+
# * Keys must start with a lowercase letter or international character.
|
779
|
+
#
|
780
|
+
# See [Google Cloud
|
781
|
+
# Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
|
782
|
+
# for more details.
|
783
|
+
# @param natural_language_query_understanding_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::NaturalLanguageQueryUnderstandingSpec, ::Hash]
|
784
|
+
# If `naturalLanguageQueryUnderstandingSpec` is not specified, no additional
|
785
|
+
# natural language query understanding will be done.
|
786
|
+
# @param search_as_you_type_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SearchAsYouTypeSpec, ::Hash]
|
787
|
+
# Search as you type configuration. Only supported for the
|
788
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::IndustryVertical::MEDIA IndustryVertical.MEDIA}
|
789
|
+
# vertical.
|
790
|
+
# @param session [::String]
|
791
|
+
# The session resource name. Optional.
|
792
|
+
#
|
793
|
+
# Session allows users to do multi-turn /search API calls or coordination
|
794
|
+
# between /search API calls and /answer API calls.
|
795
|
+
#
|
796
|
+
# Example #1 (multi-turn /search API calls):
|
797
|
+
# 1. Call /search API with the auto-session mode (see below).
|
798
|
+
# 2. Call /search API with the session ID generated in the first call.
|
799
|
+
# Here, the previous search query gets considered in query
|
800
|
+
# standing. I.e., if the first query is "How did Alphabet do in 2022?"
|
801
|
+
# and the current query is "How about 2023?", the current query will
|
802
|
+
# be interpreted as "How did Alphabet do in 2023?".
|
803
|
+
#
|
804
|
+
# Example #2 (coordination between /search API calls and /answer API calls):
|
805
|
+
# 1. Call /search API with the auto-session mode (see below).
|
806
|
+
# 2. Call /answer API with the session ID generated in the first call.
|
807
|
+
# Here, the answer generation happens in the context of the search
|
808
|
+
# results from the first search call.
|
809
|
+
#
|
810
|
+
# Auto-session mode: when `projects/.../sessions/-` is used, a new session
|
811
|
+
# gets automatically created. Otherwise, users can use the create-session API
|
812
|
+
# to create a session manually.
|
813
|
+
#
|
814
|
+
# Multi-turn Search feature is currently at private GA stage. Please use
|
815
|
+
# v1alpha or v1beta version instead before we launch this feature to public
|
816
|
+
# GA. Or ask for allowlisting through Google Support team.
|
817
|
+
# @param session_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SessionSpec, ::Hash]
|
818
|
+
# Session specification.
|
819
|
+
#
|
820
|
+
# Can be used only when `session` is set.
|
821
|
+
# @param relevance_threshold [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::RelevanceThreshold]
|
822
|
+
# The relevance threshold of the search results.
|
823
|
+
#
|
824
|
+
# Default to Google defined threshold, leveraging a balance of
|
825
|
+
# precision and recall to deliver both highly accurate results and
|
826
|
+
# comprehensive coverage of relevant information.
|
827
|
+
# @param personalization_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::PersonalizationSpec, ::Hash]
|
828
|
+
# The specification for personalization.
|
829
|
+
#
|
830
|
+
# Notice that if both
|
831
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}
|
832
|
+
# and
|
833
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
|
834
|
+
# are set,
|
835
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
|
836
|
+
# overrides
|
837
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}.
|
838
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
839
|
+
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse]
|
840
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
841
|
+
#
|
842
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse]
|
843
|
+
#
|
844
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
845
|
+
#
|
846
|
+
# @example Basic example
|
847
|
+
# require "google/cloud/discovery_engine/v1beta"
|
848
|
+
#
|
849
|
+
# # Create a client object. The client can be reused for multiple calls.
|
850
|
+
# client = Google::Cloud::DiscoveryEngine::V1beta::SearchService::Rest::Client.new
|
851
|
+
#
|
852
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
853
|
+
# request = Google::Cloud::DiscoveryEngine::V1beta::SearchRequest.new
|
854
|
+
#
|
855
|
+
# # Call the search_lite method.
|
856
|
+
# result = client.search_lite request
|
857
|
+
#
|
858
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
859
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
860
|
+
# result.each do |item|
|
861
|
+
# # Each element is of type ::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult.
|
862
|
+
# p item
|
863
|
+
# end
|
864
|
+
#
|
865
|
+
def search_lite request, options = nil
|
866
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
867
|
+
|
868
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest
|
869
|
+
|
870
|
+
# Converts hash and nil to an options object
|
871
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
872
|
+
|
873
|
+
# Customize the options with defaults
|
874
|
+
call_metadata = @config.rpcs.search_lite.metadata.to_h
|
875
|
+
|
876
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
877
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
878
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
879
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
|
880
|
+
transports_version_send: [:rest]
|
881
|
+
|
882
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
883
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
884
|
+
|
885
|
+
options.apply_defaults timeout: @config.rpcs.search_lite.timeout,
|
886
|
+
metadata: call_metadata,
|
887
|
+
retry_policy: @config.rpcs.search_lite.retry_policy
|
888
|
+
|
889
|
+
options.apply_defaults timeout: @config.timeout,
|
890
|
+
metadata: @config.metadata,
|
891
|
+
retry_policy: @config.retry_policy
|
892
|
+
|
893
|
+
@search_service_stub.search_lite request, options do |result, operation|
|
894
|
+
yield result, operation if block_given?
|
895
|
+
return result
|
896
|
+
end
|
897
|
+
rescue ::Gapic::Rest::Error => e
|
898
|
+
raise ::Google::Cloud::Error.from_error(e)
|
899
|
+
end
|
900
|
+
|
510
901
|
##
|
511
902
|
# Configuration class for the SearchService REST API.
|
512
903
|
#
|
@@ -645,11 +1036,18 @@ module Google
|
|
645
1036
|
# @return [::Gapic::Config::Method]
|
646
1037
|
#
|
647
1038
|
attr_reader :search
|
1039
|
+
##
|
1040
|
+
# RPC-specific configuration for `search_lite`
|
1041
|
+
# @return [::Gapic::Config::Method]
|
1042
|
+
#
|
1043
|
+
attr_reader :search_lite
|
648
1044
|
|
649
1045
|
# @private
|
650
1046
|
def initialize parent_rpcs = nil
|
651
1047
|
search_config = parent_rpcs.search if parent_rpcs.respond_to? :search
|
652
1048
|
@search = ::Gapic::Config::Method.new search_config
|
1049
|
+
search_lite_config = parent_rpcs.search_lite if parent_rpcs.respond_to? :search_lite
|
1050
|
+
@search_lite = ::Gapic::Config::Method.new search_lite_config
|
653
1051
|
|
654
1052
|
yield self if block_given?
|
655
1053
|
end
|
@@ -99,6 +99,44 @@ module Google
|
|
99
99
|
result
|
100
100
|
end
|
101
101
|
|
102
|
+
##
|
103
|
+
# Baseline implementation for the search_lite REST call
|
104
|
+
#
|
105
|
+
# @param request_pb [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest]
|
106
|
+
# A request object representing the call parameters. Required.
|
107
|
+
# @param options [::Gapic::CallOptions]
|
108
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
109
|
+
#
|
110
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
111
|
+
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse]
|
112
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
113
|
+
#
|
114
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse]
|
115
|
+
# A result object deserialized from the server's reply
|
116
|
+
def search_lite request_pb, options = nil
|
117
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
118
|
+
|
119
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_search_lite_request request_pb
|
120
|
+
query_string_params = if query_string_params.any?
|
121
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
122
|
+
else
|
123
|
+
{}
|
124
|
+
end
|
125
|
+
|
126
|
+
response = @client_stub.make_http_request(
|
127
|
+
verb,
|
128
|
+
uri: uri,
|
129
|
+
body: body || "",
|
130
|
+
params: query_string_params,
|
131
|
+
options: options
|
132
|
+
)
|
133
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
134
|
+
result = ::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse.decode_json response.body, ignore_unknown_fields: true
|
135
|
+
|
136
|
+
yield result, operation if block_given?
|
137
|
+
result
|
138
|
+
end
|
139
|
+
|
102
140
|
##
|
103
141
|
# @private
|
104
142
|
#
|
@@ -136,6 +174,44 @@ module Google
|
|
136
174
|
)
|
137
175
|
transcoder.transcode request_pb
|
138
176
|
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# @private
|
180
|
+
#
|
181
|
+
# GRPC transcoding helper method for the search_lite REST call
|
182
|
+
#
|
183
|
+
# @param request_pb [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest]
|
184
|
+
# A request object representing the call parameters. Required.
|
185
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
186
|
+
# Uri, Body, Query string parameters
|
187
|
+
def self.transcode_search_lite_request request_pb
|
188
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
189
|
+
.with_bindings(
|
190
|
+
uri_method: :post,
|
191
|
+
uri_template: "/v1beta/{serving_config}:searchLite",
|
192
|
+
body: "*",
|
193
|
+
matches: [
|
194
|
+
["serving_config", %r{^projects/[^/]+/locations/[^/]+/dataStores/[^/]+/servingConfigs/[^/]+/?$}, false]
|
195
|
+
]
|
196
|
+
)
|
197
|
+
.with_bindings(
|
198
|
+
uri_method: :post,
|
199
|
+
uri_template: "/v1beta/{serving_config}:searchLite",
|
200
|
+
body: "*",
|
201
|
+
matches: [
|
202
|
+
["serving_config", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/dataStores/[^/]+/servingConfigs/[^/]+/?$}, false]
|
203
|
+
]
|
204
|
+
)
|
205
|
+
.with_bindings(
|
206
|
+
uri_method: :post,
|
207
|
+
uri_template: "/v1beta/{serving_config}:searchLite",
|
208
|
+
body: "*",
|
209
|
+
matches: [
|
210
|
+
["serving_config", %r{^projects/[^/]+/locations/[^/]+/collections/[^/]+/engines/[^/]+/servingConfigs/[^/]+/?$}, false]
|
211
|
+
]
|
212
|
+
)
|
213
|
+
transcoder.transcode request_pb
|
214
|
+
end
|
139
215
|
end
|
140
216
|
end
|
141
217
|
end
|
@@ -297,7 +297,7 @@ module Google
|
|
297
297
|
#
|
298
298
|
# @param name [::String]
|
299
299
|
# Required. The resource name of the ServingConfig to get. Format:
|
300
|
-
# `projects/{
|
300
|
+
# `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/servingConfigs/{serving_config_id}`
|
301
301
|
#
|
302
302
|
# @yield [response, operation] Access the result along with the RPC operation
|
303
303
|
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig]
|
@@ -384,7 +384,7 @@ module Google
|
|
384
384
|
#
|
385
385
|
# @param parent [::String]
|
386
386
|
# Required. Full resource name of the parent resource. Format:
|
387
|
-
# `projects/{
|
387
|
+
# `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}`
|
388
388
|
# @param page_size [::Integer]
|
389
389
|
# Optional. Maximum number of results to return. If unspecified, defaults
|
390
390
|
# to 100. If a value greater than 100 is provided, at most 100 results are
|
@@ -283,7 +283,7 @@ module Google
|
|
283
283
|
#
|
284
284
|
# @param name [::String]
|
285
285
|
# Required. The resource name of the ServingConfig to get. Format:
|
286
|
-
# `projects/{
|
286
|
+
# `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/servingConfigs/{serving_config_id}`
|
287
287
|
# @yield [result, operation] Access the result along with the TransportOperation object
|
288
288
|
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig]
|
289
289
|
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
@@ -363,7 +363,7 @@ module Google
|
|
363
363
|
#
|
364
364
|
# @param parent [::String]
|
365
365
|
# Required. Full resource name of the parent resource. Format:
|
366
|
-
# `projects/{
|
366
|
+
# `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}`
|
367
367
|
# @param page_size [::Integer]
|
368
368
|
# Optional. Maximum number of results to return. If unspecified, defaults
|
369
369
|
# to 100. If a value greater than 100 is provided, at most 100 results are
|