google-cloud-discovery_engine-v1beta 0.15.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +186 -6
  4. data/lib/google/cloud/discovery_engine/v1beta/completion_service/operations.rb +12 -15
  5. data/lib/google/cloud/discovery_engine/v1beta/completion_service/paths.rb +62 -0
  6. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +179 -6
  7. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/operations.rb +43 -38
  8. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/service_stub.rb +131 -31
  9. data/lib/google/cloud/discovery_engine/v1beta/control_service/client.rb +35 -12
  10. data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/client.rb +35 -12
  11. data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/service_stub.rb +54 -32
  12. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +48 -27
  13. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +48 -27
  14. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/service_stub.rb +118 -80
  15. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/client.rb +31 -6
  16. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/operations.rb +12 -15
  17. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/client.rb +31 -6
  18. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/operations.rb +43 -38
  19. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/service_stub.rb +54 -32
  20. data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +31 -9
  21. data/lib/google/cloud/discovery_engine/v1beta/document_service/operations.rb +12 -15
  22. data/lib/google/cloud/discovery_engine/v1beta/document_service/paths.rb +25 -0
  23. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +31 -9
  24. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +43 -38
  25. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/service_stub.rb +78 -50
  26. data/lib/google/cloud/discovery_engine/v1beta/engine_service/client.rb +35 -12
  27. data/lib/google/cloud/discovery_engine/v1beta/engine_service/operations.rb +12 -15
  28. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/client.rb +35 -12
  29. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/operations.rb +43 -38
  30. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/service_stub.rb +78 -50
  31. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/client.rb +31 -5
  32. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/operations.rb +12 -15
  33. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/client.rb +31 -5
  34. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/operations.rb +43 -38
  35. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/service_stub.rb +46 -26
  36. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/client.rb +244 -6
  37. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/paths.rb +85 -0
  38. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/client.rb +152 -6
  39. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/service_stub.rb +83 -7
  40. data/lib/google/cloud/discovery_engine/v1beta/project_service/client.rb +29 -2
  41. data/lib/google/cloud/discovery_engine/v1beta/project_service/operations.rb +12 -15
  42. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/client.rb +29 -2
  43. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/operations.rb +43 -38
  44. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/service_stub.rb +22 -8
  45. data/lib/google/cloud/discovery_engine/v1beta/rank_service/client.rb +29 -3
  46. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/client.rb +29 -3
  47. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/service_stub.rb +22 -8
  48. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/client.rb +28 -2
  49. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/client.rb +28 -2
  50. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/service_stub.rb +22 -8
  51. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/client.rb +30 -7
  52. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/operations.rb +12 -15
  53. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/client.rb +30 -7
  54. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/operations.rb +43 -38
  55. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/service_stub.rb +62 -38
  56. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/client.rb +29 -6
  57. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/client.rb +29 -6
  58. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/service_stub.rb +54 -32
  59. data/lib/google/cloud/discovery_engine/v1beta/schema_service/client.rb +32 -6
  60. data/lib/google/cloud/discovery_engine/v1beta/schema_service/operations.rb +12 -15
  61. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/client.rb +32 -6
  62. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +43 -38
  63. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/service_stub.rb +54 -32
  64. data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +427 -3
  65. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +417 -3
  66. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/service_stub.rb +99 -7
  67. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/client.rb +29 -3
  68. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/operations.rb +12 -15
  69. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/client.rb +29 -3
  70. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/operations.rb +43 -38
  71. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/service_stub.rb +30 -14
  72. data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/client.rb +31 -6
  73. data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/client.rb +31 -6
  74. data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/service_stub.rb +38 -20
  75. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/client.rb +361 -14
  76. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/operations.rb +12 -15
  77. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/paths.rb +49 -0
  78. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/client.rb +340 -14
  79. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/operations.rb +43 -38
  80. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/service_stub.rb +308 -73
  81. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +31 -6
  82. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/operations.rb +12 -15
  83. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +31 -6
  84. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +43 -38
  85. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/service_stub.rb +46 -26
  86. data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
  87. data/lib/google/cloud/discoveryengine/v1beta/answer_pb.rb +1 -1
  88. data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +1 -1
  89. data/lib/google/cloud/discoveryengine/v1beta/completion_service_pb.rb +18 -1
  90. data/lib/google/cloud/discoveryengine/v1beta/completion_service_services_pb.rb +2 -0
  91. data/lib/google/cloud/discoveryengine/v1beta/control_pb.rb +1 -1
  92. data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +4 -1
  93. data/lib/google/cloud/discoveryengine/v1beta/custom_tuning_model_pb.rb +1 -1
  94. data/lib/google/cloud/discoveryengine/v1beta/data_store_pb.rb +7 -1
  95. data/lib/google/cloud/discoveryengine/v1beta/document_service_pb.rb +2 -1
  96. data/lib/google/cloud/discoveryengine/v1beta/engine_pb.rb +1 -1
  97. data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_pb.rb +24 -1
  98. data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_services_pb.rb +4 -0
  99. data/lib/google/cloud/discoveryengine/v1beta/grounding_pb.rb +2 -1
  100. data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +3 -1
  101. data/lib/google/cloud/discoveryengine/v1beta/search_service_services_pb.rb +14 -0
  102. data/lib/google/cloud/discoveryengine/v1beta/serving_config_pb.rb +2 -2
  103. data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_pb.rb +2 -1
  104. data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_service_pb.rb +10 -1
  105. data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_service_services_pb.rb +7 -0
  106. data/lib/google/cloud/discoveryengine/v1beta/user_event_pb.rb +1 -1
  107. data/proto_docs/google/api/client.rb +39 -0
  108. data/proto_docs/google/cloud/discoveryengine/v1beta/answer.rb +20 -6
  109. data/proto_docs/google/cloud/discoveryengine/v1beta/completion_service.rb +268 -0
  110. data/proto_docs/google/cloud/discoveryengine/v1beta/control.rb +9 -0
  111. data/proto_docs/google/cloud/discoveryengine/v1beta/control_service.rb +6 -6
  112. data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +95 -15
  113. data/proto_docs/google/cloud/discoveryengine/v1beta/custom_tuning_model.rb +8 -3
  114. data/proto_docs/google/cloud/discoveryengine/v1beta/data_store.rb +131 -0
  115. data/proto_docs/google/cloud/discoveryengine/v1beta/document_processing_config.rb +7 -5
  116. data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +19 -0
  117. data/proto_docs/google/cloud/discoveryengine/v1beta/engine.rb +5 -1
  118. data/proto_docs/google/cloud/discoveryengine/v1beta/engine_service.rb +4 -4
  119. data/proto_docs/google/cloud/discoveryengine/v1beta/grounded_generation_service.rb +396 -1
  120. data/proto_docs/google/cloud/discoveryengine/v1beta/grounding.rb +10 -0
  121. data/proto_docs/google/cloud/discoveryengine/v1beta/project.rb +1 -1
  122. data/proto_docs/google/cloud/discoveryengine/v1beta/purge_config.rb +1 -1
  123. data/proto_docs/google/cloud/discoveryengine/v1beta/rank_service.rb +1 -1
  124. data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +71 -0
  125. data/proto_docs/google/cloud/discoveryengine/v1beta/serving_config.rb +16 -0
  126. data/proto_docs/google/cloud/discoveryengine/v1beta/serving_config_service.rb +2 -2
  127. data/proto_docs/google/cloud/discoveryengine/v1beta/site_search_engine.rb +17 -0
  128. data/proto_docs/google/cloud/discoveryengine/v1beta/site_search_engine_service.rb +147 -1
  129. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +9 -1
  130. data/proto_docs/google/longrunning/operations.rb +19 -14
  131. metadata +5 -5
