google-cloud-discovery_engine-v1 2.3.1 → 2.5.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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -4
  3. data/README.md +4 -4
  4. data/lib/google/cloud/discovery_engine/v1/assistant_service/client.rb +509 -0
  5. data/lib/google/cloud/discovery_engine/v1/assistant_service/credentials.rb +47 -0
  6. data/lib/google/cloud/discovery_engine/v1/assistant_service/paths.rb +169 -0
  7. data/lib/google/cloud/discovery_engine/v1/assistant_service/rest/client.rb +478 -0
  8. data/lib/google/cloud/discovery_engine/v1/assistant_service/rest/service_stub.rb +137 -0
  9. data/lib/google/cloud/discovery_engine/v1/assistant_service/rest.rb +52 -0
  10. data/lib/google/cloud/discovery_engine/v1/assistant_service.rb +55 -0
  11. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +16 -4
  12. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +16 -4
  13. data/lib/google/cloud/discovery_engine/v1/rest.rb +4 -2
  14. data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +204 -30
  15. data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +204 -30
  16. data/lib/google/cloud/discovery_engine/v1/session_service/client.rb +920 -0
  17. data/lib/google/cloud/discovery_engine/v1/session_service/credentials.rb +47 -0
  18. data/lib/google/cloud/discovery_engine/v1/session_service/paths.rb +330 -0
  19. data/lib/google/cloud/discovery_engine/v1/session_service/rest/client.rb +859 -0
  20. data/lib/google/cloud/discovery_engine/v1/session_service/rest/service_stub.rb +462 -0
  21. data/lib/google/cloud/discovery_engine/v1/session_service/rest.rb +52 -0
  22. data/lib/google/cloud/discovery_engine/v1/session_service.rb +55 -0
  23. data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +2 -2
  24. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +2 -2
  25. data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
  26. data/lib/google/cloud/discovery_engine/v1.rb +5 -3
  27. data/lib/google/cloud/discoveryengine/v1/assist_answer_pb.rb +59 -0
  28. data/lib/google/cloud/discoveryengine/v1/assistant_pb.rb +45 -0
  29. data/lib/google/cloud/discoveryengine/v1/assistant_service_pb.rb +62 -0
  30. data/lib/google/cloud/discoveryengine/v1/assistant_service_services_pb.rb +45 -0
  31. data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +4 -1
  32. data/lib/google/cloud/discoveryengine/v1/session_pb.rb +1 -1
  33. data/lib/google/cloud/discoveryengine/v1/session_service_pb.rb +49 -0
  34. data/lib/google/cloud/discoveryengine/v1/session_service_services_pb.rb +64 -0
  35. data/proto_docs/google/cloud/discoveryengine/v1/assist_answer.rb +278 -0
  36. data/proto_docs/google/cloud/discoveryengine/v1/assistant.rb +39 -0
  37. data/proto_docs/google/cloud/discoveryengine/v1/assistant_service.rb +207 -0
  38. data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +15 -3
  39. data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +164 -14
  40. data/proto_docs/google/cloud/discoveryengine/v1/session.rb +20 -4
  41. data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +2 -2
  42. metadata +26 -3
@@ -243,22 +243,16 @@ module Google
243
243
  # between /search API calls and /answer API calls.
244
244
  #
245
245
  # Example #1 (multi-turn /search API calls):
246
- # 1. Call /search API with the auto-session mode (see below).
247
- # 2. Call /search API with the session ID generated in the first call.
248
- # Here, the previous search query gets considered in query
249
- # standing. I.e., if the first query is "How did Alphabet do in 2022?"
250
- # and the current query is "How about 2023?", the current query will
251
- # be interpreted as "How did Alphabet do in 2023?".
246
+ # Call /search API with the session ID generated in the first call.
247
+ # Here, the previous search query gets considered in query
248
+ # standing. I.e., if the first query is "How did Alphabet do in 2022?"
249
+ # and the current query is "How about 2023?", the current query will
250
+ # be interpreted as "How did Alphabet do in 2023?".
252
251
  #
253
252
  # Example #2 (coordination between /search API calls and /answer API calls):
