google-cloud-discovery_engine-v1beta 0.20.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +27 -7
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +27 -7
- data/lib/google/cloud/discovery_engine/v1beta/rest.rb +1 -0
- data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +158 -38
- data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +158 -38
- data/lib/google/cloud/discovery_engine/v1beta/session_service/client.rb +920 -0
- data/lib/google/cloud/discovery_engine/v1beta/session_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1beta/session_service/paths.rb +330 -0
- data/lib/google/cloud/discovery_engine/v1beta/session_service/rest/client.rb +859 -0
- data/lib/google/cloud/discovery_engine/v1beta/session_service/rest/service_stub.rb +462 -0
- data/lib/google/cloud/discovery_engine/v1beta/session_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1beta/session_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1beta.rb +1 -0
- data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +4 -1
- data/lib/google/cloud/discoveryengine/v1beta/session_pb.rb +3 -1
- data/lib/google/cloud/discoveryengine/v1beta/session_service_pb.rb +49 -0
- data/lib/google/cloud/discoveryengine/v1beta/session_service_services_pb.rb +64 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +26 -5
- data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +140 -18
- data/proto_docs/google/cloud/discoveryengine/v1beta/session.rb +38 -4
- metadata +12 -3
@@ -210,7 +210,7 @@ module Google
|
|
210
210
|
# @param options [::Gapic::CallOptions, ::Hash]
|
211
211
|
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
212
212
|
#
|
213
|
-
# @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)
|
213
|
+
# @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, ranking_expression_backend: 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)
|
214
214
|
# Pass arguments to `search` via keyword arguments. Note that at
|
215
215
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
216
216
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -390,8 +390,14 @@ module Google
|
|
390
390
|
# The ranking expression controls the customized ranking on retrieval
|
391
391
|
# documents. This overrides
|
392
392
|
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#ranking_expression ServingConfig.ranking_expression}.
|
393
|
-
# The
|
394
|
-
#
|
393
|
+
# The syntax and supported features depend on the
|
394
|
+
# `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
395
|
+
# provided, it defaults to `RANK_BY_EMBEDDING`.
|
396
|
+
#
|
397
|
+
# If
|
398
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
399
|
+
# is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
400
|
+
# function or multiple functions that are joined by "+".
|
395
401
|
#
|
396
402
|
# * ranking_expression = function, { " + ", function };
|
397
403
|
#
|
@@ -406,13 +412,73 @@ module Google
|
|
406
412
|
# between query and document.
|
407
413
|
# * `embedding_field_path`: the document embedding field
|
408
414
|
# used with query embedding vector.
|
409
|
-
# * `dotProduct`: embedding function between embedding_field_path and
|
410
|
-
# embedding vector.
|
415
|
+
# * `dotProduct`: embedding function between `embedding_field_path` and
|
416
|
+
# query embedding vector.
|
411
417
|
#
|
412
418
|
# Example ranking expression:
|
413
419
|
#
|
414
420
|
# If document has an embedding field doc_embedding, the ranking expression
|
415
421
|
# could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
422
|
+
#
|
423
|
+
# If
|
424
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
425
|
+
# is set to `RANK_BY_FORMULA`, the following expression types (and
|
426
|
+
# combinations of those chained using + or
|
427
|
+
# * operators) are supported:
|
428
|
+
#
|
429
|
+
# * `double`
|
430
|
+
# * `signal`
|
431
|
+
# * `log(signal)`
|
432
|
+
# * `exp(signal)`
|
433
|
+
# * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
434
|
+
# argument being a denominator constant.
|
435
|
+
# * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
436
|
+
# * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
437
|
+
# signal2 | double, else returns signal1.
|
438
|
+
#
|
439
|
+
# Here are a few examples of ranking formulas that use the supported
|
440
|
+
# ranking expression types:
|
441
|
+
#
|
442
|
+
# - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
443
|
+
# -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
444
|
+
# `semantic_smilarity_score` adjustment.
|
445
|
+
# - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
446
|
+
# is_nan(keyword_similarity_score)` -- rank by the exponent of
|
447
|
+
# `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
448
|
+
# add constant 0.3 adjustment to the final score if
|
449
|
+
# `semantic_similarity_score` is NaN.
|
450
|
+
# - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
451
|
+
# rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
452
|
+
# of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
453
|
+
# of `semantic_smilarity_score`.
|
454
|
+
#
|
455
|
+
# The following signals are supported:
|
456
|
+
#
|
457
|
+
# * `semantic_similarity_score`: semantic similarity adjustment that is
|
458
|
+
# calculated using the embeddings generated by a proprietary Google model.
|
459
|
+
# This score determines how semantically similar a search query is to a
|
460
|
+
# document.
|
461
|
+
# * `keyword_similarity_score`: keyword match adjustment uses the Best
|
462
|
+
# Match 25 (BM25) ranking function. This score is calculated using a
|
463
|
+
# probabilistic model to estimate the probability that a document is
|
464
|
+
# relevant to a given query.
|
465
|
+
# * `relevance_score`: semantic relevance adjustment that uses a
|
466
|
+
# proprietary Google model to determine the meaning and intent behind a
|
467
|
+
# user's query in context with the content in the documents.
|
468
|
+
# * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
469
|
+
# predicted Click-through rate (pCTR) to gauge the relevance and
|
470
|
+
# attractiveness of a search result from a user's perspective. A higher
|
471
|
+
# pCTR suggests that the result is more likely to satisfy the user's query
|
472
|
+
# and intent, making it a valuable signal for ranking.
|
473
|
+
# * `freshness_rank`: freshness adjustment as a rank
|
474
|
+
# * `document_age`: The time in hours elapsed since the document was last
|
475
|
+
# updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
476
|
+
# * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
477
|
+
# Google model to determine the keyword-based overlap between the query and
|
478
|
+
# the document.
|
479
|
+
# * `base_rank`: the default rank of the result
|
480
|
+
# @param ranking_expression_backend [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::RankingExpressionBackend]
|
481
|
+
# The backend to use for the ranking expression evaluation.
|
416
482
|
# @param safe_search [::Boolean]
|
417
483
|
# Whether to turn on safe search. This is only supported for
|
418
484
|
# website search.
|
@@ -448,22 +514,16 @@ module Google
|
|
448
514
|
# between /search API calls and /answer API calls.
|
449
515
|
#
|
450
516
|
# Example #1 (multi-turn /search API calls):
|
451
|
-
#
|
452
|
-
#
|
453
|
-
#
|
454
|
-
#
|
455
|
-
#
|
456
|
-
# be interpreted as "How did Alphabet do in 2023?".
|
517
|
+
# Call /search API with the session ID generated in the first call.
|
518
|
+
# Here, the previous search query gets considered in query
|
519
|
+
# standing. I.e., if the first query is "How did Alphabet do in 2022?"
|
520
|
+
# and the current query is "How about 2023?", the current query will
|
521
|
+
# be interpreted as "How did Alphabet do in 2023?".
|
457
522
|
#
|
458
523
|
# Example #2 (coordination between /search API calls and /answer API calls):
|
459
|
-
#
|
460
|
-
#
|
461
|
-
#
|
462
|
-
# results from the first search call.
|
463
|
-
#
|
464
|
-
# Auto-session mode: when `projects/.../sessions/-` is used, a new session
|
465
|
-
# gets automatically created. Otherwise, users can use the create-session API
|
466
|
-
# to create a session manually.
|
524
|
+
# Call /answer API with the session ID generated in the first call.
|
525
|
+
# Here, the answer generation happens in the context of the search
|
526
|
+
# results from the first search call.
|
467
527
|
#
|
468
528
|
# Multi-turn Search feature is currently at private GA stage. Please use
|
469
529
|
# v1alpha or v1beta version instead before we launch this feature to public
|
@@ -578,7 +638,7 @@ module Google
|
|
578
638
|
# @param options [::Gapic::CallOptions, ::Hash]
|
579
639
|
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
580
640
|
#
|
581
|
-
# @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)
|
641
|
+
# @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, ranking_expression_backend: 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)
|
582
642
|
# Pass arguments to `search_lite` via keyword arguments. Note that at
|
583
643
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
584
644
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -758,8 +818,14 @@ module Google
|
|
758
818
|
# The ranking expression controls the customized ranking on retrieval
|
759
819
|
# documents. This overrides
|
760
820
|
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#ranking_expression ServingConfig.ranking_expression}.
|
761
|
-
# The
|
762
|
-
#
|
821
|
+
# The syntax and supported features depend on the
|
822
|
+
# `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
823
|
+
# provided, it defaults to `RANK_BY_EMBEDDING`.
|
824
|
+
#
|
825
|
+
# If
|
826
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
827
|
+
# is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
828
|
+
# function or multiple functions that are joined by "+".
|
763
829
|
#
|
764
830
|
# * ranking_expression = function, { " + ", function };
|
765
831
|
#
|
@@ -774,13 +840,73 @@ module Google
|
|
774
840
|
# between query and document.
|
775
841
|
# * `embedding_field_path`: the document embedding field
|
776
842
|
# used with query embedding vector.
|
777
|
-
# * `dotProduct`: embedding function between embedding_field_path and
|
778
|
-
# embedding vector.
|
843
|
+
# * `dotProduct`: embedding function between `embedding_field_path` and
|
844
|
+
# query embedding vector.
|
779
845
|
#
|
780
846
|
# Example ranking expression:
|
781
847
|
#
|
782
848
|
# If document has an embedding field doc_embedding, the ranking expression
|
783
849
|
# could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
850
|
+
#
|
851
|
+
# If
|
852
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
853
|
+
# is set to `RANK_BY_FORMULA`, the following expression types (and
|
854
|
+
# combinations of those chained using + or
|
855
|
+
# * operators) are supported:
|
856
|
+
#
|
857
|
+
# * `double`
|
858
|
+
# * `signal`
|
859
|
+
# * `log(signal)`
|
860
|
+
# * `exp(signal)`
|
861
|
+
# * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
862
|
+
# argument being a denominator constant.
|
863
|
+
# * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
864
|
+
# * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
865
|
+
# signal2 | double, else returns signal1.
|
866
|
+
#
|
867
|
+
# Here are a few examples of ranking formulas that use the supported
|
868
|
+
# ranking expression types:
|
869
|
+
#
|
870
|
+
# - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
871
|
+
# -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
872
|
+
# `semantic_smilarity_score` adjustment.
|
873
|
+
# - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
874
|
+
# is_nan(keyword_similarity_score)` -- rank by the exponent of
|
875
|
+
# `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
876
|
+
# add constant 0.3 adjustment to the final score if
|
877
|
+
# `semantic_similarity_score` is NaN.
|
878
|
+
# - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
879
|
+
# rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
880
|
+
# of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
881
|
+
# of `semantic_smilarity_score`.
|
882
|
+
#
|
883
|
+
# The following signals are supported:
|
884
|
+
#
|
885
|
+
# * `semantic_similarity_score`: semantic similarity adjustment that is
|
886
|
+
# calculated using the embeddings generated by a proprietary Google model.
|
887
|
+
# This score determines how semantically similar a search query is to a
|
888
|
+
# document.
|
889
|
+
# * `keyword_similarity_score`: keyword match adjustment uses the Best
|
890
|
+
# Match 25 (BM25) ranking function. This score is calculated using a
|
891
|
+
# probabilistic model to estimate the probability that a document is
|
892
|
+
# relevant to a given query.
|
893
|
+
# * `relevance_score`: semantic relevance adjustment that uses a
|
894
|
+
# proprietary Google model to determine the meaning and intent behind a
|
895
|
+
# user's query in context with the content in the documents.
|
896
|
+
# * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
897
|
+
# predicted Click-through rate (pCTR) to gauge the relevance and
|
898
|
+
# attractiveness of a search result from a user's perspective. A higher
|
899
|
+
# pCTR suggests that the result is more likely to satisfy the user's query
|
900
|
+
# and intent, making it a valuable signal for ranking.
|
901
|
+
# * `freshness_rank`: freshness adjustment as a rank
|
902
|
+
# * `document_age`: The time in hours elapsed since the document was last
|
903
|
+
# updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
904
|
+
# * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
905
|
+
# Google model to determine the keyword-based overlap between the query and
|
906
|
+
# the document.
|
907
|
+
# * `base_rank`: the default rank of the result
|
908
|
+
# @param ranking_expression_backend [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::RankingExpressionBackend]
|
909
|
+
# The backend to use for the ranking expression evaluation.
|
784
910
|
# @param safe_search [::Boolean]
|
785
911
|
# Whether to turn on safe search. This is only supported for
|
786
912
|
# website search.
|
@@ -816,22 +942,16 @@ module Google
|
|
816
942
|
# between /search API calls and /answer API calls.
|
817
943
|
#
|
818
944
|
# Example #1 (multi-turn /search API calls):
|
819
|
-
#
|
820
|
-
#
|
821
|
-
#
|
822
|
-
#
|
823
|
-
#
|
824
|
-
# be interpreted as "How did Alphabet do in 2023?".
|
945
|
+
# Call /search API with the session ID generated in the first call.
|
946
|
+
# Here, the previous search query gets considered in query
|
947
|
+
# standing. I.e., if the first query is "How did Alphabet do in 2022?"
|
948
|
+
# and the current query is "How about 2023?", the current query will
|
949
|
+
# be interpreted as "How did Alphabet do in 2023?".
|
825
950
|
#
|
826
951
|
# Example #2 (coordination between /search API calls and /answer API calls):
|
827
|
-
#
|
828
|
-
#
|
829
|
-
#
|
830
|
-
# results from the first search call.
|
831
|
-
#
|
832
|
-
# Auto-session mode: when `projects/.../sessions/-` is used, a new session
|
833
|
-
# gets automatically created. Otherwise, users can use the create-session API
|
834
|
-
# to create a session manually.
|
952
|
+
# Call /answer API with the session ID generated in the first call.
|
953
|
+
# Here, the answer generation happens in the context of the search
|
954
|
+
# results from the first search call.
|
835
955
|
#
|
836
956
|
# Multi-turn Search feature is currently at private GA stage. Please use
|
837
957
|
# v1alpha or v1beta version instead before we launch this feature to public
|