@@ -30,7 +30,8 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
34
35
  # These require statements are intentionally placed here to initialize
35
36
  # the REST modules only when it's required.
36
37
  require "gapic/rest"
@@ -40,7 +41,9 @@ module Google
40
41
  universe_domain: universe_domain,
41
42
  credentials: credentials,
42
43
  numeric_enums: true,
43
- raise_faraday_errors: false
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
44
47
  end
45
48
 
46
49
  ##
@@ -61,6 +64,15 @@ module Google
61
64
  @client_stub.endpoint
62
65
  end
63
66
 
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
64
76
  ##
65
77
  # Baseline implementation for the get_schema REST call
66
78
  #
@@ -87,16 +99,18 @@ module Google
87
99
 
88
100
  response = @client_stub.make_http_request(
89
101
  verb,
90
- uri: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "get_schema",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::DiscoveryEngine::V1beta::Schema.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
100
114
  end
101
115
 
102
116
  ##
@@ -125,16 +139,18 @@ module Google
125
139
 
126
140
  response = @client_stub.make_http_request(
127
141
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "list_schemas",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::DiscoveryEngine::V1beta::ListSchemasResponse.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -163,16 +179,18 @@ module Google
163
179
 
164
180
  response = @client_stub.make_http_request(
165
181
  verb,
166
- uri: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "create_schema",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
190
+ catch :response do
191
+ yield result, operation if block_given?
192
+ result
193
+ end
176
194
  end
177
195
 
178
196
  ##
@@ -201,16 +219,18 @@ module Google
201
219
 
202
220
  response = @client_stub.make_http_request(
203
221
  verb,
204
- uri: uri,
205
- body: body || "",
206
- params: query_string_params,
222
+ uri: uri,
223
+ body: body || "",
224
+ params: query_string_params,
225
+ method_name: "update_schema",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
211
-
212
- yield result, operation if block_given?
213
- result
230
+ catch :response do
231
+ yield result, operation if block_given?
232
+ result
233
+ end
214
234
  end
215
235
 
216
236
  ##
@@ -239,16 +259,18 @@ module Google
239
259
 
240
260
  response = @client_stub.make_http_request(
241
261
  verb,
242
- uri: uri,
243
- body: body || "",
244
- params: query_string_params,
262
+ uri: uri,
263
+ body: body || "",
264
+ params: query_string_params,
265
+ method_name: "delete_schema",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
249
-
250
- yield result, operation if block_given?
251
- result
270
+ catch :response do
271
+ yield result, operation if block_given?
272
+ result
273
+ end
252
274
  end
253
275
 
254
276
  ##
@@ -163,14 +163,26 @@ module Google
163
163
  universe_domain: @config.universe_domain,
164
164
  channel_args: @config.channel_args,
165
165
  interceptors: @config.interceptors,
166
- channel_pool_config: @config.channel_pool
166
+ channel_pool_config: @config.channel_pool,
167
+ logger: @config.logger
167
168
  )
168
169
 
170
+ @search_service_stub.stub_logger&.info do |entry|
171
+ entry.set_system_name
172
+ entry.set_service
173
+ entry.message = "Created client for #{entry.service}"
174
+ entry.set_credentials_fields credentials
175
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
176
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
177
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
178
+ end
179
+
169
180
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
170
181
  config.credentials = credentials
171
182
  config.quota_project = @quota_project_id
172
183
  config.endpoint = @search_service_stub.endpoint
173
184
  config.universe_domain = @search_service_stub.universe_domain
185
+ config.logger = @search_service_stub.logger if config.respond_to? :logger=
174
186
  end
175
187
  end
176
188
 
@@ -181,6 +193,15 @@ module Google
181
193
  #
182
194
  attr_reader :location_client
183
195
 
196
+ ##
197
+ # The logger used for request/response debug logging.
198
+ #
199
+ # @return [Logger]
200
+ #
201
+ def logger
202
+ @search_service_stub.logger
203
+ end
204
+
184
205
  # Service calls
185
206
 
186
207
  ##
@@ -196,7 +217,7 @@ module Google
196
217
  # @param options [::Gapic::CallOptions, ::Hash]
197
218
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
198
219
  #
199
- # @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, relevance_threshold: 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, 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)
200
221
  # Pass arguments to `search` via keyword arguments. Note that at
201
222
  # least one keyword argument is required. To specify no parameters, or to keep all
202
223
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -246,6 +267,10 @@ module Google
246
267
  # is unset.
247
268
  #
248
269
  # If this field is negative, an `INVALID_ARGUMENT` is returned.
270
+ # @param one_box_page_size [::Integer]
271
+ # The maximum number of results to return for OneBox.
272
+ # This applies to each OneBox type individually.
273
+ # Default number is 10.
249
274
  # @param data_store_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::DataStoreSpec, ::Hash>]
250
275
  # Specs defining dataStores to filter on in a search call and configurations
251
276
  # for those dataStores. This is only considered for engines with multiple
@@ -460,6 +485,17 @@ module Google
460
485
  # Default to Google defined threshold, leveraging a balance of
461
486
  # precision and recall to deliver both highly accurate results and
462
487
  # comprehensive coverage of relevant information.
488
+ # @param personalization_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::PersonalizationSpec, ::Hash]
489
+ # The specification for personalization.
490
+ #
491
+ # Notice that if both
492
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}
493
+ # and
494
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
495
+ # are set,
496
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
497
+ # overrides
498
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}.
463
499
  #
464
500
  # @yield [response, operation] Access the result along with the RPC operation
465
501
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult>]
@@ -525,7 +561,382 @@ module Google
525
561
  @search_service_stub.call_rpc :search, request, options: options do |response, operation|
526
562
  response = ::Gapic::PagedEnumerable.new @search_service_stub, :search, request, response, operation, options
527
563
  yield response, operation if block_given?
528
- return response
564
+ throw :response, response
565
+ end
566
+ rescue ::GRPC::BadStatus => e
567
+ raise ::Google::Cloud::Error.from_error(e)
568
+ end
569
+
570
+ ##
571
+ # Performs a search. Similar to the
572
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client#search SearchService.Search}
573
+ # method, but a lite version that allows API key for authentication, where
574
+ # OAuth and IAM checks are not required.
575
+ #
576
+ # Only public website search is supported by this method. If data stores and
577
+ # engines not associated with public website search are specified, a
578
+ # `FAILED_PRECONDITION` error is returned.
579
+ #
580
+ # This method can be used for easy onboarding without having to implement an
581
+ # authentication backend. However, it is strongly recommended to use
582
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client#search SearchService.Search}
583
+ # instead with required OAuth and IAM checks to provide better data security.
584
+ #
585
+ # @overload search_lite(request, options = nil)
586
+ # Pass arguments to `search_lite` via a request object, either of type
587
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest} or an equivalent Hash.
588
+ #
589
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest, ::Hash]
590
+ # A request object representing the call parameters. Required. To specify no
591
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
592
+ # @param options [::Gapic::CallOptions, ::Hash]
593
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
594
+ #
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)
596
+ # Pass arguments to `search_lite` via keyword arguments. Note that at
597
+ # least one keyword argument is required. To specify no parameters, or to keep all
598
+ # the default parameter values, pass an empty Hash as a request object (see above).
599
+ #
600
+ # @param serving_config [::String]
601
+ # Required. The resource name of the Search serving config, such as
602
+ # `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`,
603
+ # or
604
+ # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config`.
605
+ # This field is used to identify the serving configuration name, set
606
+ # of models used to make the search.
607
+ # @param branch [::String]
608
+ # The branch resource name, such as
609
+ # `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/branches/0`.
610
+ #
611
+ # Use `default_branch` as the branch ID or leave this field empty, to search
612
+ # documents under the default branch.
613
+ # @param query [::String]
614
+ # Raw search query.
615
+ # @param image_query [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ImageQuery, ::Hash]
616
+ # Raw image query.
617
+ # @param page_size [::Integer]
618
+ # Maximum number of {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s
619
+ # to return. The maximum allowed value depends on the data type. Values above
620
+ # the maximum value are coerced to the maximum value.
621
+ #
622
+ # * Websites with basic indexing: Default `10`, Maximum `25`.
623
+ # * Websites with advanced indexing: Default `25`, Maximum `50`.
624
+ # * Other: Default `50`, Maximum `100`.
625
+ #
626
+ # If this field is negative, an `INVALID_ARGUMENT` is returned.
627
+ # @param page_token [::String]
628
+ # A page token received from a previous
629
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client#search SearchService.Search}
630
+ # call. Provide this to retrieve the subsequent page.
631
+ #
632
+ # When paginating, all other parameters provided to
633
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client#search SearchService.Search}
634
+ # must match the call that provided the page token. Otherwise, an
635
+ # `INVALID_ARGUMENT` error is returned.
636
+ # @param offset [::Integer]
637
+ # A 0-indexed integer that specifies the current offset (that is, starting
638
+ # result location, amongst the
639
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s deemed by the API
640
+ # as relevant) in search results. This field is only considered if
641
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#page_token page_token}
642
+ # is unset.
643
+ #
644
+ # If this field is negative, an `INVALID_ARGUMENT` is returned.
645
+ # @param one_box_page_size [::Integer]
646
+ # The maximum number of results to return for OneBox.
647
+ # This applies to each OneBox type individually.
648
+ # Default number is 10.
649
+ # @param data_store_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::DataStoreSpec, ::Hash>]
650
+ # Specs defining dataStores to filter on in a search call and configurations
651
+ # for those dataStores. This is only considered for engines with multiple
652
+ # dataStores use case. For single dataStore within an engine, they should
653
+ # use the specs at the top level.
654
+ # @param filter [::String]
655
+ # The filter syntax consists of an expression language for constructing a
656
+ # predicate from one or more fields of the documents being filtered. Filter
657
+ # expression is case-sensitive.
658
+ #
659
+ # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
660
+ #
661
+ # Filtering in Vertex AI Search is done by mapping the LHS filter key to a
662
+ # key property defined in the Vertex AI Search backend -- this mapping is
663
+ # defined by the customer in their schema. For example a media customer might
664
+ # have a field 'name' in their schema. In this case the filter would look
665
+ # like this: filter --> name:'ANY("king kong")'
666
+ #
667
+ # For more information about filtering including syntax and filter
668
+ # operators, see
669
+ # [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)
670
+ # @param canonical_filter [::String]
671
+ # The default filter that is applied when a user performs a search without
672
+ # checking any filters on the search page.
673
+ #
674
+ # The filter applied to every search request when quality improvement such as
675
+ # query expansion is needed. In the case a query does not have a sufficient
676
+ # amount of results this filter will be used to determine whether or not to
677
+ # enable the query expansion flow. The original filter will still be used for
678
+ # the query expanded search.
679
+ # This field is strongly recommended to achieve high search quality.
680
+ #
681
+ # For more information about filter syntax, see
682
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#filter SearchRequest.filter}.
683
+ # @param order_by [::String]
684
+ # The order in which documents are returned. Documents can be ordered by
685
+ # a field in an {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}
686
+ # object. Leave it unset if ordered by relevance. `order_by` expression is
687
+ # case-sensitive.
688
+ #
689
+ # For more information on ordering the website search results, see
690
+ # [Order web search
691
+ # results](https://cloud.google.com/generative-ai-app-builder/docs/order-web-search-results).
692
+ # For more information on ordering the healthcare search results, see
693
+ # [Order healthcare search
694
+ # results](https://cloud.google.com/generative-ai-app-builder/docs/order-hc-results).
695
+ # If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
696
+ # @param user_info [::Google::Cloud::DiscoveryEngine::V1beta::UserInfo, ::Hash]
697
+ # Information about the end user.
698
+ # Highly recommended for analytics.
699
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UserInfo#user_agent UserInfo.user_agent}
700
+ # is used to deduce `device_type` for analytics.
701
+ # @param language_code [::String]
702
+ # The BCP-47 language code, such as "en-US" or "sr-Latn". For more
703
+ # information, see [Standard
704
+ # fields](https://cloud.google.com/apis/design/standard_fields). This field
705
+ # helps to better interpret the query. If a value isn't specified, the query
706
+ # language code is automatically detected, which may not be accurate.
707
+ # @param region_code [::String]
708
+ # The Unicode country/region code (CLDR) of a location, such as "US" and
709
+ # "419". For more information, see [Standard
710
+ # fields](https://cloud.google.com/apis/design/standard_fields). If set,
711
+ # then results will be boosted based on the region_code provided.
712
+ # @param facet_specs [::Array<::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::FacetSpec, ::Hash>]
713
+ # Facet specifications for faceted search. If empty, no facets are returned.
714
+ #
715
+ # A maximum of 100 values are allowed. Otherwise, an `INVALID_ARGUMENT`
716
+ # error is returned.
717
+ # @param boost_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::BoostSpec, ::Hash]
718
+ # Boost specification to boost certain documents.
719
+ # For more information on boosting, see
720
+ # [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results)
721
+ # @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}]
722
+ # Additional search parameters.
723
+ #
724
+ # For public website search only, supported values are:
725
+ #
726
+ # * `user_country_code`: string. Default empty. If set to non-empty, results
727
+ # are restricted or boosted based on the location provided.
728
+ # For example, `user_country_code: "au"`
729
+ #
730
+ # For available codes see [Country
731
+ # Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes)
732
+ #
733
+ # * `search_type`: double. Default empty. Enables non-webpage searching
734
+ # depending on the value. The only valid non-default value is 1,
735
+ # which enables image searching.
736
+ # For example, `search_type: 1`
737
+ # @param query_expansion_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::QueryExpansionSpec, ::Hash]
738
+ # The query expansion specification that specifies the conditions under which
739
+ # query expansion occurs.
740
+ # @param spell_correction_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SpellCorrectionSpec, ::Hash]
741
+ # The spell correction specification that specifies the mode under
742
+ # which spell correction takes effect.
743
+ # @param user_pseudo_id [::String]
744
+ # A unique identifier for tracking visitors. For example, this could be
745
+ # implemented with an HTTP cookie, which should be able to uniquely identify
746
+ # a visitor on a single device. This unique identifier should not change if
747
+ # the visitor logs in or out of the website.
748
+ #
749
+ # This field should NOT have a fixed value such as `unknown_visitor`.
750
+ #
751
+ # This should be the same identifier as
752
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UserEvent#user_pseudo_id UserEvent.user_pseudo_id}
753
+ # and
754
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CompleteQueryRequest#user_pseudo_id CompleteQueryRequest.user_pseudo_id}
755
+ #
756
+ # The field must be a UTF-8 encoded string with a length limit of 128
757
+ # characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
758
+ # @param content_search_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec, ::Hash]
759
+ # A specification for configuring the behavior of content search.
760
+ # @param embedding_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec, ::Hash]
761
+ # Uses the provided embedding to do additional semantic document retrieval.
762
+ # The retrieval is based on the dot product of
763
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector#vector SearchRequest.EmbeddingSpec.EmbeddingVector.vector}
764
+ # and the document embedding that is provided in
765
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector#field_path SearchRequest.EmbeddingSpec.EmbeddingVector.field_path}.
766
+ #
767
+ # If
768
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::EmbeddingSpec::EmbeddingVector#field_path SearchRequest.EmbeddingSpec.EmbeddingVector.field_path}
769
+ # is not provided, it will use
770
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#embedding_config ServingConfig.EmbeddingConfig.field_path}.
771
+ # @param ranking_expression [::String]
772
+ # The ranking expression controls the customized ranking on retrieval
773
+ # documents. This overrides
774
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#ranking_expression ServingConfig.ranking_expression}.
775
+ # The ranking expression is a single function or multiple functions that are
776
+ # joined by "+".
777
+ #
778
+ # * ranking_expression = function, { " + ", function };
779
+ #
780
+ # Supported functions:
781
+ #
782
+ # * double * relevance_score
783
+ # * double * dotProduct(embedding_field_path)
784
+ #
785
+ # Function variables:
786
+ #
787
+ # * `relevance_score`: pre-defined keywords, used for measure relevance
788
+ # between query and document.
789
+ # * `embedding_field_path`: the document embedding field
790
+ # used with query embedding vector.
791
+ # * `dotProduct`: embedding function between embedding_field_path and query
792
+ # embedding vector.
793
+ #
794
+ # Example ranking expression:
795
+ #
796
+ # If document has an embedding field doc_embedding, the ranking expression
797
+ # could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
798
+ # @param safe_search [::Boolean]
799
+ # Whether to turn on safe search. This is only supported for
800
+ # website search.
801
+ # @param user_labels [::Hash{::String => ::String}]
802
+ # The user labels applied to a resource must meet the following requirements:
803
+ #
804
+ # * Each resource can have multiple labels, up to a maximum of 64.
805
+ # * Each label must be a key-value pair.
806
+ # * Keys have a minimum length of 1 character and a maximum length of 63
807
+ # characters and cannot be empty. Values can be empty and have a maximum
808
+ # length of 63 characters.
809
+ # * Keys and values can contain only lowercase letters, numeric characters,
810
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
811
+ # international characters are allowed.
812
+ # * The key portion of a label must be unique. However, you can use the same
813
+ # key with multiple resources.
814
+ # * Keys must start with a lowercase letter or international character.
815
+ #
816
+ # See [Google Cloud
817
+ # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
818
+ # for more details.
819
+ # @param natural_language_query_understanding_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::NaturalLanguageQueryUnderstandingSpec, ::Hash]
820
+ # If `naturalLanguageQueryUnderstandingSpec` is not specified, no additional
821
+ # natural language query understanding will be done.
822
+ # @param search_as_you_type_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SearchAsYouTypeSpec, ::Hash]
823
+ # Search as you type configuration. Only supported for the
824
+ # {::Google::Cloud::DiscoveryEngine::V1beta::IndustryVertical::MEDIA IndustryVertical.MEDIA}
825
+ # vertical.
826
+ # @param session [::String]
827
+ # The session resource name. Optional.
828
+ #
829
+ # Session allows users to do multi-turn /search API calls or coordination
830
+ # between /search API calls and /answer API calls.
831
+ #
832
+ # Example #1 (multi-turn /search API calls):
833
+ # 1. Call /search API with the auto-session mode (see below).
834
+ # 2. Call /search API with the session ID generated in the first call.
835
+ # Here, the previous search query gets considered in query
836
+ # standing. I.e., if the first query is "How did Alphabet do in 2022?"
837
+ # and the current query is "How about 2023?", the current query will
838
+ # be interpreted as "How did Alphabet do in 2023?".
839
+ #
840
+ # Example #2 (coordination between /search API calls and /answer API calls):
841
+ # 1. Call /search API with the auto-session mode (see below).
842
+ # 2. Call /answer API with the session ID generated in the first call.
843
+ # Here, the answer generation happens in the context of the search
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.
849
+ #
850
+ # Multi-turn Search feature is currently at private GA stage. Please use
851
+ # v1alpha or v1beta version instead before we launch this feature to public
852
+ # GA. Or ask for allowlisting through Google Support team.
853
+ # @param session_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::SessionSpec, ::Hash]
854
+ # Session specification.
855
+ #
856
+ # Can be used only when `session` is set.
857
+ # @param relevance_threshold [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::RelevanceThreshold]
858
+ # The relevance threshold of the search results.
859
+ #
860
+ # Default to Google defined threshold, leveraging a balance of
861
+ # precision and recall to deliver both highly accurate results and
862
+ # comprehensive coverage of relevant information.
863
+ # @param personalization_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::PersonalizationSpec, ::Hash]
864
+ # The specification for personalization.
865
+ #
866
+ # Notice that if both
867
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}
868
+ # and
869
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
870
+ # are set,
871
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#personalization_spec SearchRequest.personalization_spec}
872
+ # overrides
873
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ServingConfig#personalization_spec ServingConfig.personalization_spec}.
874
+ #
875
+ # @yield [response, operation] Access the result along with the RPC operation
876
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult>]
877
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
878
+ #
879
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult>]
880
+ #
881
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
882
+ #
883
+ # @example Basic example
884
+ # require "google/cloud/discovery_engine/v1beta"
885
+ #
886
+ # # Create a client object. The client can be reused for multiple calls.
887
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client.new
888
+ #
889
+ # # Create a request. To set request fields, pass in keyword arguments.
890
+ # request = Google::Cloud::DiscoveryEngine::V1beta::SearchRequest.new
891
+ #
892
+ # # Call the search_lite method.
893
+ # result = client.search_lite request
894
+ #
895
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
896
+ # # over elements, and API calls will be issued to fetch pages as needed.
897
+ # result.each do |item|
898
+ # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1beta::SearchResponse::SearchResult.
899
+ # p item
900
+ # end
901
+ #
902
+ def search_lite request, options = nil
903
+ raise ::ArgumentError, "request must be provided" if request.nil?
904
+
905
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest
906
+
907
+ # Converts hash and nil to an options object
908
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
909
+
910
+ # Customize the options with defaults
911
+ metadata = @config.rpcs.search_lite.metadata.to_h
912
+
913
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
914
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
915
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
916
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
917
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
918
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
919
+
920
+ header_params = {}
921
+ if request.serving_config
922
+ header_params["serving_config"] = request.serving_config
923
+ end
924
+
925
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
926
+ metadata[:"x-goog-request-params"] ||= request_params_header
927
+
928
+ options.apply_defaults timeout: @config.rpcs.search_lite.timeout,
929
+ metadata: metadata,
930
+ retry_policy: @config.rpcs.search_lite.retry_policy
931
+
932
+ options.apply_defaults timeout: @config.timeout,
933
+ metadata: @config.metadata,
934
+ retry_policy: @config.retry_policy
935
+
936
+ @search_service_stub.call_rpc :search_lite, request, options: options do |response, operation|
937
+ response = ::Gapic::PagedEnumerable.new @search_service_stub, :search_lite, request, response, operation, options
938
+ yield response, operation if block_given?
939
+ throw :response, response
529
940
  end
