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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78e275b33576c302ab8e440d1c9163966b8d2fc2161ed9ad7c0dd7713d0f646d
|
4
|
+
data.tar.gz: 1c667b21e7349f66746ff44468c0dc048970d4992d0744b767ca76d8567109b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17395001fae5b28121556691832d9ef5be24ab74cd05d6c8bf9a7f81699b2c360f37f6eb2975b340bb68622fea5d40be0dbef145641ea15ab9e5b38168f6d219
|
7
|
+
data.tar.gz: 9ad1d72c052d58339762023545c6b5731ea5f47a400b58ac4742dc57736403b1e0f081a6638267dc020ba44d4ba2078f4662966435fee46a014ee61d74d9cbb9
|
@@ -1355,7 +1355,7 @@ module Google
|
|
1355
1355
|
# @param options [::Gapic::CallOptions, ::Hash]
|
1356
1356
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1357
1357
|
#
|
1358
|
-
# @overload get_session(name: nil)
|
1358
|
+
# @overload get_session(name: nil, include_answer_details: nil)
|
1359
1359
|
# Pass arguments to `get_session` via keyword arguments. Note that at
|
1360
1360
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
1361
1361
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -1363,6 +1363,9 @@ module Google
|
|
1363
1363
|
# @param name [::String]
|
1364
1364
|
# Required. The resource name of the Session to get. Format:
|
1365
1365
|
# `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}`
|
1366
|
+
# @param include_answer_details [::Boolean]
|
1367
|
+
# Optional. If set to true, the full session including all answer details
|
1368
|
+
# will be returned.
|
1366
1369
|
#
|
1367
1370
|
# @yield [response, operation] Access the result along with the RPC operation
|
1368
1371
|
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::Session]
|
@@ -1457,22 +1460,39 @@ module Google
|
|
1457
1460
|
# A page token, received from a previous `ListSessions` call.
|
1458
1461
|
# Provide this to retrieve the subsequent page.
|
1459
1462
|
# @param filter [::String]
|
1460
|
-
# A
|
1461
|
-
#
|
1462
|
-
#
|
1463
|
-
#
|
1463
|
+
# A comma-separated list of fields to filter by, in EBNF grammar.
|
1464
|
+
# The supported fields are:
|
1465
|
+
# * `user_pseudo_id`
|
1466
|
+
# * `state`
|
1467
|
+
# * `display_name`
|
1468
|
+
# * `starred`
|
1469
|
+
# * `is_pinned`
|
1470
|
+
# * `labels`
|
1471
|
+
# * `create_time`
|
1472
|
+
# * `update_time`
|
1473
|
+
#
|
1474
|
+
# Examples:
|
1464
1475
|
# "user_pseudo_id = some_id"
|
1476
|
+
# "display_name = \"some_name\""
|
1477
|
+
# "starred = true"
|
1478
|
+
# "is_pinned=true AND (NOT labels:hidden)"
|
1479
|
+
# "create_time > \"1970-01-01T12:00:00Z\""
|
1465
1480
|
# @param order_by [::String]
|
1466
1481
|
# A comma-separated list of fields to order by, sorted in ascending order.
|
1467
1482
|
# Use "desc" after a field name for descending.
|
1468
1483
|
# Supported fields:
|
1484
|
+
#
|
1469
1485
|
# * `update_time`
|
1470
1486
|
# * `create_time`
|
1471
1487
|
# * `session_name`
|
1488
|
+
# * `is_pinned`
|
1472
1489
|
#
|
1473
1490
|
# Example:
|
1474
|
-
#
|
1475
|
-
# "
|
1491
|
+
#
|
1492
|
+
# * "update_time desc"
|
1493
|
+
# * "create_time"
|
1494
|
+
# * "is_pinned desc,update_time desc": list sessions by is_pinned first, then
|
1495
|
+
# by update_time.
|
1476
1496
|
#
|
1477
1497
|
# @yield [response, operation] Access the result along with the RPC operation
|
1478
1498
|
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Session>]
|
@@ -1271,7 +1271,7 @@ module Google
|
|
1271
1271
|
# @param options [::Gapic::CallOptions, ::Hash]
|
1272
1272
|
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1273
1273
|
#
|
1274
|
-
# @overload get_session(name: nil)
|
1274
|
+
# @overload get_session(name: nil, include_answer_details: nil)
|
1275
1275
|
# Pass arguments to `get_session` via keyword arguments. Note that at
|
1276
1276
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
1277
1277
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -1279,6 +1279,9 @@ module Google
|
|
1279
1279
|
# @param name [::String]
|
1280
1280
|
# Required. The resource name of the Session to get. Format:
|
1281
1281
|
# `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}`
|
1282
|
+
# @param include_answer_details [::Boolean]
|
1283
|
+
# Optional. If set to true, the full session including all answer details
|
1284
|
+
# will be returned.
|
1282
1285
|
# @yield [result, operation] Access the result along with the TransportOperation object
|
1283
1286
|
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Session]
|
1284
1287
|
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
@@ -1366,22 +1369,39 @@ module Google
|
|
1366
1369
|
# A page token, received from a previous `ListSessions` call.
|
1367
1370
|
# Provide this to retrieve the subsequent page.
|
1368
1371
|
# @param filter [::String]
|
1369
|
-
# A
|
1370
|
-
#
|
1371
|
-
#
|
1372
|
-
#
|
1372
|
+
# A comma-separated list of fields to filter by, in EBNF grammar.
|
1373
|
+
# The supported fields are:
|
1374
|
+
# * `user_pseudo_id`
|
1375
|
+
# * `state`
|
1376
|
+
# * `display_name`
|
1377
|
+
# * `starred`
|
1378
|
+
# * `is_pinned`
|
1379
|
+
# * `labels`
|
1380
|
+
# * `create_time`
|
1381
|
+
# * `update_time`
|
1382
|
+
#
|
1383
|
+
# Examples:
|
1373
1384
|
# "user_pseudo_id = some_id"
|
1385
|
+
# "display_name = \"some_name\""
|
1386
|
+
# "starred = true"
|
1387
|
+
# "is_pinned=true AND (NOT labels:hidden)"
|
1388
|
+
# "create_time > \"1970-01-01T12:00:00Z\""
|
1374
1389
|
# @param order_by [::String]
|
1375
1390
|
# A comma-separated list of fields to order by, sorted in ascending order.
|
1376
1391
|
# Use "desc" after a field name for descending.
|
1377
1392
|
# Supported fields:
|
1393
|
+
#
|
1378
1394
|
# * `update_time`
|
1379
1395
|
# * `create_time`
|
1380
1396
|
# * `session_name`
|
1397
|
+
# * `is_pinned`
|
1381
1398
|
#
|
1382
1399
|
# Example:
|
1383
|
-
#
|
1384
|
-
# "
|
1400
|
+
#
|
1401
|
+
# * "update_time desc"
|
1402
|
+
# * "create_time"
|
1403
|
+
# * "is_pinned desc,update_time desc": list sessions by is_pinned first, then
|
1404
|
+
# by update_time.
|
1385
1405
|
# @yield [result, operation] Access the result along with the TransportOperation object
|
1386
1406
|
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Session>]
|
1387
1407
|
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
@@ -33,6 +33,7 @@ require "google/cloud/discovery_engine/v1beta/sample_query_set_service/rest"
|
|
33
33
|
require "google/cloud/discovery_engine/v1beta/schema_service/rest"
|
34
34
|
require "google/cloud/discovery_engine/v1beta/search_tuning_service/rest"
|
35
35
|
require "google/cloud/discovery_engine/v1beta/serving_config_service/rest"
|
36
|
+
require "google/cloud/discovery_engine/v1beta/session_service/rest"
|
36
37
|
require "google/cloud/discovery_engine/v1beta/site_search_engine_service/rest"
|
37
38
|
require "google/cloud/discovery_engine/v1beta/user_event_service/rest"
|
38
39
|
require "google/cloud/discovery_engine/v1beta/version"
|
@@ -217,7 +217,7 @@ module Google
|
|
217
217
|
# @param options [::Gapic::CallOptions, ::Hash]
|
218
218
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
219
219
|
#
|
220
|
-
# @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)
|
220
|
+
# @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)
|
221
221
|
# Pass arguments to `search` via keyword arguments. Note that at
|
222
222
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
223
223
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -397,8 +397,14 @@ module Google
|
|
397
397
|
# The ranking expression controls the customized ranking on retrieval
|
398
398
|
# documents. This overrides
|
399
399
|
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#ranking_expression ServingConfig.ranking_expression}.
|
400
|
-
# The
|
401
|
-
#
|
400
|
+
# The syntax and supported features depend on the
|
401
|
+
# `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
402
|
+
# provided, it defaults to `RANK_BY_EMBEDDING`.
|
403
|
+
#
|
404
|
+
# If
|
405
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
406
|
+
# is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
407
|
+
# function or multiple functions that are joined by "+".
|
402
408
|
#
|
403
409
|
# * ranking_expression = function, { " + ", function };
|
404
410
|
#
|
@@ -413,13 +419,73 @@ module Google
|
|
413
419
|
# between query and document.
|
414
420
|
# * `embedding_field_path`: the document embedding field
|
415
421
|
# used with query embedding vector.
|
416
|
-
# * `dotProduct`: embedding function between embedding_field_path and
|
417
|
-
# embedding vector.
|
422
|
+
# * `dotProduct`: embedding function between `embedding_field_path` and
|
423
|
+
# query embedding vector.
|
418
424
|
#
|
419
425
|
# Example ranking expression:
|
420
426
|
#
|
421
427
|
# If document has an embedding field doc_embedding, the ranking expression
|
422
428
|
# could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
429
|
+
#
|
430
|
+
# If
|
431
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
432
|
+
# is set to `RANK_BY_FORMULA`, the following expression types (and
|
433
|
+
# combinations of those chained using + or
|
434
|
+
# * operators) are supported:
|
435
|
+
#
|
436
|
+
# * `double`
|
437
|
+
# * `signal`
|
438
|
+
# * `log(signal)`
|
439
|
+
# * `exp(signal)`
|
440
|
+
# * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
441
|
+
# argument being a denominator constant.
|
442
|
+
# * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
443
|
+
# * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
444
|
+
# signal2 | double, else returns signal1.
|
445
|
+
#
|
446
|
+
# Here are a few examples of ranking formulas that use the supported
|
447
|
+
# ranking expression types:
|
448
|
+
#
|
449
|
+
# - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
450
|
+
# -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
451
|
+
# `semantic_smilarity_score` adjustment.
|
452
|
+
# - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
453
|
+
# is_nan(keyword_similarity_score)` -- rank by the exponent of
|
454
|
+
# `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
455
|
+
# add constant 0.3 adjustment to the final score if
|
456
|
+
# `semantic_similarity_score` is NaN.
|
457
|
+
# - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
458
|
+
# rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
459
|
+
# of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
460
|
+
# of `semantic_smilarity_score`.
|
461
|
+
#
|
462
|
+
# The following signals are supported:
|
463
|
+
#
|
464
|
+
# * `semantic_similarity_score`: semantic similarity adjustment that is
|
465
|
+
# calculated using the embeddings generated by a proprietary Google model.
|
466
|
+
# This score determines how semantically similar a search query is to a
|
467
|
+
# document.
|
468
|
+
# * `keyword_similarity_score`: keyword match adjustment uses the Best
|
469
|
+
# Match 25 (BM25) ranking function. This score is calculated using a
|
470
|
+
# probabilistic model to estimate the probability that a document is
|
471
|
+
# relevant to a given query.
|
472
|
+
# * `relevance_score`: semantic relevance adjustment that uses a
|
473
|
+
# proprietary Google model to determine the meaning and intent behind a
|
474
|
+
# user's query in context with the content in the documents.
|
475
|
+
# * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
476
|
+
# predicted Click-through rate (pCTR) to gauge the relevance and
|
477
|
+
# attractiveness of a search result from a user's perspective. A higher
|
478
|
+
# pCTR suggests that the result is more likely to satisfy the user's query
|
479
|
+
# and intent, making it a valuable signal for ranking.
|
480
|
+
# * `freshness_rank`: freshness adjustment as a rank
|
481
|
+
# * `document_age`: The time in hours elapsed since the document was last
|
482
|
+
# updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
483
|
+
# * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
484
|
+
# Google model to determine the keyword-based overlap between the query and
|
485
|
+
# the document.
|
486
|
+
# * `base_rank`: the default rank of the result
|
487
|
+
# @param ranking_expression_backend [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::RankingExpressionBackend]
|
488
|
+
# The backend to use for the ranking expression evaluation.
|
423
489
|
# @param safe_search [::Boolean]
|
424
490
|
# Whether to turn on safe search. This is only supported for
|
425
491
|
# website search.
|
@@ -455,22 +521,16 @@ module Google
|
|
455
521
|
# between /search API calls and /answer API calls.
|
456
522
|
#
|
457
523
|
# Example #1 (multi-turn /search API calls):
|
458
|
-
#
|
459
|
-
#
|
460
|
-
#
|
461
|
-
#
|
462
|
-
#
|
463
|
-
# be interpreted as "How did Alphabet do in 2023?".
|
524
|
+
# Call /search API with the session ID generated in the first call.
|
525
|
+
# Here, the previous search query gets considered in query
|
526
|
+
# standing. I.e., if the first query is "How did Alphabet do in 2022?"
|
527
|
+
# and the current query is "How about 2023?", the current query will
|
528
|
+
# be interpreted as "How did Alphabet do in 2023?".
|
464
529
|
#
|
465
530
|
# Example #2 (coordination between /search API calls and /answer API calls):
|
466
|
-
#
|
467
|
-
#
|
468
|
-
#
|
469
|
-
# results from the first search call.
|
470
|
-
#
|
471
|
-
# Auto-session mode: when `projects/.../sessions/-` is used, a new session
|
472
|
-
# gets automatically created. Otherwise, users can use the create-session API
|
473
|
-
# to create a session manually.
|
531
|
+
# Call /answer API with the session ID generated in the first call.
|
532
|
+
# Here, the answer generation happens in the context of the search
|
533
|
+
# results from the first search call.
|
474
534
|
#
|
475
535
|
# Multi-turn Search feature is currently at private GA stage. Please use
|
476
536
|
# v1alpha or v1beta version instead before we launch this feature to public
|
@@ -592,7 +652,7 @@ module Google
|
|
592
652
|
# @param options [::Gapic::CallOptions, ::Hash]
|
593
653
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
594
654
|
#
|
595
|
-
# @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)
|
655
|
+
# @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)
|
596
656
|
# Pass arguments to `search_lite` via keyword arguments. Note that at
|
597
657
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
598
658
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -772,8 +832,14 @@ module Google
|
|
772
832
|
# The ranking expression controls the customized ranking on retrieval
|
773
833
|
# documents. This overrides
|
774
834
|
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#ranking_expression ServingConfig.ranking_expression}.
|
775
|
-
# The
|
776
|
-
#
|
835
|
+
# The syntax and supported features depend on the
|
836
|
+
# `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
837
|
+
# provided, it defaults to `RANK_BY_EMBEDDING`.
|
838
|
+
#
|
839
|
+
# If
|
840
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
841
|
+
# is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
842
|
+
# function or multiple functions that are joined by "+".
|
777
843
|
#
|
778
844
|
# * ranking_expression = function, { " + ", function };
|
779
845
|
#
|
@@ -788,13 +854,73 @@ module Google
|
|
788
854
|
# between query and document.
|
789
855
|
# * `embedding_field_path`: the document embedding field
|
790
856
|
# used with query embedding vector.
|
791
|
-
# * `dotProduct`: embedding function between embedding_field_path and
|
792
|
-
# embedding vector.
|
857
|
+
# * `dotProduct`: embedding function between `embedding_field_path` and
|
858
|
+
# query embedding vector.
|
793
859
|
#
|
794
860
|
# Example ranking expression:
|
795
861
|
#
|
796
862
|
# If document has an embedding field doc_embedding, the ranking expression
|
797
863
|
# could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
864
|
+
#
|
865
|
+
# If
|
866
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
867
|
+
# is set to `RANK_BY_FORMULA`, the following expression types (and
|
868
|
+
# combinations of those chained using + or
|
869
|
+
# * operators) are supported:
|
870
|
+
#
|
871
|
+
# * `double`
|
872
|
+
# * `signal`
|
873
|
+
# * `log(signal)`
|
874
|
+
# * `exp(signal)`
|
875
|
+
# * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
876
|
+
# argument being a denominator constant.
|
877
|
+
# * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
878
|
+
# * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
879
|
+
# signal2 | double, else returns signal1.
|
880
|
+
#
|
881
|
+
# Here are a few examples of ranking formulas that use the supported
|
882
|
+
# ranking expression types:
|
883
|
+
#
|
884
|
+
# - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
885
|
+
# -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
886
|
+
# `semantic_smilarity_score` adjustment.
|
887
|
+
# - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
888
|
+
# is_nan(keyword_similarity_score)` -- rank by the exponent of
|
889
|
+
# `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
890
|
+
# add constant 0.3 adjustment to the final score if
|
891
|
+
# `semantic_similarity_score` is NaN.
|
892
|
+
# - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
893
|
+
# rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
894
|
+
# of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
895
|
+
# of `semantic_smilarity_score`.
|
896
|
+
#
|
897
|
+
# The following signals are supported:
|
898
|
+
#
|
899
|
+
# * `semantic_similarity_score`: semantic similarity adjustment that is
|
900
|
+
# calculated using the embeddings generated by a proprietary Google model.
|
901
|
+
# This score determines how semantically similar a search query is to a
|
902
|
+
# document.
|
903
|
+
# * `keyword_similarity_score`: keyword match adjustment uses the Best
|
904
|
+
# Match 25 (BM25) ranking function. This score is calculated using a
|
905
|
+
# probabilistic model to estimate the probability that a document is
|
906
|
+
# relevant to a given query.
|
907
|
+
# * `relevance_score`: semantic relevance adjustment that uses a
|
908
|
+
# proprietary Google model to determine the meaning and intent behind a
|
909
|
+
# user's query in context with the content in the documents.
|
910
|
+
# * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
911
|
+
# predicted Click-through rate (pCTR) to gauge the relevance and
|
912
|
+
# attractiveness of a search result from a user's perspective. A higher
|
913
|
+
# pCTR suggests that the result is more likely to satisfy the user's query
|
914
|
+
# and intent, making it a valuable signal for ranking.
|
915
|
+
# * `freshness_rank`: freshness adjustment as a rank
|
916
|
+
# * `document_age`: The time in hours elapsed since the document was last
|
917
|
+
# updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
918
|
+
# * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
919
|
+
# Google model to determine the keyword-based overlap between the query and
|
920
|
+
# the document.
|
921
|
+
# * `base_rank`: the default rank of the result
|
922
|
+
# @param ranking_expression_backend [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::RankingExpressionBackend]
|
923
|
+
# The backend to use for the ranking expression evaluation.
|
798
924
|
# @param safe_search [::Boolean]
|
799
925
|
# Whether to turn on safe search. This is only supported for
|
800
926
|
# website search.
|
@@ -830,22 +956,16 @@ module Google
|
|
830
956
|
# between /search API calls and /answer API calls.
|
831
957
|
#
|
832
958
|
# Example #1 (multi-turn /search API calls):
|
833
|
-
#
|
834
|
-
#
|
835
|
-
#
|
836
|
-
#
|
837
|
-
#
|
838
|
-
# be interpreted as "How did Alphabet do in 2023?".
|
959
|
+
# Call /search API with the session ID generated in the first call.
|
960
|
+
# Here, the previous search query gets considered in query
|
961
|
+
# standing. I.e., if the first query is "How did Alphabet do in 2022?"
|
962
|
+
# and the current query is "How about 2023?", the current query will
|
963
|
+
# be interpreted as "How did Alphabet do in 2023?".
|
839
964
|
#
|
840
965
|
# Example #2 (coordination between /search API calls and /answer API calls):
|
841
|
-
#
|
842
|
-
#
|
843
|
-
#
|
844
|
-
# results from the first search call.
|
845
|
-
#
|
846
|
-
# Auto-session mode: when `projects/.../sessions/-` is used, a new session
|
847
|
-
# gets automatically created. Otherwise, users can use the create-session API
|
848
|
-
# to create a session manually.
|
966
|
+
# Call /answer API with the session ID generated in the first call.
|
967
|
+
# Here, the answer generation happens in the context of the search
|
968
|
+
# results from the first search call.
|
849
969
|
#
|
850
970
|
# Multi-turn Search feature is currently at private GA stage. Please use
|
851
971
|
# v1alpha or v1beta version instead before we launch this feature to public
|