google-cloud-discovery_engine-v1 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +4 -4
- data/README.md +4 -4
- data/lib/google/cloud/discovery_engine/v1/assistant_service/client.rb +509 -0
- data/lib/google/cloud/discovery_engine/v1/assistant_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/assistant_service/paths.rb +169 -0
- data/lib/google/cloud/discovery_engine/v1/assistant_service/rest/client.rb +478 -0
- data/lib/google/cloud/discovery_engine/v1/assistant_service/rest/service_stub.rb +137 -0
- data/lib/google/cloud/discovery_engine/v1/assistant_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/assistant_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1/completion_service/client.rb +5 -5
- data/lib/google/cloud/discovery_engine/v1/completion_service/rest/client.rb +5 -5
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +16 -4
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +16 -4
- data/lib/google/cloud/discovery_engine/v1/data_store_service/client.rb +2 -2
- data/lib/google/cloud/discovery_engine/v1/data_store_service/rest/client.rb +2 -2
- data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +11 -11
- data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +11 -11
- data/lib/google/cloud/discovery_engine/v1/identity_mapping_store_service/client.rb +2 -2
- data/lib/google/cloud/discovery_engine/v1/identity_mapping_store_service/rest/client.rb +2 -2
- data/lib/google/cloud/discovery_engine/v1/rest.rb +4 -2
- data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +16 -28
- data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +16 -28
- data/lib/google/cloud/discovery_engine/v1/session_service/client.rb +920 -0
- data/lib/google/cloud/discovery_engine/v1/session_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/session_service/paths.rb +330 -0
- data/lib/google/cloud/discovery_engine/v1/session_service/rest/client.rb +859 -0
- data/lib/google/cloud/discovery_engine/v1/session_service/rest/service_stub.rb +462 -0
- data/lib/google/cloud/discovery_engine/v1/session_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/session_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +3 -3
- data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +3 -3
- data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1.rb +5 -3
- data/lib/google/cloud/discoveryengine/v1/assist_answer_pb.rb +59 -0
- data/lib/google/cloud/discoveryengine/v1/assistant_pb.rb +45 -0
- data/lib/google/cloud/discoveryengine/v1/assistant_service_pb.rb +62 -0
- data/lib/google/cloud/discoveryengine/v1/assistant_service_services_pb.rb +45 -0
- data/lib/google/cloud/discoveryengine/v1/session_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/session_service_pb.rb +49 -0
- data/lib/google/cloud/discoveryengine/v1/session_service_services_pb.rb +64 -0
- data/proto_docs/google/cloud/discoveryengine/v1/assist_answer.rb +278 -0
- data/proto_docs/google/cloud/discoveryengine/v1/assistant.rb +39 -0
- data/proto_docs/google/cloud/discoveryengine/v1/assistant_service.rb +207 -0
- data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +15 -3
- data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +8 -14
- data/proto_docs/google/cloud/discoveryengine/v1/session.rb +20 -4
- metadata +24 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daaa8c7f6e9ee21f73e200cd5402986c8b987d0ca871fbcf9a07f0e59b0962b4
|
4
|
+
data.tar.gz: c26fae4b29e446bcd99a98da6a5d7341d1ed14cb450c9392890e38105ad5c47e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ba96a51a102d65b08aaf26dc1c812c0b7e87fd4ee822115d2058d7b0fbf11845030435cd2358e3cc4511bc7c846dfc2bfa530005d03cb15ed27a86f23cb96c7
|
7
|
+
data.tar.gz: 1740042a54a4888355710146f470596e229bf980d9884b1d981efbc0e304660904eaf00305c9660f467349c751901b6a3195be3ee7296252a77e2f760036e477
|
data/AUTHENTICATION.md
CHANGED
@@ -56,7 +56,7 @@ To configure a credentials file for an individual client initialization:
|
|
56
56
|
```ruby
|
57
57
|
require "google/cloud/discovery_engine/v1"
|
58
58
|
|
59
|
-
client = ::Google::Cloud::DiscoveryEngine::V1::
|
59
|
+
client = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Client.new do |config|
|
60
60
|
config.credentials = "path/to/credentialfile.json"
|
61
61
|
end
|
62
62
|
```
|
@@ -66,11 +66,11 @@ To configure a credentials file globally for all clients:
|
|
66
66
|
```ruby
|
67
67
|
require "google/cloud/discovery_engine/v1"
|
68
68
|
|
69
|
-
::Google::Cloud::DiscoveryEngine::V1::
|
69
|
+
::Google::Cloud::DiscoveryEngine::V1::SearchService::Client.configure do |config|
|
70
70
|
config.credentials = "path/to/credentialfile.json"
|
71
71
|
end
|
72
72
|
|
73
|
-
client = ::Google::Cloud::DiscoveryEngine::V1::
|
73
|
+
client = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Client.new
|
74
74
|
```
|
75
75
|
|
76
76
|
### Environment Variables
|
@@ -100,7 +100,7 @@ require "google/cloud/discovery_engine/v1"
|
|
100
100
|
|
101
101
|
ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json"
|
102
102
|
|
103
|
-
client = ::Google::Cloud::DiscoveryEngine::V1::
|
103
|
+
client = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Client.new
|
104
104
|
```
|
105
105
|
|
106
106
|
### Local ADC file
|
data/README.md
CHANGED
@@ -31,9 +31,9 @@ In order to use this library, you first need to go through the following steps:
|
|
31
31
|
```ruby
|
32
32
|
require "google/cloud/discovery_engine/v1"
|
33
33
|
|
34
|
-
client = ::Google::Cloud::DiscoveryEngine::V1::
|
35
|
-
request = ::Google::Cloud::DiscoveryEngine::V1::
|
36
|
-
response = client.
|
34
|
+
client = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Client.new
|
35
|
+
request = ::Google::Cloud::DiscoveryEngine::V1::SearchRequest.new # (request fields as keyword arguments...)
|
36
|
+
response = client.search request
|
37
37
|
```
|
38
38
|
|
39
39
|
View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-discovery_engine-v1/latest)
|
@@ -74,7 +74,7 @@ constructing a client object. For example:
|
|
74
74
|
require "google/cloud/discovery_engine/v1"
|
75
75
|
require "logger"
|
76
76
|
|
77
|
-
client = ::Google::Cloud::DiscoveryEngine::V1::
|
77
|
+
client = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Client.new do |config|
|
78
78
|
config.logger = Logger.new "my-app.log"
|
79
79
|
end
|
80
80
|
```
|
@@ -0,0 +1,509 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 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/v1/assistant_service_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module DiscoveryEngine
|
26
|
+
module V1
|
27
|
+
module AssistantService
|
28
|
+
##
|
29
|
+
# Client for the AssistantService service.
|
30
|
+
#
|
31
|
+
# Service for managing Assistant configuration and assisting users.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
# @private
|
35
|
+
API_VERSION = ""
|
36
|
+
|
37
|
+
# @private
|
38
|
+
DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
|
39
|
+
|
40
|
+
include Paths
|
41
|
+
|
42
|
+
# @private
|
43
|
+
attr_reader :assistant_service_stub
|
44
|
+
|
45
|
+
##
|
46
|
+
# Configure the AssistantService Client class.
|
47
|
+
#
|
48
|
+
# See {::Google::Cloud::DiscoveryEngine::V1::AssistantService::Client::Configuration}
|
49
|
+
# for a description of the configuration fields.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
#
|
53
|
+
# # Modify the configuration for all AssistantService clients
|
54
|
+
# ::Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.configure do |config|
|
55
|
+
# config.timeout = 10.0
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# @yield [config] Configure the Client client.
|
59
|
+
# @yieldparam config [Client::Configuration]
|
60
|
+
#
|
61
|
+
# @return [Client::Configuration]
|
62
|
+
#
|
63
|
+
def self.configure
|
64
|
+
@configure ||= begin
|
65
|
+
namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
|
66
|
+
parent_config = while namespace.any?
|
67
|
+
parent_name = namespace.join "::"
|
68
|
+
parent_const = const_get parent_name
|
69
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
70
|
+
namespace.pop
|
71
|
+
end
|
72
|
+
default_config = Client::Configuration.new parent_config
|
73
|
+
|
74
|
+
default_config.timeout = 30.0
|
75
|
+
default_config.retry_policy = {
|
76
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
77
|
+
}
|
78
|
+
|
79
|
+
default_config.rpcs.stream_assist.timeout = 300.0
|
80
|
+
default_config.rpcs.stream_assist.retry_policy = {
|
81
|
+
initial_delay: 1.0, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
|
82
|
+
}
|
83
|
+
|
84
|
+
default_config
|
85
|
+
end
|
86
|
+
yield @configure if block_given?
|
87
|
+
@configure
|
88
|
+
end
|
89
|
+
|
90
|
+
##
|
91
|
+
# Configure the AssistantService Client instance.
|
92
|
+
#
|
93
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
94
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
95
|
+
# should be made on {Client.configure}.
|
96
|
+
#
|
97
|
+
# See {::Google::Cloud::DiscoveryEngine::V1::AssistantService::Client::Configuration}
|
98
|
+
# for a description of the configuration fields.
|
99
|
+
#
|
100
|
+
# @yield [config] Configure the Client client.
|
101
|
+
# @yieldparam config [Client::Configuration]
|
102
|
+
#
|
103
|
+
# @return [Client::Configuration]
|
104
|
+
#
|
105
|
+
def configure
|
106
|
+
yield @config if block_given?
|
107
|
+
@config
|
108
|
+
end
|
109
|
+
|
110
|
+
##
|
111
|
+
# The effective universe domain
|
112
|
+
#
|
113
|
+
# @return [String]
|
114
|
+
#
|
115
|
+
def universe_domain
|
116
|
+
@assistant_service_stub.universe_domain
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
# Create a new AssistantService client object.
|
121
|
+
#
|
122
|
+
# @example
|
123
|
+
#
|
124
|
+
# # Create a client using the default configuration
|
125
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.new
|
126
|
+
#
|
127
|
+
# # Create a client using a custom configuration
|
128
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.new do |config|
|
129
|
+
# config.timeout = 10.0
|
130
|
+
# end
|
131
|
+
#
|
132
|
+
# @yield [config] Configure the AssistantService client.
|
133
|
+
# @yieldparam config [Client::Configuration]
|
134
|
+
#
|
135
|
+
def initialize
|
136
|
+
# These require statements are intentionally placed here to initialize
|
137
|
+
# the gRPC module only when it's required.
|
138
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
139
|
+
require "gapic/grpc"
|
140
|
+
require "google/cloud/discoveryengine/v1/assistant_service_services_pb"
|
141
|
+
|
142
|
+
# Create the configuration object
|
143
|
+
@config = Configuration.new Client.configure
|
144
|
+
|
145
|
+
# Yield the configuration if needed
|
146
|
+
yield @config if block_given?
|
147
|
+
|
148
|
+
# Create credentials
|
149
|
+
credentials = @config.credentials
|
150
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
151
|
+
# but only if the default endpoint does not have a region prefix.
|
152
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
153
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
154
|
+
!@config.endpoint.split(".").first.include?("-"))
|
155
|
+
credentials ||= Credentials.default scope: @config.scope,
|
156
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
157
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
158
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
159
|
+
end
|
160
|
+
@quota_project_id = @config.quota_project
|
161
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
162
|
+
|
163
|
+
@assistant_service_stub = ::Gapic::ServiceStub.new(
|
164
|
+
::Google::Cloud::DiscoveryEngine::V1::AssistantService::Stub,
|
165
|
+
credentials: credentials,
|
166
|
+
endpoint: @config.endpoint,
|
167
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
168
|
+
universe_domain: @config.universe_domain,
|
169
|
+
channel_args: @config.channel_args,
|
170
|
+
interceptors: @config.interceptors,
|
171
|
+
channel_pool_config: @config.channel_pool,
|
172
|
+
logger: @config.logger
|
173
|
+
)
|
174
|
+
|
175
|
+
@assistant_service_stub.stub_logger&.info do |entry|
|
176
|
+
entry.set_system_name
|
177
|
+
entry.set_service
|
178
|
+
entry.message = "Created client for #{entry.service}"
|
179
|
+
entry.set_credentials_fields credentials
|
180
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
181
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
182
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
183
|
+
end
|
184
|
+
|
185
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
186
|
+
config.credentials = credentials
|
187
|
+
config.quota_project = @quota_project_id
|
188
|
+
config.endpoint = @assistant_service_stub.endpoint
|
189
|
+
config.universe_domain = @assistant_service_stub.universe_domain
|
190
|
+
config.logger = @assistant_service_stub.logger if config.respond_to? :logger=
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
##
|
195
|
+
# Get the associated client for mix-in of the Locations.
|
196
|
+
#
|
197
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
198
|
+
#
|
199
|
+
attr_reader :location_client
|
200
|
+
|
201
|
+
##
|
202
|
+
# The logger used for request/response debug logging.
|
203
|
+
#
|
204
|
+
# @return [Logger]
|
205
|
+
#
|
206
|
+
def logger
|
207
|
+
@assistant_service_stub.logger
|
208
|
+
end
|
209
|
+
|
210
|
+
# Service calls
|
211
|
+
|
212
|
+
##
|
213
|
+
# Assists the user with a query in a streaming fashion.
|
214
|
+
#
|
215
|
+
# @overload stream_assist(request, options = nil)
|
216
|
+
# Pass arguments to `stream_assist` via a request object, either of type
|
217
|
+
# {::Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest} or an equivalent Hash.
|
218
|
+
#
|
219
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest, ::Hash]
|
220
|
+
# A request object representing the call parameters. Required. To specify no
|
221
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
222
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
223
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
224
|
+
#
|
225
|
+
# @overload stream_assist(name: nil, query: nil, session: nil, user_metadata: nil, tools_spec: nil, generation_spec: nil)
|
226
|
+
# Pass arguments to `stream_assist` via keyword arguments. Note that at
|
227
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
228
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
229
|
+
#
|
230
|
+
# @param name [::String]
|
231
|
+
# Required. The resource name of the
|
232
|
+
# {::Google::Cloud::DiscoveryEngine::V1::Assistant Assistant}. Format:
|
233
|
+
# `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}`
|
234
|
+
# @param query [::Google::Cloud::DiscoveryEngine::V1::Query, ::Hash]
|
235
|
+
# Optional. Current user query.
|
236
|
+
#
|
237
|
+
# Empty query is only supported if `file_ids` are provided. In this case, the
|
238
|
+
# answer will be generated based on those context files.
|
239
|
+
# @param session [::String]
|
240
|
+
# Optional. The session to use for the request. If specified, the assistant
|
241
|
+
# has access to the session history, and the query and the answer are stored
|
242
|
+
# there.
|
243
|
+
#
|
244
|
+
# If `-` is specified as the session ID, or it is left empty, then a new
|
245
|
+
# session is created with an automatically generated ID.
|
246
|
+
#
|
247
|
+
# Format:
|
248
|
+
# `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}`
|
249
|
+
# @param user_metadata [::Google::Cloud::DiscoveryEngine::V1::AssistUserMetadata, ::Hash]
|
250
|
+
# Optional. Information about the user initiating the query.
|
251
|
+
# @param tools_spec [::Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest::ToolsSpec, ::Hash]
|
252
|
+
# Optional. Specification of tools that are used to serve the request.
|
253
|
+
# @param generation_spec [::Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest::GenerationSpec, ::Hash]
|
254
|
+
# Optional. Specification of the generation configuration for the request.
|
255
|
+
#
|
256
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
257
|
+
# @yieldparam response [::Enumerable<::Google::Cloud::DiscoveryEngine::V1::StreamAssistResponse>]
|
258
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
259
|
+
#
|
260
|
+
# @return [::Enumerable<::Google::Cloud::DiscoveryEngine::V1::StreamAssistResponse>]
|
261
|
+
#
|
262
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
263
|
+
#
|
264
|
+
# @example Basic example
|
265
|
+
# require "google/cloud/discovery_engine/v1"
|
266
|
+
#
|
267
|
+
# # Create a client object. The client can be reused for multiple calls.
|
268
|
+
# client = Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.new
|
269
|
+
#
|
270
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
271
|
+
# request = Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest.new
|
272
|
+
#
|
273
|
+
# # Call the stream_assist method to start streaming.
|
274
|
+
# output = client.stream_assist request
|
275
|
+
#
|
276
|
+
# # The returned object is a streamed enumerable yielding elements of type
|
277
|
+
# # ::Google::Cloud::DiscoveryEngine::V1::StreamAssistResponse
|
278
|
+
# output.each do |current_response|
|
279
|
+
# p current_response
|
280
|
+
# end
|
281
|
+
#
|
282
|
+
def stream_assist request, options = nil
|
283
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
284
|
+
|
285
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::StreamAssistRequest
|
286
|
+
|
287
|
+
# Converts hash and nil to an options object
|
288
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
289
|
+
|
290
|
+
# Customize the options with defaults
|
291
|
+
metadata = @config.rpcs.stream_assist.metadata.to_h
|
292
|
+
|
293
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
294
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
295
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
296
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
297
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
298
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
299
|
+
|
300
|
+
header_params = {}
|
301
|
+
if request.name
|
302
|
+
header_params["name"] = request.name
|
303
|
+
end
|
304
|
+
|
305
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
306
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
307
|
+
|
308
|
+
options.apply_defaults timeout: @config.rpcs.stream_assist.timeout,
|
309
|
+
metadata: metadata,
|
310
|
+
retry_policy: @config.rpcs.stream_assist.retry_policy
|
311
|
+
|
312
|
+
options.apply_defaults timeout: @config.timeout,
|
313
|
+
metadata: @config.metadata,
|
314
|
+
retry_policy: @config.retry_policy
|
315
|
+
|
316
|
+
@assistant_service_stub.call_rpc :stream_assist, request, options: options do |response, operation|
|
317
|
+
yield response, operation if block_given?
|
318
|
+
end
|
319
|
+
rescue ::GRPC::BadStatus => e
|
320
|
+
raise ::Google::Cloud::Error.from_error(e)
|
321
|
+
end
|
322
|
+
|
323
|
+
##
|
324
|
+
# Configuration class for the AssistantService API.
|
325
|
+
#
|
326
|
+
# This class represents the configuration for AssistantService,
|
327
|
+
# providing control over timeouts, retry behavior, logging, transport
|
328
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
329
|
+
# applied individually to specific RPCs. See
|
330
|
+
# {::Google::Cloud::DiscoveryEngine::V1::AssistantService::Client::Configuration::Rpcs}
|
331
|
+
# for a list of RPCs that can be configured independently.
|
332
|
+
#
|
333
|
+
# Configuration can be applied globally to all clients, or to a single client
|
334
|
+
# on construction.
|
335
|
+
#
|
336
|
+
# @example
|
337
|
+
#
|
338
|
+
# # Modify the global config, setting the timeout for
|
339
|
+
# # stream_assist to 20 seconds,
|
340
|
+
# # and all remaining timeouts to 10 seconds.
|
341
|
+
# ::Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.configure do |config|
|
342
|
+
# config.timeout = 10.0
|
343
|
+
# config.rpcs.stream_assist.timeout = 20.0
|
344
|
+
# end
|
345
|
+
#
|
346
|
+
# # Apply the above configuration only to a new client.
|
347
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::AssistantService::Client.new do |config|
|
348
|
+
# config.timeout = 10.0
|
349
|
+
# config.rpcs.stream_assist.timeout = 20.0
|
350
|
+
# end
|
351
|
+
#
|
352
|
+
# @!attribute [rw] endpoint
|
353
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
354
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
355
|
+
# @return [::String,nil]
|
356
|
+
# @!attribute [rw] credentials
|
357
|
+
# Credentials to send with calls. You may provide any of the following types:
|
358
|
+
# * (`String`) The path to a service account key file in JSON format
|
359
|
+
# * (`Hash`) A service account key as a Hash
|
360
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
361
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
362
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
363
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
364
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
365
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
366
|
+
# * (`nil`) indicating no credentials
|
367
|
+
#
|
368
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
369
|
+
# external source for authentication to Google Cloud, you must validate it before
|
370
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
371
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
372
|
+
# For more information, refer to [Validate credential configurations from external
|
373
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
374
|
+
# @return [::Object]
|
375
|
+
# @!attribute [rw] scope
|
376
|
+
# The OAuth scopes
|
377
|
+
# @return [::Array<::String>]
|
378
|
+
# @!attribute [rw] lib_name
|
379
|
+
# The library name as recorded in instrumentation and logging
|
380
|
+
# @return [::String]
|
381
|
+
# @!attribute [rw] lib_version
|
382
|
+
# The library version as recorded in instrumentation and logging
|
383
|
+
# @return [::String]
|
384
|
+
# @!attribute [rw] channel_args
|
385
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
386
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
387
|
+
# @return [::Hash]
|
388
|
+
# @!attribute [rw] interceptors
|
389
|
+
# An array of interceptors that are run before calls are executed.
|
390
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
391
|
+
# @!attribute [rw] timeout
|
392
|
+
# The call timeout in seconds.
|
393
|
+
# @return [::Numeric]
|
394
|
+
# @!attribute [rw] metadata
|
395
|
+
# Additional gRPC headers to be sent with the call.
|
396
|
+
# @return [::Hash{::Symbol=>::String}]
|
397
|
+
# @!attribute [rw] retry_policy
|
398
|
+
# The retry policy. The value is a hash with the following keys:
|
399
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
400
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
401
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
402
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
403
|
+
# trigger a retry.
|
404
|
+
# @return [::Hash]
|
405
|
+
# @!attribute [rw] quota_project
|
406
|
+
# A separate project against which to charge quota.
|
407
|
+
# @return [::String]
|
408
|
+
# @!attribute [rw] universe_domain
|
409
|
+
# The universe domain within which to make requests. This determines the
|
410
|
+
# default endpoint URL. The default value of nil uses the environment
|
411
|
+
# universe (usually the default "googleapis.com" universe).
|
412
|
+
# @return [::String,nil]
|
413
|
+
# @!attribute [rw] logger
|
414
|
+
# A custom logger to use for request/response debug logging, or the value
|
415
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
416
|
+
# explicitly disable logging.
|
417
|
+
# @return [::Logger,:default,nil]
|
418
|
+
#
|
419
|
+
class Configuration
|
420
|
+
extend ::Gapic::Config
|
421
|
+
|
422
|
+
# @private
|
423
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
424
|
+
DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
|
425
|
+
|
426
|
+
config_attr :endpoint, nil, ::String, nil
|
427
|
+
config_attr :credentials, nil do |value|
|
428
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
429
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
|
430
|
+
allowed.any? { |klass| klass === value }
|
431
|
+
end
|
432
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
433
|
+
config_attr :lib_name, nil, ::String, nil
|
434
|
+
config_attr :lib_version, nil, ::String, nil
|
435
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
436
|
+
config_attr :interceptors, nil, ::Array, nil
|
437
|
+
config_attr :timeout, nil, ::Numeric, nil
|
438
|
+
config_attr :metadata, nil, ::Hash, nil
|
439
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
440
|
+
config_attr :quota_project, nil, ::String, nil
|
441
|
+
config_attr :universe_domain, nil, ::String, nil
|
442
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
443
|
+
|
444
|
+
# @private
|
445
|
+
def initialize parent_config = nil
|
446
|
+
@parent_config = parent_config unless parent_config.nil?
|
447
|
+
|
448
|
+
yield self if block_given?
|
449
|
+
end
|
450
|
+
|
451
|
+
##
|
452
|
+
# Configurations for individual RPCs
|
453
|
+
# @return [Rpcs]
|
454
|
+
#
|
455
|
+
def rpcs
|
456
|
+
@rpcs ||= begin
|
457
|
+
parent_rpcs = nil
|
458
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
459
|
+
Rpcs.new parent_rpcs
|
460
|
+
end
|
461
|
+
end
|
462
|
+
|
463
|
+
##
|
464
|
+
# Configuration for the channel pool
|
465
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
466
|
+
#
|
467
|
+
def channel_pool
|
468
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
469
|
+
end
|
470
|
+
|
471
|
+
##
|
472
|
+
# Configuration RPC class for the AssistantService API.
|
473
|
+
#
|
474
|
+
# Includes fields providing the configuration for each RPC in this service.
|
475
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
476
|
+
# the following configuration fields:
|
477
|
+
#
|
478
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
479
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
480
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
481
|
+
# include the following keys:
|
482
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
483
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
484
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
485
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
486
|
+
# trigger a retry.
|
487
|
+
#
|
488
|
+
class Rpcs
|
489
|
+
##
|
490
|
+
# RPC-specific configuration for `stream_assist`
|
491
|
+
# @return [::Gapic::Config::Method]
|
492
|
+
#
|
493
|
+
attr_reader :stream_assist
|
494
|
+
|
495
|
+
# @private
|
496
|
+
def initialize parent_rpcs = nil
|
497
|
+
stream_assist_config = parent_rpcs.stream_assist if parent_rpcs.respond_to? :stream_assist
|
498
|
+
@stream_assist = ::Gapic::Config::Method.new stream_assist_config
|
499
|
+
|
500
|
+
yield self if block_given?
|
501
|
+
end
|
502
|
+
end
|
503
|
+
end
|
504
|
+
end
|
505
|
+
end
|
506
|
+
end
|
507
|
+
end
|
508
|
+
end
|
509
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 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 "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module DiscoveryEngine
|
24
|
+
module V1
|
25
|
+
module AssistantService
|
26
|
+
# Credentials for the AssistantService API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
30
|
+
]
|
31
|
+
self.env_vars = [
|
32
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
33
|
+
"GOOGLE_CLOUD_KEYFILE",
|
34
|
+
"GCLOUD_KEYFILE",
|
35
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
36
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
37
|
+
"GCLOUD_KEYFILE_JSON"
|
38
|
+
]
|
39
|
+
self.paths = [
|
40
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
41
|
+
]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|