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
@@ -223,8 +223,14 @@ module Google
|
|
223
223
|
# The ranking expression controls the customized ranking on retrieval
|
224
224
|
# documents. This overrides
|
225
225
|
# {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#ranking_expression ServingConfig.ranking_expression}.
|
226
|
-
# The
|
227
|
-
#
|
226
|
+
# The syntax and supported features depend on the
|
227
|
+
# `ranking_expression_backend` value. If `ranking_expression_backend` is not
|
228
|
+
# provided, it defaults to `RANK_BY_EMBEDDING`.
|
229
|
+
#
|
230
|
+
# If
|
231
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
232
|
+
# is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
|
233
|
+
# function or multiple functions that are joined by "+".
|
228
234
|
#
|
229
235
|
# * ranking_expression = function, { " + ", function };
|
230
236
|
#
|
@@ -239,13 +245,74 @@ module Google
|
|
239
245
|
# between query and document.
|
240
246
|
# * `embedding_field_path`: the document embedding field
|
241
247
|
# used with query embedding vector.
|
242
|
-
# * `dotProduct`: embedding function between embedding_field_path and
|
243
|
-
# embedding vector.
|
248
|
+
# * `dotProduct`: embedding function between `embedding_field_path` and
|
249
|
+
# query embedding vector.
|
244
250
|
#
|
245
251
|
# Example ranking expression:
|
246
252
|
#
|
247
253
|
# If document has an embedding field doc_embedding, the ranking expression
|
248
254
|
# could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
|
255
|
+
#
|
256
|
+
# If
|
257
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#ranking_expression_backend ranking_expression_backend}
|
258
|
+
# is set to `RANK_BY_FORMULA`, the following expression types (and
|
259
|
+
# combinations of those chained using + or
|
260
|
+
# * operators) are supported:
|
261
|
+
#
|
262
|
+
# * `double`
|
263
|
+
# * `signal`
|
264
|
+
# * `log(signal)`
|
265
|
+
# * `exp(signal)`
|
266
|
+
# * `rr(signal, double > 0)` -- reciprocal rank transformation with second
|
267
|
+
# argument being a denominator constant.
|
268
|
+
# * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
|
269
|
+
# * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
|
270
|
+
# signal2 | double, else returns signal1.
|
271
|
+
#
|
272
|
+
# Here are a few examples of ranking formulas that use the supported
|
273
|
+
# ranking expression types:
|
274
|
+
#
|
275
|
+
# - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
|
276
|
+
# -- mostly rank by the logarithm of `keyword_similarity_score` with slight
|
277
|
+
# `semantic_smilarity_score` adjustment.
|
278
|
+
# - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
|
279
|
+
# is_nan(keyword_similarity_score)` -- rank by the exponent of
|
280
|
+
# `semantic_similarity_score` filling the value with 0 if it's NaN, also
|
281
|
+
# add constant 0.3 adjustment to the final score if
|
282
|
+
# `semantic_similarity_score` is NaN.
|
283
|
+
# - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
|
284
|
+
# rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
|
285
|
+
# of `keyword_similarity_score` with slight adjustment of reciprocal rank
|
286
|
+
# of `semantic_smilarity_score`.
|
287
|
+
#
|
288
|
+
# The following signals are supported:
|
289
|
+
#
|
290
|
+
# * `semantic_similarity_score`: semantic similarity adjustment that is
|
291
|
+
# calculated using the embeddings generated by a proprietary Google model.
|
292
|
+
# This score determines how semantically similar a search query is to a
|
293
|
+
# document.
|
294
|
+
# * `keyword_similarity_score`: keyword match adjustment uses the Best
|
295
|
+
# Match 25 (BM25) ranking function. This score is calculated using a
|
296
|
+
# probabilistic model to estimate the probability that a document is
|
297
|
+
# relevant to a given query.
|
298
|
+
# * `relevance_score`: semantic relevance adjustment that uses a
|
299
|
+
# proprietary Google model to determine the meaning and intent behind a
|
300
|
+
# user's query in context with the content in the documents.
|
301
|
+
# * `pctr_rank`: predicted conversion rate adjustment as a rank use
|
302
|
+
# predicted Click-through rate (pCTR) to gauge the relevance and
|
303
|
+
# attractiveness of a search result from a user's perspective. A higher
|
304
|
+
# pCTR suggests that the result is more likely to satisfy the user's query
|
305
|
+
# and intent, making it a valuable signal for ranking.
|
306
|
+
# * `freshness_rank`: freshness adjustment as a rank
|
307
|
+
# * `document_age`: The time in hours elapsed since the document was last
|
308
|
+
# updated, a floating-point number (e.g., 0.25 means 15 minutes).
|
309
|
+
# * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
|
310
|
+
# Google model to determine the keyword-based overlap between the query and
|
311
|
+
# the document.
|
312
|
+
# * `base_rank`: the default rank of the result
|
313
|
+
# @!attribute [rw] ranking_expression_backend
|
314
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::RankingExpressionBackend]
|
315
|
+
# The backend to use for the ranking expression evaluation.
|
249
316
|
# @!attribute [rw] safe_search
|
250
317
|
# @return [::Boolean]
|
251
318
|
# Whether to turn on safe search. This is only supported for
|
@@ -286,22 +353,16 @@ module Google
|
|
286
353
|
# between /search API calls and /answer API calls.
|
287
354
|
#
|
288
355
|
# Example #1 (multi-turn /search API calls):
|
289
|
-
#
|
290
|
-
#
|
291
|
-
#
|
292
|
-
#
|
293
|
-
#
|
294
|
-
# be interpreted as "How did Alphabet do in 2023?".
|
356
|
+
# Call /search API with the session ID generated in the first call.
|
357
|
+
# Here, the previous search query gets considered in query
|
358
|
+
# standing. I.e., if the first query is "How did Alphabet do in 2022?"
|
359
|
+
# and the current query is "How about 2023?", the current query will
|
360
|
+
# be interpreted as "How did Alphabet do in 2023?".
|
295
361
|
#
|
296
362
|
# Example #2 (coordination between /search API calls and /answer API calls):
|
297
|
-
#
|
298
|
-
#
|
299
|
-
#
|
300
|
-
# results from the first search call.
|
301
|
-
#
|
302
|
-
# Auto-session mode: when `projects/.../sessions/-` is used, a new session
|
303
|
-
# gets automatically created. Otherwise, users can use the create-session API
|
304
|
-
# to create a session manually.
|
363
|
+
# Call /answer API with the session ID generated in the first call.
|
364
|
+
# Here, the answer generation happens in the context of the search
|
365
|
+
# results from the first search call.
|
305
366
|
#
|
306
367
|
# Multi-turn Search feature is currently at private GA stage. Please use
|
307
368
|
# v1alpha or v1beta version instead before we launch this feature to public
|
@@ -1159,6 +1220,19 @@ module Google
|
|
1159
1220
|
# High relevance threshold.
|
1160
1221
|
HIGH = 4
|
1161
1222
|
end
|
1223
|
+
|
1224
|
+
# The backend to use for the ranking expression evaluation.
|
1225
|
+
module RankingExpressionBackend
|
1226
|
+
# Default option for unspecified/unknown values.
|
1227
|
+
RANKING_EXPRESSION_BACKEND_UNSPECIFIED = 0
|
1228
|
+
|
1229
|
+
# Ranking by custom embedding model, the default way to evaluate the
|
1230
|
+
# ranking expression.
|
1231
|
+
RANK_BY_EMBEDDING = 3
|
1232
|
+
|
1233
|
+
# Ranking by custom formula.
|
1234
|
+
RANK_BY_FORMULA = 4
|
1235
|
+
end
|
1162
1236
|
end
|
1163
1237
|
|
1164
1238
|
# Response message for
|
@@ -1257,6 +1331,9 @@ module Google
|
|
1257
1331
|
# @!attribute [rw] model_scores
|
1258
1332
|
# @return [::Google::Protobuf::Map{::String => ::Google::Cloud::DiscoveryEngine::V1beta::DoubleList}]
|
1259
1333
|
# Google provided available scores.
|
1334
|
+
# @!attribute [rw] rank_signals
|
1335
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult::RankSignals]
|
1336
|
+
# A set of ranking signals associated with the result.
|
1260
1337
|
class SearchResult
|
1261
1338
|
include ::Google::Protobuf::MessageExts
|
1262
1339
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -1269,6 +1346,51 @@ module Google
|
|
1269
1346
|
include ::Google::Protobuf::MessageExts
|
1270
1347
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1271
1348
|
end
|
1349
|
+
|
1350
|
+
# A set of ranking signals.
|
1351
|
+
# @!attribute [rw] keyword_similarity_score
|
1352
|
+
# @return [::Float]
|
1353
|
+
# Keyword matching adjustment.
|
1354
|
+
# @!attribute [rw] relevance_score
|
1355
|
+
# @return [::Float]
|
1356
|
+
# Semantic relevance adjustment.
|
1357
|
+
# @!attribute [rw] semantic_similarity_score
|
1358
|
+
# @return [::Float]
|
1359
|
+
# Semantic similarity adjustment.
|
1360
|
+
# @!attribute [rw] pctr_rank
|
1361
|
+
# @return [::Float]
|
1362
|
+
# Predicted conversion rate adjustment as a rank.
|
1363
|
+
# @!attribute [rw] topicality_rank
|
1364
|
+
# @return [::Float]
|
1365
|
+
# Topicality adjustment as a rank.
|
1366
|
+
# @!attribute [rw] document_age
|
1367
|
+
# @return [::Float]
|
1368
|
+
# Age of the document in hours.
|
1369
|
+
# @!attribute [rw] boosting_factor
|
1370
|
+
# @return [::Float]
|
1371
|
+
# Combined custom boosts for a doc.
|
1372
|
+
# @!attribute [rw] default_rank
|
1373
|
+
# @return [::Float]
|
1374
|
+
# The default rank of the result.
|
1375
|
+
# @!attribute [rw] custom_signals
|
1376
|
+
# @return [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult::RankSignals::CustomSignal>]
|
1377
|
+
# A list of custom clearbox signals.
|
1378
|
+
class RankSignals
|
1379
|
+
include ::Google::Protobuf::MessageExts
|
1380
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1381
|
+
|
1382
|
+
# Custom clearbox signal represented by name and value pair.
|
1383
|
+
# @!attribute [rw] name
|
1384
|
+
# @return [::String]
|
1385
|
+
# Name of the signal.
|
1386
|
+
# @!attribute [rw] value
|
1387
|
+
# @return [::Float]
|
1388
|
+
# Float value representing the ranking signal (e.g. 1.25 for BM25).
|
1389
|
+
class CustomSignal
|
1390
|
+
include ::Google::Protobuf::MessageExts
|
1391
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
1392
|
+
end
|
1393
|
+
end
|
1272
1394
|
end
|
1273
1395
|
|
1274
1396
|
# A facet result.
|
@@ -26,6 +26,12 @@ module Google
|
|
26
26
|
# @return [::String]
|
27
27
|
# Immutable. Fully qualified name
|
28
28
|
# `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*`
|
29
|
+
# @!attribute [rw] display_name
|
30
|
+
# @return [::String]
|
31
|
+
# Optional. The display name of the session.
|
32
|
+
#
|
33
|
+
# This field is used to identify the session in the UI.
|
34
|
+
# By default, the display name is the first turn query text in the session.
|
29
35
|
# @!attribute [rw] state
|
30
36
|
# @return [::Google::Cloud::DiscoveryEngine::V1beta::Session::State]
|
31
37
|
# The state of the session.
|
@@ -41,6 +47,10 @@ module Google
|
|
41
47
|
# @!attribute [r] end_time
|
42
48
|
# @return [::Google::Protobuf::Timestamp]
|
43
49
|
# Output only. The time the session finished.
|
50
|
+
# @!attribute [rw] is_pinned
|
51
|
+
# @return [::Boolean]
|
52
|
+
# Optional. Whether the session is pinned, pinned session will be displayed
|
53
|
+
# on the top of the session list.
|
44
54
|
class Session
|
45
55
|
include ::Google::Protobuf::MessageExts
|
46
56
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
@@ -49,16 +59,40 @@ module Google
|
|
49
59
|
# answer from service.
|
50
60
|
# @!attribute [rw] query
|
51
61
|
# @return [::Google::Cloud::DiscoveryEngine::V1beta::Query]
|
52
|
-
# The user query.
|
62
|
+
# Optional. The user query. May not be set if this turn is merely
|
63
|
+
# regenerating an answer to a different turn
|
53
64
|
# @!attribute [rw] answer
|
54
65
|
# @return [::String]
|
55
|
-
# The resource name of the answer to the user query.
|
66
|
+
# Optional. The resource name of the answer to the user query.
|
56
67
|
#
|
57
68
|
# Only set if the answer generation (/answer API call) happened in this
|
58
69
|
# turn.
|
70
|
+
# @!attribute [r] detailed_answer
|
71
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::Answer]
|
72
|
+
# Output only. In
|
73
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client#get_session ConversationalSearchService.GetSession}
|
74
|
+
# API, if
|
75
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::GetSessionRequest#include_answer_details GetSessionRequest.include_answer_details}
|
76
|
+
# is set to true, this field will be populated when getting answer query
|
77
|
+
# session.
|
78
|
+
# @!attribute [rw] query_config
|
79
|
+
# @return [::Google::Protobuf::Map{::String => ::String}]
|
80
|
+
# Optional. Represents metadata related to the query config, for example
|
81
|
+
# LLM model and version used, model parameters (temperature, grounding
|
82
|
+
# parameters, etc.). The prefix "google." is reserved for Google-developed
|
83
|
+
# functionality.
|
59
84
|
class Turn
|
60
85
|
include ::Google::Protobuf::MessageExts
|
61
86
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
87
|
+
|
88
|
+
# @!attribute [rw] key
|
89
|
+
# @return [::String]
|
90
|
+
# @!attribute [rw] value
|
91
|
+
# @return [::String]
|
92
|
+
class QueryConfigEntry
|
93
|
+
include ::Google::Protobuf::MessageExts
|
94
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
95
|
+
end
|
62
96
|
end
|
63
97
|
|
64
98
|
# Enumeration of the state of the session.
|
@@ -75,9 +109,9 @@ module Google
|
|
75
109
|
# @!attribute [rw] text
|
76
110
|
# @return [::String]
|
77
111
|
# Plain text.
|
78
|
-
# @!attribute [
|
112
|
+
# @!attribute [r] query_id
|
79
113
|
# @return [::String]
|
80
|
-
# Unique Id for the query.
|
114
|
+
# Output only. Unique Id for the query.
|
81
115
|
class Query
|
82
116
|
include ::Google::Protobuf::MessageExts
|
83
117
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-discovery_engine-v1beta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
@@ -15,14 +15,14 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: '1.
|
18
|
+
version: '1.2'
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: '1.
|
25
|
+
version: '1.2'
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: google-cloud-errors
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -204,6 +204,13 @@ files:
|
|
204
204
|
- lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest.rb
|
205
205
|
- lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/client.rb
|
206
206
|
- lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/service_stub.rb
|
207
|
+
- lib/google/cloud/discovery_engine/v1beta/session_service.rb
|
208
|
+
- lib/google/cloud/discovery_engine/v1beta/session_service/client.rb
|
209
|
+
- lib/google/cloud/discovery_engine/v1beta/session_service/credentials.rb
|
210
|
+
- lib/google/cloud/discovery_engine/v1beta/session_service/paths.rb
|
211
|
+
- lib/google/cloud/discovery_engine/v1beta/session_service/rest.rb
|
212
|
+
- lib/google/cloud/discovery_engine/v1beta/session_service/rest/client.rb
|
213
|
+
- lib/google/cloud/discovery_engine/v1beta/session_service/rest/service_stub.rb
|
207
214
|
- lib/google/cloud/discovery_engine/v1beta/site_search_engine_service.rb
|
208
215
|
- lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/client.rb
|
209
216
|
- lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/credentials.rb
|
@@ -278,6 +285,8 @@ files:
|
|
278
285
|
- lib/google/cloud/discoveryengine/v1beta/serving_config_service_pb.rb
|
279
286
|
- lib/google/cloud/discoveryengine/v1beta/serving_config_service_services_pb.rb
|
280
287
|
- lib/google/cloud/discoveryengine/v1beta/session_pb.rb
|
288
|
+
- lib/google/cloud/discoveryengine/v1beta/session_service_pb.rb
|
289
|
+
- lib/google/cloud/discoveryengine/v1beta/session_service_services_pb.rb
|
281
290
|
- lib/google/cloud/discoveryengine/v1beta/site_search_engine_pb.rb
|
282
291
|
- lib/google/cloud/discoveryengine/v1beta/site_search_engine_service_pb.rb
|
283
292
|
- lib/google/cloud/discoveryengine/v1beta/site_search_engine_service_services_pb.rb
|