254
- # 1. Call /search API with the auto-session mode (see below).
255
- # 2. Call /answer API with the session ID generated in the first call.
256
- # Here, the answer generation happens in the context of the search
257
- # results from the first search call.
258
- #
259
- # Auto-session mode: when `projects/.../sessions/-` is used, a new session
260
- # gets automatically created. Otherwise, users can use the create-session API
261
- # to create a session manually.
253
+ # Call /answer API with the session ID generated in the first call.
254
+ # Here, the answer generation happens in the context of the search
255
+ # results from the first search call.
262
256
  #
263
257
  # Multi-turn Search feature is currently at private GA stage. Please use
264
258
  # v1alpha or v1beta version instead before we launch this feature to public
@@ -280,6 +274,101 @@ module Google
280
274
  # @!attribute [rw] relevance_score_spec
281
275
  # @return [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::RelevanceScoreSpec]
282
276
  # Optional. The specification for returning the relevance score.
277
+ # @!attribute [rw] ranking_expression
278
+ # @return [::String]
279
+ # The ranking expression controls the customized ranking on retrieval
280
+ # documents. This overrides
281
+ # {::Google::Cloud::DiscoveryEngine::V1::ServingConfig#ranking_expression ServingConfig.ranking_expression}.
282
+ # The syntax and supported features depend on the
283
+ # `ranking_expression_backend` value. If `ranking_expression_backend` is not
284
+ # provided, it defaults to `RANK_BY_EMBEDDING`.
285
+ #
286
+ # If
287
+ # {::Google::Cloud::DiscoveryEngine::V1::SearchRequest#ranking_expression_backend ranking_expression_backend}
288
+ # is not provided or set to `RANK_BY_EMBEDDING`, it should be a single
289
+ # function or multiple functions that are joined by "+".
290
+ #
291
+ # * ranking_expression = function, { " + ", function };
292
+ #
293
+ # Supported functions:
294
+ #
295
+ # * double * relevance_score
296
+ # * double * dotProduct(embedding_field_path)
297
+ #
298
+ # Function variables:
299
+ #
300
+ # * `relevance_score`: pre-defined keywords, used for measure relevance
301
+ # between query and document.
302
+ # * `embedding_field_path`: the document embedding field
303
+ # used with query embedding vector.
304
+ # * `dotProduct`: embedding function between `embedding_field_path` and
305
+ # query embedding vector.
306
+ #
307
+ # Example ranking expression:
308
+ #
309
+ # If document has an embedding field doc_embedding, the ranking expression
310
+ # could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
311
+ #
312
+ # If
313
+ # {::Google::Cloud::DiscoveryEngine::V1::SearchRequest#ranking_expression_backend ranking_expression_backend}
314
+ # is set to `RANK_BY_FORMULA`, the following expression types (and
315
+ # combinations of those chained using + or
316
+ # * operators) are supported:
317
+ #
318
+ # * `double`
319
+ # * `signal`
320
+ # * `log(signal)`
321
+ # * `exp(signal)`
322
+ # * `rr(signal, double > 0)` -- reciprocal rank transformation with second
323
+ # argument being a denominator constant.
324
+ # * `is_nan(signal)` -- returns 0 if signal is NaN, 1 otherwise.
325
+ # * `fill_nan(signal1, signal2 | double)` -- if signal1 is NaN, returns
326
+ # signal2 | double, else returns signal1.
327
+ #
328
+ # Here are a few examples of ranking formulas that use the supported
329
+ # ranking expression types:
330
+ #
331
+ # - `0.2 * semantic_similarity_score + 0.8 * log(keyword_similarity_score)`
332
+ # -- mostly rank by the logarithm of `keyword_similarity_score` with slight
333
+ # `semantic_smilarity_score` adjustment.
334
+ # - `0.2 * exp(fill_nan(semantic_similarity_score, 0)) + 0.3 *
335
+ # is_nan(keyword_similarity_score)` -- rank by the exponent of
336
+ # `semantic_similarity_score` filling the value with 0 if it's NaN, also
337
+ # add constant 0.3 adjustment to the final score if
338
+ # `semantic_similarity_score` is NaN.
339
+ # - `0.2 * rr(semantic_similarity_score, 16) + 0.8 *
340
+ # rr(keyword_similarity_score, 16)` -- mostly rank by the reciprocal rank
341
+ # of `keyword_similarity_score` with slight adjustment of reciprocal rank
342
+ # of `semantic_smilarity_score`.
343
+ #
344
+ # The following signals are supported:
345
+ #
346
+ # * `semantic_similarity_score`: semantic similarity adjustment that is
347
+ # calculated using the embeddings generated by a proprietary Google model.
348
+ # This score determines how semantically similar a search query is to a
349
+ # document.
350
+ # * `keyword_similarity_score`: keyword match adjustment uses the Best
351
+ # Match 25 (BM25) ranking function. This score is calculated using a
352
+ # probabilistic model to estimate the probability that a document is
353
+ # relevant to a given query.
354
+ # * `relevance_score`: semantic relevance adjustment that uses a
355
+ # proprietary Google model to determine the meaning and intent behind a
356
+ # user's query in context with the content in the documents.
357
+ # * `pctr_rank`: predicted conversion rate adjustment as a rank use
358
+ # predicted Click-through rate (pCTR) to gauge the relevance and
359
+ # attractiveness of a search result from a user's perspective. A higher
360
+ # pCTR suggests that the result is more likely to satisfy the user's query
361
+ # and intent, making it a valuable signal for ranking.
362
+ # * `freshness_rank`: freshness adjustment as a rank
363
+ # * `document_age`: The time in hours elapsed since the document was last
364
+ # updated, a floating-point number (e.g., 0.25 means 15 minutes).
365
+ # * `topicality_rank`: topicality adjustment as a rank. Uses proprietary
366
+ # Google model to determine the keyword-based overlap between the query and
367
+ # the document.
368
+ # * `base_rank`: the default rank of the result
369
+ # @!attribute [rw] ranking_expression_backend
370
+ # @return [::Google::Cloud::DiscoveryEngine::V1::SearchRequest::RankingExpressionBackend]
371
+ # The backend to use for the ranking expression evaluation.
283
372
  class SearchRequest
