google-cloud-discovery_engine-v1beta 0.3.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +21 -3
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +21 -3
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +959 -0
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/paths.rb +176 -0
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +797 -0
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/service_stub.rb +450 -0
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +19 -4
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +19 -4
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +42 -0
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/client.rb +14 -0
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/client.rb +14 -0
- data/lib/google/cloud/discovery_engine/v1beta/rest.rb +2 -1
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/client.rb +14 -0
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/client.rb +14 -0
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +42 -0
- data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +57 -12
- data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +57 -12
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +16 -2
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +16 -2
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +42 -0
- data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1beta.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1beta/completion_service_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/conversation_pb.rb +55 -0
- data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +61 -0
- data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_services_pb.rb +67 -0
- data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +7 -1
- data/lib/google/cloud/discoveryengine/v1beta/user_event_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/user_event_service_services_pb.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +14 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/common.rb +10 -2
- data/proto_docs/google/cloud/discoveryengine/v1beta/completion_service.rb +13 -2
- data/proto_docs/google/cloud/discoveryengine/v1beta/conversation.rb +138 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +209 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/document.rb +2 -4
- data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +2 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/import_config.rb +17 -17
- data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +295 -61
- data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +41 -29
- data/proto_docs/google/cloud/discoveryengine/v1beta/user_event_service.rb +1 -1
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- metadata +36 -3
@@ -0,0 +1,959 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/discoveryengine/v1beta/conversational_search_service_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module DiscoveryEngine
|
26
|
+
module V1beta
|
27
|
+
module ConversationalSearchService
|
28
|
+
##
|
29
|
+
# Client for the ConversationalSearchService service.
|
30
|
+
#
|
31
|
+
# Service for conversational search.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
include Paths
|
35
|
+
|
36
|
+
# @private
|
37
|
+
attr_reader :conversational_search_service_stub
|
38
|
+
|
39
|
+
##
|
40
|
+
# Configure the ConversationalSearchService Client class.
|
41
|
+
#
|
42
|
+
# See {::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client::Configuration}
|
43
|
+
# for a description of the configuration fields.
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
#
|
47
|
+
# # Modify the configuration for all ConversationalSearchService clients
|
48
|
+
# ::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client.configure do |config|
|
49
|
+
# config.timeout = 10.0
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# @yield [config] Configure the Client client.
|
53
|
+
# @yieldparam config [Client::Configuration]
|
54
|
+
#
|
55
|
+
# @return [Client::Configuration]
|
56
|
+
#
|
57
|
+
def self.configure
|
58
|
+
@configure ||= begin
|
59
|
+
namespace = ["Google", "Cloud", "DiscoveryEngine", "V1beta"]
|
60
|
+
parent_config = while namespace.any?
|
61
|
+
parent_name = namespace.join "::"
|
62
|
+
parent_const = const_get parent_name
|
63
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
64
|
+
namespace.pop
|
65
|
+
end
|
66
|
+
default_config = Client::Configuration.new parent_config
|
67
|
+
|
68
|
+
default_config.timeout = 30.0
|
69
|
+
default_config.retry_policy = {
|
70
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
71
|
+
}
|
72
|
+
|
73
|
+
default_config
|
74
|
+
end
|
75
|
+
yield @configure if block_given?
|
76
|
+
@configure
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# Configure the ConversationalSearchService Client instance.
|
81
|
+
#
|
82
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
83
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
84
|
+
# should be made on {Client.configure}.
|
85
|
+
#
|
86
|
+
# See {::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client::Configuration}
|
87
|
+
# for a description of the configuration fields.
|
88
|
+
#
|
89
|
+
# @yield [config] Configure the Client client.
|
90
|
+
# @yieldparam config [Client::Configuration]
|
91
|
+
#
|
92
|
+
# @return [Client::Configuration]
|
93
|
+
#
|
94
|
+
def configure
|
95
|
+
yield @config if block_given?
|
96
|
+
@config
|
97
|
+
end
|
98
|
+
|
99
|
+
##
|
100
|
+
# Create a new ConversationalSearchService client object.
|
101
|
+
#
|
102
|
+
# @example
|
103
|
+
#
|
104
|
+
# # Create a client using the default configuration
|
105
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client.new
|
106
|
+
#
|
107
|
+
# # Create a client using a custom configuration
|
108
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client.new do |config|
|
109
|
+
# config.timeout = 10.0
|
110
|
+
# end
|
111
|
+
#
|
112
|
+
# @yield [config] Configure the ConversationalSearchService client.
|
113
|
+
# @yieldparam config [Client::Configuration]
|
114
|
+
#
|
115
|
+
def initialize
|
116
|
+
# These require statements are intentionally placed here to initialize
|
117
|
+
# the gRPC module only when it's required.
|
118
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
119
|
+
require "gapic/grpc"
|
120
|
+
require "google/cloud/discoveryengine/v1beta/conversational_search_service_services_pb"
|
121
|
+
|
122
|
+
# Create the configuration object
|
123
|
+
@config = Configuration.new Client.configure
|
124
|
+
|
125
|
+
# Yield the configuration if needed
|
126
|
+
yield @config if block_given?
|
127
|
+
|
128
|
+
# Create credentials
|
129
|
+
credentials = @config.credentials
|
130
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
131
|
+
# but only if the default endpoint does not have a region prefix.
|
132
|
+
enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
133
|
+
!@config.endpoint.split(".").first.include?("-")
|
134
|
+
credentials ||= Credentials.default scope: @config.scope,
|
135
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
136
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
137
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
138
|
+
end
|
139
|
+
@quota_project_id = @config.quota_project
|
140
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
141
|
+
|
142
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
143
|
+
config.credentials = credentials
|
144
|
+
config.quota_project = @quota_project_id
|
145
|
+
config.endpoint = @config.endpoint
|
146
|
+
end
|
147
|
+
|
148
|
+
@conversational_search_service_stub = ::Gapic::ServiceStub.new(
|
149
|
+
::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Stub,
|
150
|
+
credentials: credentials,
|
151
|
+
endpoint: @config.endpoint,
|
152
|
+
channel_args: @config.channel_args,
|
153
|
+
interceptors: @config.interceptors
|
154
|
+
)
|
155
|
+
end
|
156
|
+
|
157
|
+
##
|
158
|
+
# Get the associated client for mix-in of the Locations.
|
159
|
+
#
|
160
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
161
|
+
#
|
162
|
+
attr_reader :location_client
|
163
|
+
|
164
|
+
# Service calls
|
165
|
+
|
166
|
+
##
|
167
|
+
# Converses a conversation.
|
168
|
+
#
|
169
|
+
# @overload converse_conversation(request, options = nil)
|
170
|
+
# Pass arguments to `converse_conversation` via a request object, either of type
|
171
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ConverseConversationRequest} or an equivalent Hash.
|
172
|
+
#
|
173
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::ConverseConversationRequest, ::Hash]
|
174
|
+
# A request object representing the call parameters. Required. To specify no
|
175
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
176
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
177
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
178
|
+
#
|
179
|
+
# @overload converse_conversation(name: nil, query: nil, serving_config: nil, conversation: nil, safe_search: nil, user_labels: nil, summary_spec: nil)
|
180
|
+
# Pass arguments to `converse_conversation` via keyword arguments. Note that at
|
181
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
182
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
183
|
+
#
|
184
|
+
# @param name [::String]
|
185
|
+
# Required. The resource name of the Conversation to get. Format:
|
186
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`.
|
187
|
+
# Use
|
188
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/-`
|
189
|
+
# to activate auto session mode, which automatically creates a new
|
190
|
+
# conversation inside a ConverseConversation session.
|
191
|
+
# @param query [::Google::Cloud::DiscoveryEngine::V1beta::TextInput, ::Hash]
|
192
|
+
# Required. Current user input.
|
193
|
+
# @param serving_config [::String]
|
194
|
+
# The resource name of the Serving Config to use. Format:
|
195
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/servingConfigs/{serving_config_id}`
|
196
|
+
# If this is not set, the default serving config will be used.
|
197
|
+
# @param conversation [::Google::Cloud::DiscoveryEngine::V1beta::Conversation, ::Hash]
|
198
|
+
# The conversation to be used by auto session only. The name field will be
|
199
|
+
# ignored as we automatically assign new name for the conversation in auto
|
200
|
+
# session.
|
201
|
+
# @param safe_search [::Boolean]
|
202
|
+
# Whether to turn on safe search.
|
203
|
+
# @param user_labels [::Hash{::String => ::String}]
|
204
|
+
# The user labels applied to a resource must meet the following requirements:
|
205
|
+
#
|
206
|
+
# * Each resource can have multiple labels, up to a maximum of 64.
|
207
|
+
# * Each label must be a key-value pair.
|
208
|
+
# * Keys have a minimum length of 1 character and a maximum length of 63
|
209
|
+
# characters and cannot be empty. Values can be empty and have a maximum
|
210
|
+
# length of 63 characters.
|
211
|
+
# * Keys and values can contain only lowercase letters, numeric characters,
|
212
|
+
# underscores, and dashes. All characters must use UTF-8 encoding, and
|
213
|
+
# international characters are allowed.
|
214
|
+
# * The key portion of a label must be unique. However, you can use the same
|
215
|
+
# key with multiple resources.
|
216
|
+
# * Keys must start with a lowercase letter or international character.
|
217
|
+
#
|
218
|
+
# See [Google Cloud
|
219
|
+
# Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
|
220
|
+
# for more details.
|
221
|
+
# @param summary_spec [::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest::ContentSearchSpec::SummarySpec, ::Hash]
|
222
|
+
# A specification for configuring the summary returned in the response.
|
223
|
+
#
|
224
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
225
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::ConverseConversationResponse]
|
226
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
227
|
+
#
|
228
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::ConverseConversationResponse]
|
229
|
+
#
|
230
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
231
|
+
#
|
232
|
+
# @example Basic example
|
233
|
+
# require "google/cloud/discovery_engine/v1beta"
|
234
|
+
#
|
235
|
+
# # Create a client object. The client can be reused for multiple calls.
|
236
|
+
# client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client.new
|
237
|
+
#
|
238
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
239
|
+
# request = Google::Cloud::DiscoveryEngine::V1beta::ConverseConversationRequest.new
|
240
|
+
#
|
241
|
+
# # Call the converse_conversation method.
|
242
|
+
# result = client.converse_conversation request
|
243
|
+
#
|
244
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::ConverseConversationResponse.
|
245
|
+
# p result
|
246
|
+
#
|
247
|
+
def converse_conversation request, options = nil
|
248
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
249
|
+
|
250
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ConverseConversationRequest
|
251
|
+
|
252
|
+
# Converts hash and nil to an options object
|
253
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
254
|
+
|
255
|
+
# Customize the options with defaults
|
256
|
+
metadata = @config.rpcs.converse_conversation.metadata.to_h
|
257
|
+
|
258
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
259
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
260
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
261
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
|
262
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
263
|
+
|
264
|
+
header_params = {}
|
265
|
+
if request.name
|
266
|
+
header_params["name"] = request.name
|
267
|
+
end
|
268
|
+
|
269
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
270
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
271
|
+
|
272
|
+
options.apply_defaults timeout: @config.rpcs.converse_conversation.timeout,
|
273
|
+
metadata: metadata,
|
274
|
+
retry_policy: @config.rpcs.converse_conversation.retry_policy
|
275
|
+
|
276
|
+
options.apply_defaults timeout: @config.timeout,
|
277
|
+
metadata: @config.metadata,
|
278
|
+
retry_policy: @config.retry_policy
|
279
|
+
|
280
|
+
@conversational_search_service_stub.call_rpc :converse_conversation, request, options: options do |response, operation|
|
281
|
+
yield response, operation if block_given?
|
282
|
+
return response
|
283
|
+
end
|
284
|
+
rescue ::GRPC::BadStatus => e
|
285
|
+
raise ::Google::Cloud::Error.from_error(e)
|
286
|
+
end
|
287
|
+
|
288
|
+
##
|
289
|
+
# Creates a Conversation.
|
290
|
+
#
|
291
|
+
# If the {::Google::Cloud::DiscoveryEngine::V1beta::Conversation Conversation} to
|
292
|
+
# create already exists, an ALREADY_EXISTS error is returned.
|
293
|
+
#
|
294
|
+
# @overload create_conversation(request, options = nil)
|
295
|
+
# Pass arguments to `create_conversation` via a request object, either of type
|
296
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::CreateConversationRequest} or an equivalent Hash.
|
297
|
+
#
|
298
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::CreateConversationRequest, ::Hash]
|
299
|
+
# A request object representing the call parameters. Required. To specify no
|
300
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
301
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
302
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
303
|
+
#
|
304
|
+
# @overload create_conversation(parent: nil, conversation: nil)
|
305
|
+
# Pass arguments to `create_conversation` via keyword arguments. Note that at
|
306
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
307
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
308
|
+
#
|
309
|
+
# @param parent [::String]
|
310
|
+
# Required. Full resource name of parent data store. Format:
|
311
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
|
312
|
+
# @param conversation [::Google::Cloud::DiscoveryEngine::V1beta::Conversation, ::Hash]
|
313
|
+
# Required. The conversation to create.
|
314
|
+
#
|
315
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
316
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::Conversation]
|
317
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
318
|
+
#
|
319
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::Conversation]
|
320
|
+
#
|
321
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
322
|
+
#
|
323
|
+
# @example Basic example
|
324
|
+
# require "google/cloud/discovery_engine/v1beta"
|
325
|
+
#
|
326
|
+
# # Create a client object. The client can be reused for multiple calls.
|
327
|
+
# client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client.new
|
328
|
+
#
|
329
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
330
|
+
# request = Google::Cloud::DiscoveryEngine::V1beta::CreateConversationRequest.new
|
331
|
+
#
|
332
|
+
# # Call the create_conversation method.
|
333
|
+
# result = client.create_conversation request
|
334
|
+
#
|
335
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Conversation.
|
336
|
+
# p result
|
337
|
+
#
|
338
|
+
def create_conversation request, options = nil
|
339
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
340
|
+
|
341
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::CreateConversationRequest
|
342
|
+
|
343
|
+
# Converts hash and nil to an options object
|
344
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
345
|
+
|
346
|
+
# Customize the options with defaults
|
347
|
+
metadata = @config.rpcs.create_conversation.metadata.to_h
|
348
|
+
|
349
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
350
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
351
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
352
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
|
353
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
354
|
+
|
355
|
+
header_params = {}
|
356
|
+
if request.parent
|
357
|
+
header_params["parent"] = request.parent
|
358
|
+
end
|
359
|
+
|
360
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
361
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
362
|
+
|
363
|
+
options.apply_defaults timeout: @config.rpcs.create_conversation.timeout,
|
364
|
+
metadata: metadata,
|
365
|
+
retry_policy: @config.rpcs.create_conversation.retry_policy
|
366
|
+
|
367
|
+
options.apply_defaults timeout: @config.timeout,
|
368
|
+
metadata: @config.metadata,
|
369
|
+
retry_policy: @config.retry_policy
|
370
|
+
|
371
|
+
@conversational_search_service_stub.call_rpc :create_conversation, request, options: options do |response, operation|
|
372
|
+
yield response, operation if block_given?
|
373
|
+
return response
|
374
|
+
end
|
375
|
+
rescue ::GRPC::BadStatus => e
|
376
|
+
raise ::Google::Cloud::Error.from_error(e)
|
377
|
+
end
|
378
|
+
|
379
|
+
##
|
380
|
+
# Deletes a Conversation.
|
381
|
+
#
|
382
|
+
# If the {::Google::Cloud::DiscoveryEngine::V1beta::Conversation Conversation} to
|
383
|
+
# delete does not exist, a NOT_FOUND error is returned.
|
384
|
+
#
|
385
|
+
# @overload delete_conversation(request, options = nil)
|
386
|
+
# Pass arguments to `delete_conversation` via a request object, either of type
|
387
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::DeleteConversationRequest} or an equivalent Hash.
|
388
|
+
#
|
389
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::DeleteConversationRequest, ::Hash]
|
390
|
+
# A request object representing the call parameters. Required. To specify no
|
391
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
392
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
393
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
394
|
+
#
|
395
|
+
# @overload delete_conversation(name: nil)
|
396
|
+
# Pass arguments to `delete_conversation` via keyword arguments. Note that at
|
397
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
398
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
399
|
+
#
|
400
|
+
# @param name [::String]
|
401
|
+
# Required. The resource name of the Conversation to delete. Format:
|
402
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`
|
403
|
+
#
|
404
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
405
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
406
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
407
|
+
#
|
408
|
+
# @return [::Google::Protobuf::Empty]
|
409
|
+
#
|
410
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
411
|
+
#
|
412
|
+
# @example Basic example
|
413
|
+
# require "google/cloud/discovery_engine/v1beta"
|
414
|
+
#
|
415
|
+
# # Create a client object. The client can be reused for multiple calls.
|
416
|
+
# client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client.new
|
417
|
+
#
|
418
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
419
|
+
# request = Google::Cloud::DiscoveryEngine::V1beta::DeleteConversationRequest.new
|
420
|
+
#
|
421
|
+
# # Call the delete_conversation method.
|
422
|
+
# result = client.delete_conversation request
|
423
|
+
#
|
424
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
425
|
+
# p result
|
426
|
+
#
|
427
|
+
def delete_conversation request, options = nil
|
428
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
429
|
+
|
430
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::DeleteConversationRequest
|
431
|
+
|
432
|
+
# Converts hash and nil to an options object
|
433
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
434
|
+
|
435
|
+
# Customize the options with defaults
|
436
|
+
metadata = @config.rpcs.delete_conversation.metadata.to_h
|
437
|
+
|
438
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
439
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
440
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
441
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
|
442
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
443
|
+
|
444
|
+
header_params = {}
|
445
|
+
if request.name
|
446
|
+
header_params["name"] = request.name
|
447
|
+
end
|
448
|
+
|
449
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
450
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
451
|
+
|
452
|
+
options.apply_defaults timeout: @config.rpcs.delete_conversation.timeout,
|
453
|
+
metadata: metadata,
|
454
|
+
retry_policy: @config.rpcs.delete_conversation.retry_policy
|
455
|
+
|
456
|
+
options.apply_defaults timeout: @config.timeout,
|
457
|
+
metadata: @config.metadata,
|
458
|
+
retry_policy: @config.retry_policy
|
459
|
+
|
460
|
+
@conversational_search_service_stub.call_rpc :delete_conversation, request, options: options do |response, operation|
|
461
|
+
yield response, operation if block_given?
|
462
|
+
return response
|
463
|
+
end
|
464
|
+
rescue ::GRPC::BadStatus => e
|
465
|
+
raise ::Google::Cloud::Error.from_error(e)
|
466
|
+
end
|
467
|
+
|
468
|
+
##
|
469
|
+
# Updates a Conversation.
|
470
|
+
#
|
471
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Conversation Conversation} action
|
472
|
+
# type cannot be changed. If the
|
473
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Conversation Conversation} to update
|
474
|
+
# does not exist, a NOT_FOUND error is returned.
|
475
|
+
#
|
476
|
+
# @overload update_conversation(request, options = nil)
|
477
|
+
# Pass arguments to `update_conversation` via a request object, either of type
|
478
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::UpdateConversationRequest} or an equivalent Hash.
|
479
|
+
#
|
480
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::UpdateConversationRequest, ::Hash]
|
481
|
+
# A request object representing the call parameters. Required. To specify no
|
482
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
483
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
484
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
485
|
+
#
|
486
|
+
# @overload update_conversation(conversation: nil, update_mask: nil)
|
487
|
+
# Pass arguments to `update_conversation` via keyword arguments. Note that at
|
488
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
489
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
490
|
+
#
|
491
|
+
# @param conversation [::Google::Cloud::DiscoveryEngine::V1beta::Conversation, ::Hash]
|
492
|
+
# Required. The Conversation to update.
|
493
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
494
|
+
# Indicates which fields in the provided
|
495
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Conversation Conversation} to update.
|
496
|
+
# The following are NOT supported:
|
497
|
+
#
|
498
|
+
# * [conversation.name][]
|
499
|
+
#
|
500
|
+
# If not set or empty, all supported fields are updated.
|
501
|
+
#
|
502
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
503
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::Conversation]
|
504
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
505
|
+
#
|
506
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::Conversation]
|
507
|
+
#
|
508
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
509
|
+
#
|
510
|
+
# @example Basic example
|
511
|
+
# require "google/cloud/discovery_engine/v1beta"
|
512
|
+
#
|
513
|
+
# # Create a client object. The client can be reused for multiple calls.
|
514
|
+
# client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client.new
|
515
|
+
#
|
516
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
517
|
+
# request = Google::Cloud::DiscoveryEngine::V1beta::UpdateConversationRequest.new
|
518
|
+
#
|
519
|
+
# # Call the update_conversation method.
|
520
|
+
# result = client.update_conversation request
|
521
|
+
#
|
522
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Conversation.
|
523
|
+
# p result
|
524
|
+
#
|
525
|
+
def update_conversation request, options = nil
|
526
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
527
|
+
|
528
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::UpdateConversationRequest
|
529
|
+
|
530
|
+
# Converts hash and nil to an options object
|
531
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
532
|
+
|
533
|
+
# Customize the options with defaults
|
534
|
+
metadata = @config.rpcs.update_conversation.metadata.to_h
|
535
|
+
|
536
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
537
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
538
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
539
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
|
540
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
541
|
+
|
542
|
+
header_params = {}
|
543
|
+
if request.conversation&.name
|
544
|
+
header_params["conversation.name"] = request.conversation.name
|
545
|
+
end
|
546
|
+
|
547
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
548
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
549
|
+
|
550
|
+
options.apply_defaults timeout: @config.rpcs.update_conversation.timeout,
|
551
|
+
metadata: metadata,
|
552
|
+
retry_policy: @config.rpcs.update_conversation.retry_policy
|
553
|
+
|
554
|
+
options.apply_defaults timeout: @config.timeout,
|
555
|
+
metadata: @config.metadata,
|
556
|
+
retry_policy: @config.retry_policy
|
557
|
+
|
558
|
+
@conversational_search_service_stub.call_rpc :update_conversation, request, options: options do |response, operation|
|
559
|
+
yield response, operation if block_given?
|
560
|
+
return response
|
561
|
+
end
|
562
|
+
rescue ::GRPC::BadStatus => e
|
563
|
+
raise ::Google::Cloud::Error.from_error(e)
|
564
|
+
end
|
565
|
+
|
566
|
+
##
|
567
|
+
# Gets a Conversation.
|
568
|
+
#
|
569
|
+
# @overload get_conversation(request, options = nil)
|
570
|
+
# Pass arguments to `get_conversation` via a request object, either of type
|
571
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::GetConversationRequest} or an equivalent Hash.
|
572
|
+
#
|
573
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::GetConversationRequest, ::Hash]
|
574
|
+
# A request object representing the call parameters. Required. To specify no
|
575
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
576
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
577
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
578
|
+
#
|
579
|
+
# @overload get_conversation(name: nil)
|
580
|
+
# Pass arguments to `get_conversation` via keyword arguments. Note that at
|
581
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
582
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
583
|
+
#
|
584
|
+
# @param name [::String]
|
585
|
+
# Required. The resource name of the Conversation to get. Format:
|
586
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`
|
587
|
+
#
|
588
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
589
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::Conversation]
|
590
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
591
|
+
#
|
592
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::Conversation]
|
593
|
+
#
|
594
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
595
|
+
#
|
596
|
+
# @example Basic example
|
597
|
+
# require "google/cloud/discovery_engine/v1beta"
|
598
|
+
#
|
599
|
+
# # Create a client object. The client can be reused for multiple calls.
|
600
|
+
# client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client.new
|
601
|
+
#
|
602
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
603
|
+
# request = Google::Cloud::DiscoveryEngine::V1beta::GetConversationRequest.new
|
604
|
+
#
|
605
|
+
# # Call the get_conversation method.
|
606
|
+
# result = client.get_conversation request
|
607
|
+
#
|
608
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Conversation.
|
609
|
+
# p result
|
610
|
+
#
|
611
|
+
def get_conversation request, options = nil
|
612
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
613
|
+
|
614
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::GetConversationRequest
|
615
|
+
|
616
|
+
# Converts hash and nil to an options object
|
617
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
618
|
+
|
619
|
+
# Customize the options with defaults
|
620
|
+
metadata = @config.rpcs.get_conversation.metadata.to_h
|
621
|
+
|
622
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
623
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
624
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
625
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
|
626
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
627
|
+
|
628
|
+
header_params = {}
|
629
|
+
if request.name
|
630
|
+
header_params["name"] = request.name
|
631
|
+
end
|
632
|
+
|
633
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
634
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
635
|
+
|
636
|
+
options.apply_defaults timeout: @config.rpcs.get_conversation.timeout,
|
637
|
+
metadata: metadata,
|
638
|
+
retry_policy: @config.rpcs.get_conversation.retry_policy
|
639
|
+
|
640
|
+
options.apply_defaults timeout: @config.timeout,
|
641
|
+
metadata: @config.metadata,
|
642
|
+
retry_policy: @config.retry_policy
|
643
|
+
|
644
|
+
@conversational_search_service_stub.call_rpc :get_conversation, request, options: options do |response, operation|
|
645
|
+
yield response, operation if block_given?
|
646
|
+
return response
|
647
|
+
end
|
648
|
+
rescue ::GRPC::BadStatus => e
|
649
|
+
raise ::Google::Cloud::Error.from_error(e)
|
650
|
+
end
|
651
|
+
|
652
|
+
##
|
653
|
+
# Lists all Conversations by their parent
|
654
|
+
# [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
|
655
|
+
#
|
656
|
+
# @overload list_conversations(request, options = nil)
|
657
|
+
# Pass arguments to `list_conversations` via a request object, either of type
|
658
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ListConversationsRequest} or an equivalent Hash.
|
659
|
+
#
|
660
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::ListConversationsRequest, ::Hash]
|
661
|
+
# A request object representing the call parameters. Required. To specify no
|
662
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
663
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
664
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
665
|
+
#
|
666
|
+
# @overload list_conversations(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
|
667
|
+
# Pass arguments to `list_conversations` via keyword arguments. Note that at
|
668
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
669
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
670
|
+
#
|
671
|
+
# @param parent [::String]
|
672
|
+
# Required. The data store resource name. Format:
|
673
|
+
# `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
|
674
|
+
# @param page_size [::Integer]
|
675
|
+
# Maximum number of results to return. If unspecified, defaults
|
676
|
+
# to 50. Max allowed value is 1000.
|
677
|
+
# @param page_token [::String]
|
678
|
+
# A page token, received from a previous `ListConversations` call.
|
679
|
+
# Provide this to retrieve the subsequent page.
|
680
|
+
# @param filter [::String]
|
681
|
+
# A filter to apply on the list results. The supported features are:
|
682
|
+
# user_pseudo_id, state.
|
683
|
+
#
|
684
|
+
# Example:
|
685
|
+
# "user_pseudo_id = some_id"
|
686
|
+
# @param order_by [::String]
|
687
|
+
# A comma-separated list of fields to order by, sorted in ascending order.
|
688
|
+
# Use "desc" after a field name for descending.
|
689
|
+
# Supported fields:
|
690
|
+
# * `update_time`
|
691
|
+
# * `create_time`
|
692
|
+
# * `conversation_name`
|
693
|
+
#
|
694
|
+
# Example:
|
695
|
+
# "update_time desc"
|
696
|
+
# "create_time"
|
697
|
+
#
|
698
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
699
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Conversation>]
|
700
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
701
|
+
#
|
702
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Conversation>]
|
703
|
+
#
|
704
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
705
|
+
#
|
706
|
+
# @example Basic example
|
707
|
+
# require "google/cloud/discovery_engine/v1beta"
|
708
|
+
#
|
709
|
+
# # Create a client object. The client can be reused for multiple calls.
|
710
|
+
# client = Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client.new
|
711
|
+
#
|
712
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
713
|
+
# request = Google::Cloud::DiscoveryEngine::V1beta::ListConversationsRequest.new
|
714
|
+
#
|
715
|
+
# # Call the list_conversations method.
|
716
|
+
# result = client.list_conversations request
|
717
|
+
#
|
718
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
719
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
720
|
+
# result.each do |item|
|
721
|
+
# # Each element is of type ::Google::Cloud::DiscoveryEngine::V1beta::Conversation.
|
722
|
+
# p item
|
723
|
+
# end
|
724
|
+
#
|
725
|
+
def list_conversations request, options = nil
|
726
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
727
|
+
|
728
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ListConversationsRequest
|
729
|
+
|
730
|
+
# Converts hash and nil to an options object
|
731
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
732
|
+
|
733
|
+
# Customize the options with defaults
|
734
|
+
metadata = @config.rpcs.list_conversations.metadata.to_h
|
735
|
+
|
736
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
737
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
738
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
739
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
|
740
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
741
|
+
|
742
|
+
header_params = {}
|
743
|
+
if request.parent
|
744
|
+
header_params["parent"] = request.parent
|
745
|
+
end
|
746
|
+
|
747
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
748
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
749
|
+
|
750
|
+
options.apply_defaults timeout: @config.rpcs.list_conversations.timeout,
|
751
|
+
metadata: metadata,
|
752
|
+
retry_policy: @config.rpcs.list_conversations.retry_policy
|
753
|
+
|
754
|
+
options.apply_defaults timeout: @config.timeout,
|
755
|
+
metadata: @config.metadata,
|
756
|
+
retry_policy: @config.retry_policy
|
757
|
+
|
758
|
+
@conversational_search_service_stub.call_rpc :list_conversations, request, options: options do |response, operation|
|
759
|
+
response = ::Gapic::PagedEnumerable.new @conversational_search_service_stub, :list_conversations, request, response, operation, options
|
760
|
+
yield response, operation if block_given?
|
761
|
+
return response
|
762
|
+
end
|
763
|
+
rescue ::GRPC::BadStatus => e
|
764
|
+
raise ::Google::Cloud::Error.from_error(e)
|
765
|
+
end
|
766
|
+
|
767
|
+
##
|
768
|
+
# Configuration class for the ConversationalSearchService API.
|
769
|
+
#
|
770
|
+
# This class represents the configuration for ConversationalSearchService,
|
771
|
+
# providing control over timeouts, retry behavior, logging, transport
|
772
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
773
|
+
# applied individually to specific RPCs. See
|
774
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client::Configuration::Rpcs}
|
775
|
+
# for a list of RPCs that can be configured independently.
|
776
|
+
#
|
777
|
+
# Configuration can be applied globally to all clients, or to a single client
|
778
|
+
# on construction.
|
779
|
+
#
|
780
|
+
# @example
|
781
|
+
#
|
782
|
+
# # Modify the global config, setting the timeout for
|
783
|
+
# # converse_conversation to 20 seconds,
|
784
|
+
# # and all remaining timeouts to 10 seconds.
|
785
|
+
# ::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client.configure do |config|
|
786
|
+
# config.timeout = 10.0
|
787
|
+
# config.rpcs.converse_conversation.timeout = 20.0
|
788
|
+
# end
|
789
|
+
#
|
790
|
+
# # Apply the above configuration only to a new client.
|
791
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1beta::ConversationalSearchService::Client.new do |config|
|
792
|
+
# config.timeout = 10.0
|
793
|
+
# config.rpcs.converse_conversation.timeout = 20.0
|
794
|
+
# end
|
795
|
+
#
|
796
|
+
# @!attribute [rw] endpoint
|
797
|
+
# The hostname or hostname:port of the service endpoint.
|
798
|
+
# Defaults to `"discoveryengine.googleapis.com"`.
|
799
|
+
# @return [::String]
|
800
|
+
# @!attribute [rw] credentials
|
801
|
+
# Credentials to send with calls. You may provide any of the following types:
|
802
|
+
# * (`String`) The path to a service account key file in JSON format
|
803
|
+
# * (`Hash`) A service account key as a Hash
|
804
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
805
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
806
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
807
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
808
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
809
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
810
|
+
# * (`nil`) indicating no credentials
|
811
|
+
# @return [::Object]
|
812
|
+
# @!attribute [rw] scope
|
813
|
+
# The OAuth scopes
|
814
|
+
# @return [::Array<::String>]
|
815
|
+
# @!attribute [rw] lib_name
|
816
|
+
# The library name as recorded in instrumentation and logging
|
817
|
+
# @return [::String]
|
818
|
+
# @!attribute [rw] lib_version
|
819
|
+
# The library version as recorded in instrumentation and logging
|
820
|
+
# @return [::String]
|
821
|
+
# @!attribute [rw] channel_args
|
822
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
823
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
824
|
+
# @return [::Hash]
|
825
|
+
# @!attribute [rw] interceptors
|
826
|
+
# An array of interceptors that are run before calls are executed.
|
827
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
828
|
+
# @!attribute [rw] timeout
|
829
|
+
# The call timeout in seconds.
|
830
|
+
# @return [::Numeric]
|
831
|
+
# @!attribute [rw] metadata
|
832
|
+
# Additional gRPC headers to be sent with the call.
|
833
|
+
# @return [::Hash{::Symbol=>::String}]
|
834
|
+
# @!attribute [rw] retry_policy
|
835
|
+
# The retry policy. The value is a hash with the following keys:
|
836
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
837
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
838
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
839
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
840
|
+
# trigger a retry.
|
841
|
+
# @return [::Hash]
|
842
|
+
# @!attribute [rw] quota_project
|
843
|
+
# A separate project against which to charge quota.
|
844
|
+
# @return [::String]
|
845
|
+
#
|
846
|
+
class Configuration
|
847
|
+
extend ::Gapic::Config
|
848
|
+
|
849
|
+
DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
|
850
|
+
|
851
|
+
config_attr :endpoint, DEFAULT_ENDPOINT, ::String
|
852
|
+
config_attr :credentials, nil do |value|
|
853
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
854
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
855
|
+
allowed.any? { |klass| klass === value }
|
856
|
+
end
|
857
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
858
|
+
config_attr :lib_name, nil, ::String, nil
|
859
|
+
config_attr :lib_version, nil, ::String, nil
|
860
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
861
|
+
config_attr :interceptors, nil, ::Array, nil
|
862
|
+
config_attr :timeout, nil, ::Numeric, nil
|
863
|
+
config_attr :metadata, nil, ::Hash, nil
|
864
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
865
|
+
config_attr :quota_project, nil, ::String, nil
|
866
|
+
|
867
|
+
# @private
|
868
|
+
def initialize parent_config = nil
|
869
|
+
@parent_config = parent_config unless parent_config.nil?
|
870
|
+
|
871
|
+
yield self if block_given?
|
872
|
+
end
|
873
|
+
|
874
|
+
##
|
875
|
+
# Configurations for individual RPCs
|
876
|
+
# @return [Rpcs]
|
877
|
+
#
|
878
|
+
def rpcs
|
879
|
+
@rpcs ||= begin
|
880
|
+
parent_rpcs = nil
|
881
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
882
|
+
Rpcs.new parent_rpcs
|
883
|
+
end
|
884
|
+
end
|
885
|
+
|
886
|
+
##
|
887
|
+
# Configuration RPC class for the ConversationalSearchService API.
|
888
|
+
#
|
889
|
+
# Includes fields providing the configuration for each RPC in this service.
|
890
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
891
|
+
# the following configuration fields:
|
892
|
+
#
|
893
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
894
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
895
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
896
|
+
# include the following keys:
|
897
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
898
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
899
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
900
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
901
|
+
# trigger a retry.
|
902
|
+
#
|
903
|
+
class Rpcs
|
904
|
+
##
|
905
|
+
# RPC-specific configuration for `converse_conversation`
|
906
|
+
# @return [::Gapic::Config::Method]
|
907
|
+
#
|
908
|
+
attr_reader :converse_conversation
|
909
|
+
##
|
910
|
+
# RPC-specific configuration for `create_conversation`
|
911
|
+
# @return [::Gapic::Config::Method]
|
912
|
+
#
|
913
|
+
attr_reader :create_conversation
|
914
|
+
##
|
915
|
+
# RPC-specific configuration for `delete_conversation`
|
916
|
+
# @return [::Gapic::Config::Method]
|
917
|
+
#
|
918
|
+
attr_reader :delete_conversation
|
919
|
+
##
|
920
|
+
# RPC-specific configuration for `update_conversation`
|
921
|
+
# @return [::Gapic::Config::Method]
|
922
|
+
#
|
923
|
+
attr_reader :update_conversation
|
924
|
+
##
|
925
|
+
# RPC-specific configuration for `get_conversation`
|
926
|
+
# @return [::Gapic::Config::Method]
|
927
|
+
#
|
928
|
+
attr_reader :get_conversation
|
929
|
+
##
|
930
|
+
# RPC-specific configuration for `list_conversations`
|
931
|
+
# @return [::Gapic::Config::Method]
|
932
|
+
#
|
933
|
+
attr_reader :list_conversations
|
934
|
+
|
935
|
+
# @private
|
936
|
+
def initialize parent_rpcs = nil
|
937
|
+
converse_conversation_config = parent_rpcs.converse_conversation if parent_rpcs.respond_to? :converse_conversation
|
938
|
+
@converse_conversation = ::Gapic::Config::Method.new converse_conversation_config
|
939
|
+
create_conversation_config = parent_rpcs.create_conversation if parent_rpcs.respond_to? :create_conversation
|
940
|
+
@create_conversation = ::Gapic::Config::Method.new create_conversation_config
|
941
|
+
delete_conversation_config = parent_rpcs.delete_conversation if parent_rpcs.respond_to? :delete_conversation
|
942
|
+
@delete_conversation = ::Gapic::Config::Method.new delete_conversation_config
|
943
|
+
update_conversation_config = parent_rpcs.update_conversation if parent_rpcs.respond_to? :update_conversation
|
944
|
+
@update_conversation = ::Gapic::Config::Method.new update_conversation_config
|
945
|
+
get_conversation_config = parent_rpcs.get_conversation if parent_rpcs.respond_to? :get_conversation
|
946
|
+
@get_conversation = ::Gapic::Config::Method.new get_conversation_config
|
947
|
+
list_conversations_config = parent_rpcs.list_conversations if parent_rpcs.respond_to? :list_conversations
|
948
|
+
@list_conversations = ::Gapic::Config::Method.new list_conversations_config
|
949
|
+
|
950
|
+
yield self if block_given?
|
951
|
+
end
|
952
|
+
end
|
953
|
+
end
|
954
|
+
end
|
955
|
+
end
|
956
|
+
end
|
957
|
+
end
|
958
|
+
end
|
959
|
+
end
|