530
941
  rescue ::GRPC::BadStatus => e
531
942
  raise ::Google::Cloud::Error.from_error(e)
@@ -614,6 +1025,11 @@ module Google
614
1025
  # default endpoint URL. The default value of nil uses the environment
615
1026
  # universe (usually the default "googleapis.com" universe).
616
1027
  # @return [::String,nil]
1028
+ # @!attribute [rw] logger
1029
+ # A custom logger to use for request/response debug logging, or the value
1030
+ # `:default` (the default) to construct a default logger, or `nil` to
1031
+ # explicitly disable logging.
1032
+ # @return [::Logger,:default,nil]
617
1033
  #
618
1034
  class Configuration
619
1035
  extend ::Gapic::Config
@@ -638,6 +1054,7 @@ module Google
638
1054
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
639
1055
  config_attr :quota_project, nil, ::String, nil
640
1056
  config_attr :universe_domain, nil, ::String, nil
1057
+ config_attr :logger, :default, ::Logger, nil, :default
641
1058
 
642
1059
  # @private
643
1060
  def initialize parent_config = nil
@@ -689,11 +1106,18 @@ module Google
689
1106
  # @return [::Gapic::Config::Method]
690
1107
  #
691
1108
  attr_reader :search
1109
+ ##
1110
+ # RPC-specific configuration for `search_lite`
1111
+ # @return [::Gapic::Config::Method]
1112
+ #
1113
+ attr_reader :search_lite
692
1114
 
693
1115
  # @private
694
1116
  def initialize parent_rpcs = nil
695
1117
  search_config = parent_rpcs.search if parent_rpcs.respond_to? :search
696
1118
  @search = ::Gapic::Config::Method.new search_config
1119
+ search_lite_config = parent_rpcs.search_lite if parent_rpcs.respond_to? :search_lite
1120
+ @search_lite = ::Gapic::Config::Method.new search_lite_config
697
1121
 
698
1122
  yield self if block_given?
699
1123
  end