284
373
  include ::Google::Protobuf::MessageExts
285
374
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -1079,6 +1168,19 @@ module Google
1079
1168
  # High relevance threshold.
1080
1169
  HIGH = 4
1081
1170
  end
1171
+
1172
+ # The backend to use for the ranking expression evaluation.
1173
+ module RankingExpressionBackend
1174
+ # Default option for unspecified/unknown values.
1175
+ RANKING_EXPRESSION_BACKEND_UNSPECIFIED = 0
1176
+
1177
+ # Ranking by custom embedding model, the default way to evaluate the
1178
+ # ranking expression.
1179
+ RANK_BY_EMBEDDING = 3
1180
+
1181
+ # Ranking by custom formula.
1182
+ RANK_BY_FORMULA = 4
1183
+ end
1082
1184
  end
1083
1185
 
1084
1186
  # Response message for
@@ -1164,6 +1266,9 @@ module Google
1164
1266
  # @!attribute [r] model_scores
1165
1267
  # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::DiscoveryEngine::V1::DoubleList}]
1166
1268
  # Output only. Google provided available scores.
1269
+ # @!attribute [rw] rank_signals
1270
+ # @return [::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult::RankSignals]
1271
+ # A set of ranking signals associated with the result.
1167
1272
  class SearchResult
1168
1273
  include ::Google::Protobuf::MessageExts
1169
1274
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -1176,6 +1281,51 @@ module Google
1176
1281
  include ::Google::Protobuf::MessageExts
1177
1282
  extend ::Google::Protobuf::MessageExts::ClassMethods
1178
1283
  end
1284
+
1285
+ # A set of ranking signals.
1286
+ # @!attribute [rw] keyword_similarity_score
1287
+ # @return [::Float]
1288
+ # Keyword matching adjustment.
1289
+ # @!attribute [rw] relevance_score
1290
+ # @return [::Float]
1291
+ # Semantic relevance adjustment.
1292
+ # @!attribute [rw] semantic_similarity_score
1293
+ # @return [::Float]
1294
+ # Semantic similarity adjustment.
1295
+ # @!attribute [rw] pctr_rank
1296
+ # @return [::Float]
1297
+ # Predicted conversion rate adjustment as a rank.
1298
+ # @!attribute [rw] topicality_rank
1299
+ # @return [::Float]
1300
+ # Topicality adjustment as a rank.
1301
+ # @!attribute [rw] document_age
1302
+ # @return [::Float]
1303
+ # Age of the document in hours.
1304
+ # @!attribute [rw] boosting_factor
1305
+ # @return [::Float]
1306
+ # Combined custom boosts for a doc.
1307
+ # @!attribute [rw] default_rank
1308
+ # @return [::Float]
1309
+ # The default rank of the result.
1310
+ # @!attribute [rw] custom_signals
1311
+ # @return [::Array<::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult::RankSignals::CustomSignal>]
1312
+ # A list of custom clearbox signals.
1313
+ class RankSignals
1314
+ include ::Google::Protobuf::MessageExts
1315
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1316
+
1317
+ # Custom clearbox signal represented by name and value pair.
1318
+ # @!attribute [rw] name
1319
+ # @return [::String]
1320
+ # Name of the signal.
1321
+ # @!attribute [rw] value
1322
+ # @return [::Float]
1323
+ # Float value representing the ranking signal (e.g. 1.25 for BM25).
1324
+ class CustomSignal
1325
+ include ::Google::Protobuf::MessageExts
1326
+ extend ::Google::Protobuf::MessageExts::ClassMethods
1327
+ end
1328
+ end
1179
1329
  end
