google-cloud-discovery_engine-v1 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google/cloud/discovery_engine/v1/completion_service/client.rb +9 -3
- data/lib/google/cloud/discovery_engine/v1/completion_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/completion_service/rest/client.rb +9 -3
- data/lib/google/cloud/discovery_engine/v1/completion_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/control_service/client.rb +875 -0
- data/lib/google/cloud/discovery_engine/v1/control_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/control_service/paths.rb +167 -0
- data/lib/google/cloud/discovery_engine/v1/control_service/rest/client.rb +814 -0
- data/lib/google/cloud/discovery_engine/v1/control_service/rest/service_stub.rb +440 -0
- data/lib/google/cloud/discovery_engine/v1/control_service/rest.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1/control_service.rb +58 -0
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +764 -6
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/paths.rb +199 -0
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +715 -6
- data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/service_stub.rb +520 -0
- data/lib/google/cloud/discovery_engine/v1/data_store_service/client.rb +15 -7
- data/lib/google/cloud/discovery_engine/v1/data_store_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/data_store_service/paths.rb +45 -0
- data/lib/google/cloud/discovery_engine/v1/data_store_service/rest/client.rb +15 -7
- data/lib/google/cloud/discovery_engine/v1/data_store_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +23 -13
- data/lib/google/cloud/discovery_engine/v1/document_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +23 -13
- data/lib/google/cloud/discovery_engine/v1/document_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/engine_service/client.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/engine_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/engine_service/rest/client.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/engine_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/client.rb +471 -0
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/paths.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest/client.rb +438 -0
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest/service_stub.rb +129 -0
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/grounded_generation_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/client.rb +485 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/operations.rb +809 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/paths.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/rest/client.rb +452 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/rest/operations.rb +1114 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/rest/service_stub.rb +129 -0
- data/lib/google/cloud/discovery_engine/v1/project_service/rest.rb +54 -0
- data/lib/google/cloud/discovery_engine/v1/project_service.rb +57 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service/client.rb +481 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service/paths.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service/rest/client.rb +448 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service/rest/service_stub.rb +129 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1/rank_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1/recommendation_service/client.rb +24 -19
- data/lib/google/cloud/discovery_engine/v1/recommendation_service/paths.rb +66 -0
- data/lib/google/cloud/discovery_engine/v1/recommendation_service/rest/client.rb +24 -19
- data/lib/google/cloud/discovery_engine/v1/rest.rb +4 -0
- data/lib/google/cloud/discovery_engine/v1/schema_service/client.rb +18 -10
- data/lib/google/cloud/discovery_engine/v1/schema_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/schema_service/rest/client.rb +18 -10
- data/lib/google/cloud/discovery_engine/v1/schema_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +15 -8
- data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +15 -8
- data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/client.rb +27 -12
- data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/rest/client.rb +27 -12
- data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +23 -6
- data/lib/google/cloud/discovery_engine/v1/user_event_service/operations.rb +13 -5
- data/lib/google/cloud/discovery_engine/v1/user_event_service/paths.rb +21 -0
- data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +23 -6
- data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/operations.rb +28 -5
- data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/service_stub.rb +8 -0
- data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
- data/lib/google/cloud/discovery_engine/v1.rb +4 -0
- data/lib/google/cloud/discoveryengine/v1/answer_pb.rb +69 -0
- data/lib/google/cloud/discoveryengine/v1/common_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1/control_pb.rb +55 -0
- data/lib/google/cloud/discoveryengine/v1/control_service_pb.rb +57 -0
- data/lib/google/cloud/discoveryengine/v1/control_service_services_pb.rb +69 -0
- data/lib/google/cloud/discoveryengine/v1/conversational_search_service_pb.rb +32 -1
- data/lib/google/cloud/discoveryengine/v1/conversational_search_service_services_pb.rb +25 -0
- data/lib/google/cloud/discoveryengine/v1/data_store_pb.rb +3 -1
- data/lib/google/cloud/discoveryengine/v1/document_processing_config_pb.rb +48 -0
- data/lib/google/cloud/discoveryengine/v1/document_service_services_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/engine_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/grounded_generation_service_pb.rb +52 -0
- data/lib/google/cloud/discoveryengine/v1/grounded_generation_service_services_pb.rb +45 -0
- data/lib/google/cloud/discoveryengine/v1/grounding_pb.rb +46 -0
- data/lib/google/cloud/discoveryengine/v1/project_pb.rb +49 -0
- data/lib/google/cloud/discoveryengine/v1/project_service_pb.rb +50 -0
- data/lib/google/cloud/discoveryengine/v1/project_service_services_pb.rb +51 -0
- data/lib/google/cloud/discoveryengine/v1/rank_service_pb.rb +49 -0
- data/lib/google/cloud/discoveryengine/v1/rank_service_services_pb.rb +45 -0
- data/lib/google/cloud/discoveryengine/v1/session_pb.rb +50 -0
- data/lib/google/cloud/discoveryengine/v1/site_search_engine_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/user_event_service_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1/user_event_service_services_pb.rb +1 -1
- data/proto_docs/google/cloud/discoveryengine/v1/answer.rb +362 -0
- data/proto_docs/google/cloud/discoveryengine/v1/common.rb +16 -0
- data/proto_docs/google/cloud/discoveryengine/v1/control.rb +207 -0
- data/proto_docs/google/cloud/discoveryengine/v1/control_service.rb +126 -0
- data/proto_docs/google/cloud/discoveryengine/v1/conversation.rb +2 -2
- data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +485 -0
- data/proto_docs/google/cloud/discoveryengine/v1/data_store.rb +3 -0
- data/proto_docs/google/cloud/discoveryengine/v1/data_store_service.rb +2 -2
- data/proto_docs/google/cloud/discoveryengine/v1/document_processing_config.rb +102 -0
- data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +5 -5
- data/proto_docs/google/cloud/discoveryengine/v1/engine.rb +3 -3
- data/proto_docs/google/cloud/discoveryengine/v1/grounded_generation_service.rb +144 -0
- data/proto_docs/google/cloud/discoveryengine/v1/grounding.rb +79 -0
- data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +4 -4
- data/proto_docs/google/cloud/discoveryengine/v1/project.rb +106 -0
- data/proto_docs/google/cloud/discoveryengine/v1/project_service.rb +57 -0
- data/proto_docs/google/cloud/discoveryengine/v1/rank_service.rb +124 -0
- data/proto_docs/google/cloud/discoveryengine/v1/recommendation_service.rb +20 -19
- data/proto_docs/google/cloud/discoveryengine/v1/schema_service.rb +5 -5
- data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +23 -18
- data/proto_docs/google/cloud/discoveryengine/v1/session.rb +88 -0
- data/proto_docs/google/cloud/discoveryengine/v1/site_search_engine.rb +3 -0
- data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +24 -3
- data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +13 -1
- metadata +56 -2
@@ -0,0 +1,471 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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/grounded_generation_service_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module DiscoveryEngine
|
26
|
+
module V1
|
27
|
+
module GroundedGenerationService
|
28
|
+
##
|
29
|
+
# Client for the GroundedGenerationService service.
|
30
|
+
#
|
31
|
+
# Service for grounded generation.
|
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 :grounded_generation_service_stub
|
44
|
+
|
45
|
+
##
|
46
|
+
# Configure the GroundedGenerationService Client class.
|
47
|
+
#
|
48
|
+
# See {::Google::Cloud::DiscoveryEngine::V1::GroundedGenerationService::Client::Configuration}
|
49
|
+
# for a description of the configuration fields.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
#
|
53
|
+
# # Modify the configuration for all GroundedGenerationService clients
|
54
|
+
# ::Google::Cloud::DiscoveryEngine::V1::GroundedGenerationService::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 = 5.0
|
75
|
+
default_config.retry_policy = {
|
76
|
+
initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14]
|
77
|
+
}
|
78
|
+
|
79
|
+
default_config
|
80
|
+
end
|
81
|
+
yield @configure if block_given?
|
82
|
+
@configure
|
83
|
+
end
|
84
|
+
|
85
|
+
##
|
86
|
+
# Configure the GroundedGenerationService Client instance.
|
87
|
+
#
|
88
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
89
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
90
|
+
# should be made on {Client.configure}.
|
91
|
+
#
|
92
|
+
# See {::Google::Cloud::DiscoveryEngine::V1::GroundedGenerationService::Client::Configuration}
|
93
|
+
# for a description of the configuration fields.
|
94
|
+
#
|
95
|
+
# @yield [config] Configure the Client client.
|
96
|
+
# @yieldparam config [Client::Configuration]
|
97
|
+
#
|
98
|
+
# @return [Client::Configuration]
|
99
|
+
#
|
100
|
+
def configure
|
101
|
+
yield @config if block_given?
|
102
|
+
@config
|
103
|
+
end
|
104
|
+
|
105
|
+
##
|
106
|
+
# The effective universe domain
|
107
|
+
#
|
108
|
+
# @return [String]
|
109
|
+
#
|
110
|
+
def universe_domain
|
111
|
+
@grounded_generation_service_stub.universe_domain
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Create a new GroundedGenerationService client object.
|
116
|
+
#
|
117
|
+
# @example
|
118
|
+
#
|
119
|
+
# # Create a client using the default configuration
|
120
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::GroundedGenerationService::Client.new
|
121
|
+
#
|
122
|
+
# # Create a client using a custom configuration
|
123
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::GroundedGenerationService::Client.new do |config|
|
124
|
+
# config.timeout = 10.0
|
125
|
+
# end
|
126
|
+
#
|
127
|
+
# @yield [config] Configure the GroundedGenerationService client.
|
128
|
+
# @yieldparam config [Client::Configuration]
|
129
|
+
#
|
130
|
+
def initialize
|
131
|
+
# These require statements are intentionally placed here to initialize
|
132
|
+
# the gRPC module only when it's required.
|
133
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
134
|
+
require "gapic/grpc"
|
135
|
+
require "google/cloud/discoveryengine/v1/grounded_generation_service_services_pb"
|
136
|
+
|
137
|
+
# Create the configuration object
|
138
|
+
@config = Configuration.new Client.configure
|
139
|
+
|
140
|
+
# Yield the configuration if needed
|
141
|
+
yield @config if block_given?
|
142
|
+
|
143
|
+
# Create credentials
|
144
|
+
credentials = @config.credentials
|
145
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
146
|
+
# but only if the default endpoint does not have a region prefix.
|
147
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
148
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
149
|
+
!@config.endpoint.split(".").first.include?("-"))
|
150
|
+
credentials ||= Credentials.default scope: @config.scope,
|
151
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
152
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
153
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
154
|
+
end
|
155
|
+
@quota_project_id = @config.quota_project
|
156
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
157
|
+
|
158
|
+
@grounded_generation_service_stub = ::Gapic::ServiceStub.new(
|
159
|
+
::Google::Cloud::DiscoveryEngine::V1::GroundedGenerationService::Stub,
|
160
|
+
credentials: credentials,
|
161
|
+
endpoint: @config.endpoint,
|
162
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
163
|
+
universe_domain: @config.universe_domain,
|
164
|
+
channel_args: @config.channel_args,
|
165
|
+
interceptors: @config.interceptors,
|
166
|
+
channel_pool_config: @config.channel_pool
|
167
|
+
)
|
168
|
+
|
169
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
170
|
+
config.credentials = credentials
|
171
|
+
config.quota_project = @quota_project_id
|
172
|
+
config.endpoint = @grounded_generation_service_stub.endpoint
|
173
|
+
config.universe_domain = @grounded_generation_service_stub.universe_domain
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
##
|
178
|
+
# Get the associated client for mix-in of the Locations.
|
179
|
+
#
|
180
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
181
|
+
#
|
182
|
+
attr_reader :location_client
|
183
|
+
|
184
|
+
# Service calls
|
185
|
+
|
186
|
+
##
|
187
|
+
# Performs a grounding check.
|
188
|
+
#
|
189
|
+
# @overload check_grounding(request, options = nil)
|
190
|
+
# Pass arguments to `check_grounding` via a request object, either of type
|
191
|
+
# {::Google::Cloud::DiscoveryEngine::V1::CheckGroundingRequest} or an equivalent Hash.
|
192
|
+
#
|
193
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1::CheckGroundingRequest, ::Hash]
|
194
|
+
# A request object representing the call parameters. Required. To specify no
|
195
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
196
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
197
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
198
|
+
#
|
199
|
+
# @overload check_grounding(grounding_config: nil, answer_candidate: nil, facts: nil, grounding_spec: nil, user_labels: nil)
|
200
|
+
# Pass arguments to `check_grounding` via keyword arguments. Note that at
|
201
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
202
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
203
|
+
#
|
204
|
+
# @param grounding_config [::String]
|
205
|
+
# Required. The resource name of the grounding config, such as
|
206
|
+
# `projects/*/locations/global/groundingConfigs/default_grounding_config`.
|
207
|
+
# @param answer_candidate [::String]
|
208
|
+
# Answer candidate to check. Can have a maximum length of 1024 characters.
|
209
|
+
# @param facts [::Array<::Google::Cloud::DiscoveryEngine::V1::GroundingFact, ::Hash>]
|
210
|
+
# List of facts for the grounding check.
|
211
|
+
# We support up to 200 facts.
|
212
|
+
# @param grounding_spec [::Google::Cloud::DiscoveryEngine::V1::CheckGroundingSpec, ::Hash]
|
213
|
+
# Configuration of the grounding check.
|
214
|
+
# @param user_labels [::Hash{::String => ::String}]
|
215
|
+
# The user labels applied to a resource must meet the following requirements:
|
216
|
+
#
|
217
|
+
# * Each resource can have multiple labels, up to a maximum of 64.
|
218
|
+
# * Each label must be a key-value pair.
|
219
|
+
# * Keys have a minimum length of 1 character and a maximum length of 63
|
220
|
+
# characters and cannot be empty. Values can be empty and have a maximum
|
221
|
+
# length of 63 characters.
|
222
|
+
# * Keys and values can contain only lowercase letters, numeric characters,
|
223
|
+
# underscores, and dashes. All characters must use UTF-8 encoding, and
|
224
|
+
# international characters are allowed.
|
225
|
+
# * The key portion of a label must be unique. However, you can use the same
|
226
|
+
# key with multiple resources.
|
227
|
+
# * Keys must start with a lowercase letter or international character.
|
228
|
+
#
|
229
|
+
# See [Google Cloud
|
230
|
+
# Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
|
231
|
+
# for more details.
|
232
|
+
#
|
233
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
234
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::CheckGroundingResponse]
|
235
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
236
|
+
#
|
237
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1::CheckGroundingResponse]
|
238
|
+
#
|
239
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
240
|
+
#
|
241
|
+
# @example Basic example
|
242
|
+
# require "google/cloud/discovery_engine/v1"
|
243
|
+
#
|
244
|
+
# # Create a client object. The client can be reused for multiple calls.
|
245
|
+
# client = Google::Cloud::DiscoveryEngine::V1::GroundedGenerationService::Client.new
|
246
|
+
#
|
247
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
248
|
+
# request = Google::Cloud::DiscoveryEngine::V1::CheckGroundingRequest.new
|
249
|
+
#
|
250
|
+
# # Call the check_grounding method.
|
251
|
+
# result = client.check_grounding request
|
252
|
+
#
|
253
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1::CheckGroundingResponse.
|
254
|
+
# p result
|
255
|
+
#
|
256
|
+
def check_grounding request, options = nil
|
257
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
258
|
+
|
259
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::CheckGroundingRequest
|
260
|
+
|
261
|
+
# Converts hash and nil to an options object
|
262
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
263
|
+
|
264
|
+
# Customize the options with defaults
|
265
|
+
metadata = @config.rpcs.check_grounding.metadata.to_h
|
266
|
+
|
267
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
268
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
269
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
270
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
|
271
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
272
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
273
|
+
|
274
|
+
header_params = {}
|
275
|
+
if request.grounding_config
|
276
|
+
header_params["grounding_config"] = request.grounding_config
|
277
|
+
end
|
278
|
+
|
279
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
280
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
281
|
+
|
282
|
+
options.apply_defaults timeout: @config.rpcs.check_grounding.timeout,
|
283
|
+
metadata: metadata,
|
284
|
+
retry_policy: @config.rpcs.check_grounding.retry_policy
|
285
|
+
|
286
|
+
options.apply_defaults timeout: @config.timeout,
|
287
|
+
metadata: @config.metadata,
|
288
|
+
retry_policy: @config.retry_policy
|
289
|
+
|
290
|
+
@grounded_generation_service_stub.call_rpc :check_grounding, request, options: options do |response, operation|
|
291
|
+
yield response, operation if block_given?
|
292
|
+
return response
|
293
|
+
end
|
294
|
+
rescue ::GRPC::BadStatus => e
|
295
|
+
raise ::Google::Cloud::Error.from_error(e)
|
296
|
+
end
|
297
|
+
|
298
|
+
##
|
299
|
+
# Configuration class for the GroundedGenerationService API.
|
300
|
+
#
|
301
|
+
# This class represents the configuration for GroundedGenerationService,
|
302
|
+
# providing control over timeouts, retry behavior, logging, transport
|
303
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
304
|
+
# applied individually to specific RPCs. See
|
305
|
+
# {::Google::Cloud::DiscoveryEngine::V1::GroundedGenerationService::Client::Configuration::Rpcs}
|
306
|
+
# for a list of RPCs that can be configured independently.
|
307
|
+
#
|
308
|
+
# Configuration can be applied globally to all clients, or to a single client
|
309
|
+
# on construction.
|
310
|
+
#
|
311
|
+
# @example
|
312
|
+
#
|
313
|
+
# # Modify the global config, setting the timeout for
|
314
|
+
# # check_grounding to 20 seconds,
|
315
|
+
# # and all remaining timeouts to 10 seconds.
|
316
|
+
# ::Google::Cloud::DiscoveryEngine::V1::GroundedGenerationService::Client.configure do |config|
|
317
|
+
# config.timeout = 10.0
|
318
|
+
# config.rpcs.check_grounding.timeout = 20.0
|
319
|
+
# end
|
320
|
+
#
|
321
|
+
# # Apply the above configuration only to a new client.
|
322
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1::GroundedGenerationService::Client.new do |config|
|
323
|
+
# config.timeout = 10.0
|
324
|
+
# config.rpcs.check_grounding.timeout = 20.0
|
325
|
+
# end
|
326
|
+
#
|
327
|
+
# @!attribute [rw] endpoint
|
328
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
329
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
330
|
+
# @return [::String,nil]
|
331
|
+
# @!attribute [rw] credentials
|
332
|
+
# Credentials to send with calls. You may provide any of the following types:
|
333
|
+
# * (`String`) The path to a service account key file in JSON format
|
334
|
+
# * (`Hash`) A service account key as a Hash
|
335
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
336
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
337
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
338
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
339
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
340
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
341
|
+
# * (`nil`) indicating no credentials
|
342
|
+
# @return [::Object]
|
343
|
+
# @!attribute [rw] scope
|
344
|
+
# The OAuth scopes
|
345
|
+
# @return [::Array<::String>]
|
346
|
+
# @!attribute [rw] lib_name
|
347
|
+
# The library name as recorded in instrumentation and logging
|
348
|
+
# @return [::String]
|
349
|
+
# @!attribute [rw] lib_version
|
350
|
+
# The library version as recorded in instrumentation and logging
|
351
|
+
# @return [::String]
|
352
|
+
# @!attribute [rw] channel_args
|
353
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
354
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
355
|
+
# @return [::Hash]
|
356
|
+
# @!attribute [rw] interceptors
|
357
|
+
# An array of interceptors that are run before calls are executed.
|
358
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
359
|
+
# @!attribute [rw] timeout
|
360
|
+
# The call timeout in seconds.
|
361
|
+
# @return [::Numeric]
|
362
|
+
# @!attribute [rw] metadata
|
363
|
+
# Additional gRPC headers to be sent with the call.
|
364
|
+
# @return [::Hash{::Symbol=>::String}]
|
365
|
+
# @!attribute [rw] retry_policy
|
366
|
+
# The retry policy. The value is a hash with the following keys:
|
367
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
368
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
369
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
370
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
371
|
+
# trigger a retry.
|
372
|
+
# @return [::Hash]
|
373
|
+
# @!attribute [rw] quota_project
|
374
|
+
# A separate project against which to charge quota.
|
375
|
+
# @return [::String]
|
376
|
+
# @!attribute [rw] universe_domain
|
377
|
+
# The universe domain within which to make requests. This determines the
|
378
|
+
# default endpoint URL. The default value of nil uses the environment
|
379
|
+
# universe (usually the default "googleapis.com" universe).
|
380
|
+
# @return [::String,nil]
|
381
|
+
#
|
382
|
+
class Configuration
|
383
|
+
extend ::Gapic::Config
|
384
|
+
|
385
|
+
# @private
|
386
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
387
|
+
DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
|
388
|
+
|
389
|
+
config_attr :endpoint, nil, ::String, nil
|
390
|
+
config_attr :credentials, nil do |value|
|
391
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
392
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
393
|
+
allowed.any? { |klass| klass === value }
|
394
|
+
end
|
395
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
396
|
+
config_attr :lib_name, nil, ::String, nil
|
397
|
+
config_attr :lib_version, nil, ::String, nil
|
398
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
399
|
+
config_attr :interceptors, nil, ::Array, nil
|
400
|
+
config_attr :timeout, nil, ::Numeric, nil
|
401
|
+
config_attr :metadata, nil, ::Hash, nil
|
402
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
403
|
+
config_attr :quota_project, nil, ::String, nil
|
404
|
+
config_attr :universe_domain, nil, ::String, nil
|
405
|
+
|
406
|
+
# @private
|
407
|
+
def initialize parent_config = nil
|
408
|
+
@parent_config = parent_config unless parent_config.nil?
|
409
|
+
|
410
|
+
yield self if block_given?
|
411
|
+
end
|
412
|
+
|
413
|
+
##
|
414
|
+
# Configurations for individual RPCs
|
415
|
+
# @return [Rpcs]
|
416
|
+
#
|
417
|
+
def rpcs
|
418
|
+
@rpcs ||= begin
|
419
|
+
parent_rpcs = nil
|
420
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
421
|
+
Rpcs.new parent_rpcs
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
425
|
+
##
|
426
|
+
# Configuration for the channel pool
|
427
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
428
|
+
#
|
429
|
+
def channel_pool
|
430
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
431
|
+
end
|
432
|
+
|
433
|
+
##
|
434
|
+
# Configuration RPC class for the GroundedGenerationService API.
|
435
|
+
#
|
436
|
+
# Includes fields providing the configuration for each RPC in this service.
|
437
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
438
|
+
# the following configuration fields:
|
439
|
+
#
|
440
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
441
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
442
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
443
|
+
# include the following keys:
|
444
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
445
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
446
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
447
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
448
|
+
# trigger a retry.
|
449
|
+
#
|
450
|
+
class Rpcs
|
451
|
+
##
|
452
|
+
# RPC-specific configuration for `check_grounding`
|
453
|
+
# @return [::Gapic::Config::Method]
|
454
|
+
#
|
455
|
+
attr_reader :check_grounding
|
456
|
+
|
457
|
+
# @private
|
458
|
+
def initialize parent_rpcs = nil
|
459
|
+
check_grounding_config = parent_rpcs.check_grounding if parent_rpcs.respond_to? :check_grounding
|
460
|
+
@check_grounding = ::Gapic::Config::Method.new check_grounding_config
|
461
|
+
|
462
|
+
yield self if block_given?
|
463
|
+
end
|
464
|
+
end
|
465
|
+
end
|
466
|
+
end
|
467
|
+
end
|
468
|
+
end
|
469
|
+
end
|
470
|
+
end
|
471
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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 GroundedGenerationService
|
26
|
+
# Credentials for the GroundedGenerationService 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
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module DiscoveryEngine
|
23
|
+
module V1
|
24
|
+
module GroundedGenerationService
|
25
|
+
# Path helper methods for the GroundedGenerationService API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified GroundingConfig resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `projects/{project}/locations/{location}/groundingConfigs/{grounding_config}`
|
33
|
+
#
|
34
|
+
# @param project [String]
|
35
|
+
# @param location [String]
|
36
|
+
# @param grounding_config [String]
|
37
|
+
#
|
38
|
+
# @return [::String]
|
39
|
+
def grounding_config_path project:, location:, grounding_config:
|
40
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
41
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
42
|
+
|
43
|
+
"projects/#{project}/locations/#{location}/groundingConfigs/#{grounding_config}"
|
44
|
+
end
|
45
|
+
|
46
|
+
extend self
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|