1180
1330
 
1181
1331
  # A facet result.
@@ -59,10 +59,11 @@ module Google
59
59
  # answer from service.
60
60
  # @!attribute [rw] query
61
61
  # @return [::Google::Cloud::DiscoveryEngine::V1::Query]
62
- # 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
63
64
  # @!attribute [rw] answer
64
65
  # @return [::String]
65
- # The resource name of the answer to the user query.
66
+ # Optional. The resource name of the answer to the user query.
66
67
  #
67
68
  # Only set if the answer generation (/answer API call) happened in this
68
69
  # turn.
@@ -74,9 +75,24 @@ module Google
74
75
  # {::Google::Cloud::DiscoveryEngine::V1::GetSessionRequest#include_answer_details GetSessionRequest.include_answer_details}
75
76
  # is set to true, this field will be populated when getting answer query
76
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.
77
84
  class Turn
78
85
  include ::Google::Protobuf::MessageExts
79
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
80
96
  end
81
97
 
82
98
  # Enumeration of the state of the session.
@@ -93,9 +109,9 @@ module Google
93
109
  # @!attribute [rw] text
94
110
  # @return [::String]
95
111
  # Plain text.
96
- # @!attribute [rw] query_id
112
+ # @!attribute [r] query_id
97
113
  # @return [::String]
98
- # Unique Id for the query.
114
+ # Output only. Unique Id for the query.
99
115
  class Query
100
116
  include ::Google::Protobuf::MessageExts
101
117
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -30,7 +30,7 @@ module Google
30
30
  # is:
31
31
  # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
32
32
  # If the write user event action is applied in
33
- # `::Google::Cloud::Location::Location` level, for example, the event
33
+ # [Location][google.cloud.location.Location] level, for example, the event
34
34
  # with {::Google::Cloud::DiscoveryEngine::V1::Document Document} across multiple
35
35
  # {::Google::Cloud::DiscoveryEngine::V1::DataStore DataStore}, the format is:
36
36
  # `projects/{project}/locations/{location}`.
@@ -55,7 +55,7 @@ module Google
55
55
  # is:
56
56
  # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
57
57
  # If the collect user event action is applied in
58
- # `::Google::Cloud::Location::Location` level, for example, the event
58
+ # [Location][google.cloud.location.Location] level, for example, the event
59
59
  # with {::Google::Cloud::DiscoveryEngine::V1::Document Document} across multiple
60
60
  # {::Google::Cloud::DiscoveryEngine::V1::DataStore DataStore}, the format is:
61
61
  # `projects/{project}/locations/{location}`.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-discovery_engine-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.5.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.0'
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.0'
25
+ version: '1.2'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: google-cloud-errors
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -65,6 +65,13 @@ files:
65
65
  - README.md
66
66
  - lib/google-cloud-discovery_engine-v1.rb
67
67
  - lib/google/cloud/discovery_engine/v1.rb
68
+ - lib/google/cloud/discovery_engine/v1/assistant_service.rb
69
+ - lib/google/cloud/discovery_engine/v1/assistant_service/client.rb
70
+ - lib/google/cloud/discovery_engine/v1/assistant_service/credentials.rb
71
+ - lib/google/cloud/discovery_engine/v1/assistant_service/paths.rb
72
+ - lib/google/cloud/discovery_engine/v1/assistant_service/rest.rb
73
+ - lib/google/cloud/discovery_engine/v1/assistant_service/rest/client.rb
74
+ - lib/google/cloud/discovery_engine/v1/assistant_service/rest/service_stub.rb
68
75
  - lib/google/cloud/discovery_engine/v1/cmek_config_service.rb
69
76
  - lib/google/cloud/discovery_engine/v1/cmek_config_service/client.rb
70
77
  - lib/google/cloud/discovery_engine/v1/cmek_config_service/credentials.rb
@@ -196,6 +203,13 @@ files:
196
203
  - lib/google/cloud/discovery_engine/v1/serving_config_service/rest.rb
197
204
  - lib/google/cloud/discovery_engine/v1/serving_config_service/rest/client.rb
198
205
  - lib/google/cloud/discovery_engine/v1/serving_config_service/rest/service_stub.rb
206
+ - lib/google/cloud/discovery_engine/v1/session_service.rb
207
+ - lib/google/cloud/discovery_engine/v1/session_service/client.rb
208
+ - lib/google/cloud/discovery_engine/v1/session_service/credentials.rb
209
+ - lib/google/cloud/discovery_engine/v1/session_service/paths.rb
210
+ - lib/google/cloud/discovery_engine/v1/session_service/rest.rb
211
+ - lib/google/cloud/discovery_engine/v1/session_service/rest/client.rb
212
+ - lib/google/cloud/discovery_engine/v1/session_service/rest/service_stub.rb
199
213
  - lib/google/cloud/discovery_engine/v1/site_search_engine_service.rb
200
214
  - lib/google/cloud/discovery_engine/v1/site_search_engine_service/client.rb
201
215
  - lib/google/cloud/discovery_engine/v1/site_search_engine_service/credentials.rb
@@ -225,6 +239,10 @@ files:
225
239
  - lib/google/cloud/discovery_engine/v1/user_license_service/rest/service_stub.rb
226
240
  - lib/google/cloud/discovery_engine/v1/version.rb
227
241
  - lib/google/cloud/discoveryengine/v1/answer_pb.rb
242
+ - lib/google/cloud/discoveryengine/v1/assist_answer_pb.rb
243
+ - lib/google/cloud/discoveryengine/v1/assistant_pb.rb
244
+ - lib/google/cloud/discoveryengine/v1/assistant_service_pb.rb
245
+ - lib/google/cloud/discoveryengine/v1/assistant_service_services_pb.rb
228
246
  - lib/google/cloud/discoveryengine/v1/chunk_pb.rb
229
247
  - lib/google/cloud/discoveryengine/v1/cmek_config_service_pb.rb
230
248
  - lib/google/cloud/discoveryengine/v1/cmek_config_service_services_pb.rb
@@ -276,6 +294,8 @@ files:
276
294
  - lib/google/cloud/discoveryengine/v1/serving_config_service_pb.rb
277
295
  - lib/google/cloud/discoveryengine/v1/serving_config_service_services_pb.rb
278
296
  - lib/google/cloud/discoveryengine/v1/session_pb.rb
297
+ - lib/google/cloud/discoveryengine/v1/session_service_pb.rb
298
+ - lib/google/cloud/discoveryengine/v1/session_service_services_pb.rb
279
299
  - lib/google/cloud/discoveryengine/v1/site_search_engine_pb.rb
280
300
  - lib/google/cloud/discoveryengine/v1/site_search_engine_service_pb.rb
281
301
  - lib/google/cloud/discoveryengine/v1/site_search_engine_service_services_pb.rb
@@ -292,6 +312,9 @@ files:
292
312
  - proto_docs/google/api/launch_stage.rb
293
313
  - proto_docs/google/api/resource.rb
294
314
  - proto_docs/google/cloud/discoveryengine/v1/answer.rb
315
+ - proto_docs/google/cloud/discoveryengine/v1/assist_answer.rb
316
+ - proto_docs/google/cloud/discoveryengine/v1/assistant.rb
317
+ - proto_docs/google/cloud/discoveryengine/v1/assistant_service.rb
295
318
  - proto_docs/google/cloud/discoveryengine/v1/chunk.rb
296
319
  - proto_docs/google/cloud/discoveryengine/v1/cmek_config_service.rb
297
320
  - proto_docs/google/cloud/discoveryengine/v1/common.rb