aws-sdk-bedrockagentruntime 1.0.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 +7 -0
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +202 -0
- data/VERSION +1 -0
- data/lib/aws-sdk-bedrockagentruntime/client.rb +928 -0
- data/lib/aws-sdk-bedrockagentruntime/client_api.rb +503 -0
- data/lib/aws-sdk-bedrockagentruntime/customizations.rb +0 -0
- data/lib/aws-sdk-bedrockagentruntime/endpoint_parameters.rb +66 -0
- data/lib/aws-sdk-bedrockagentruntime/endpoint_provider.rb +54 -0
- data/lib/aws-sdk-bedrockagentruntime/endpoints.rb +58 -0
- data/lib/aws-sdk-bedrockagentruntime/errors.rb +192 -0
- data/lib/aws-sdk-bedrockagentruntime/event_streams.rb +99 -0
- data/lib/aws-sdk-bedrockagentruntime/plugins/endpoints.rb +75 -0
- data/lib/aws-sdk-bedrockagentruntime/resource.rb +26 -0
- data/lib/aws-sdk-bedrockagentruntime/types.rb +1272 -0
- data/lib/aws-sdk-bedrockagentruntime.rb +58 -0
- metadata +95 -0
@@ -0,0 +1,928 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# WARNING ABOUT GENERATED CODE
|
4
|
+
#
|
5
|
+
# This file is generated. See the contributing guide for more information:
|
6
|
+
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
|
7
|
+
#
|
8
|
+
# WARNING ABOUT GENERATED CODE
|
9
|
+
|
10
|
+
require 'seahorse/client/plugins/content_length.rb'
|
11
|
+
require 'aws-sdk-core/plugins/credentials_configuration.rb'
|
12
|
+
require 'aws-sdk-core/plugins/logging.rb'
|
13
|
+
require 'aws-sdk-core/plugins/param_converter.rb'
|
14
|
+
require 'aws-sdk-core/plugins/param_validator.rb'
|
15
|
+
require 'aws-sdk-core/plugins/user_agent.rb'
|
16
|
+
require 'aws-sdk-core/plugins/helpful_socket_errors.rb'
|
17
|
+
require 'aws-sdk-core/plugins/retry_errors.rb'
|
18
|
+
require 'aws-sdk-core/plugins/global_configuration.rb'
|
19
|
+
require 'aws-sdk-core/plugins/regional_endpoint.rb'
|
20
|
+
require 'aws-sdk-core/plugins/endpoint_discovery.rb'
|
21
|
+
require 'aws-sdk-core/plugins/endpoint_pattern.rb'
|
22
|
+
require 'aws-sdk-core/plugins/response_paging.rb'
|
23
|
+
require 'aws-sdk-core/plugins/stub_responses.rb'
|
24
|
+
require 'aws-sdk-core/plugins/idempotency_token.rb'
|
25
|
+
require 'aws-sdk-core/plugins/jsonvalue_converter.rb'
|
26
|
+
require 'aws-sdk-core/plugins/client_metrics_plugin.rb'
|
27
|
+
require 'aws-sdk-core/plugins/client_metrics_send_plugin.rb'
|
28
|
+
require 'aws-sdk-core/plugins/transfer_encoding.rb'
|
29
|
+
require 'aws-sdk-core/plugins/http_checksum.rb'
|
30
|
+
require 'aws-sdk-core/plugins/checksum_algorithm.rb'
|
31
|
+
require 'aws-sdk-core/plugins/request_compression.rb'
|
32
|
+
require 'aws-sdk-core/plugins/defaults_mode.rb'
|
33
|
+
require 'aws-sdk-core/plugins/recursion_detection.rb'
|
34
|
+
require 'aws-sdk-core/plugins/sign.rb'
|
35
|
+
require 'aws-sdk-core/plugins/protocols/rest_json.rb'
|
36
|
+
require 'aws-sdk-core/plugins/event_stream_configuration.rb'
|
37
|
+
|
38
|
+
Aws::Plugins::GlobalConfiguration.add_identifier(:bedrockagentruntime)
|
39
|
+
|
40
|
+
module Aws::BedrockAgentRuntime
|
41
|
+
# An API client for BedrockAgentRuntime. To construct a client, you need to configure a `:region` and `:credentials`.
|
42
|
+
#
|
43
|
+
# client = Aws::BedrockAgentRuntime::Client.new(
|
44
|
+
# region: region_name,
|
45
|
+
# credentials: credentials,
|
46
|
+
# # ...
|
47
|
+
# )
|
48
|
+
#
|
49
|
+
# For details on configuring region and credentials see
|
50
|
+
# the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
|
51
|
+
#
|
52
|
+
# See {#initialize} for a full list of supported configuration options.
|
53
|
+
class Client < Seahorse::Client::Base
|
54
|
+
|
55
|
+
include Aws::ClientStubs
|
56
|
+
|
57
|
+
@identifier = :bedrockagentruntime
|
58
|
+
|
59
|
+
set_api(ClientApi::API)
|
60
|
+
|
61
|
+
add_plugin(Seahorse::Client::Plugins::ContentLength)
|
62
|
+
add_plugin(Aws::Plugins::CredentialsConfiguration)
|
63
|
+
add_plugin(Aws::Plugins::Logging)
|
64
|
+
add_plugin(Aws::Plugins::ParamConverter)
|
65
|
+
add_plugin(Aws::Plugins::ParamValidator)
|
66
|
+
add_plugin(Aws::Plugins::UserAgent)
|
67
|
+
add_plugin(Aws::Plugins::HelpfulSocketErrors)
|
68
|
+
add_plugin(Aws::Plugins::RetryErrors)
|
69
|
+
add_plugin(Aws::Plugins::GlobalConfiguration)
|
70
|
+
add_plugin(Aws::Plugins::RegionalEndpoint)
|
71
|
+
add_plugin(Aws::Plugins::EndpointDiscovery)
|
72
|
+
add_plugin(Aws::Plugins::EndpointPattern)
|
73
|
+
add_plugin(Aws::Plugins::ResponsePaging)
|
74
|
+
add_plugin(Aws::Plugins::StubResponses)
|
75
|
+
add_plugin(Aws::Plugins::IdempotencyToken)
|
76
|
+
add_plugin(Aws::Plugins::JsonvalueConverter)
|
77
|
+
add_plugin(Aws::Plugins::ClientMetricsPlugin)
|
78
|
+
add_plugin(Aws::Plugins::ClientMetricsSendPlugin)
|
79
|
+
add_plugin(Aws::Plugins::TransferEncoding)
|
80
|
+
add_plugin(Aws::Plugins::HttpChecksum)
|
81
|
+
add_plugin(Aws::Plugins::ChecksumAlgorithm)
|
82
|
+
add_plugin(Aws::Plugins::RequestCompression)
|
83
|
+
add_plugin(Aws::Plugins::DefaultsMode)
|
84
|
+
add_plugin(Aws::Plugins::RecursionDetection)
|
85
|
+
add_plugin(Aws::Plugins::Sign)
|
86
|
+
add_plugin(Aws::Plugins::Protocols::RestJson)
|
87
|
+
add_plugin(Aws::Plugins::EventStreamConfiguration)
|
88
|
+
add_plugin(Aws::BedrockAgentRuntime::Plugins::Endpoints)
|
89
|
+
|
90
|
+
# @overload initialize(options)
|
91
|
+
# @param [Hash] options
|
92
|
+
# @option options [required, Aws::CredentialProvider] :credentials
|
93
|
+
# Your AWS credentials. This can be an instance of any one of the
|
94
|
+
# following classes:
|
95
|
+
#
|
96
|
+
# * `Aws::Credentials` - Used for configuring static, non-refreshing
|
97
|
+
# credentials.
|
98
|
+
#
|
99
|
+
# * `Aws::SharedCredentials` - Used for loading static credentials from a
|
100
|
+
# shared file, such as `~/.aws/config`.
|
101
|
+
#
|
102
|
+
# * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
|
103
|
+
#
|
104
|
+
# * `Aws::AssumeRoleWebIdentityCredentials` - Used when you need to
|
105
|
+
# assume a role after providing credentials via the web.
|
106
|
+
#
|
107
|
+
# * `Aws::SSOCredentials` - Used for loading credentials from AWS SSO using an
|
108
|
+
# access token generated from `aws login`.
|
109
|
+
#
|
110
|
+
# * `Aws::ProcessCredentials` - Used for loading credentials from a
|
111
|
+
# process that outputs to stdout.
|
112
|
+
#
|
113
|
+
# * `Aws::InstanceProfileCredentials` - Used for loading credentials
|
114
|
+
# from an EC2 IMDS on an EC2 instance.
|
115
|
+
#
|
116
|
+
# * `Aws::ECSCredentials` - Used for loading credentials from
|
117
|
+
# instances running in ECS.
|
118
|
+
#
|
119
|
+
# * `Aws::CognitoIdentityCredentials` - Used for loading credentials
|
120
|
+
# from the Cognito Identity service.
|
121
|
+
#
|
122
|
+
# When `:credentials` are not configured directly, the following
|
123
|
+
# locations will be searched for credentials:
|
124
|
+
#
|
125
|
+
# * `Aws.config[:credentials]`
|
126
|
+
# * The `:access_key_id`, `:secret_access_key`, and `:session_token` options.
|
127
|
+
# * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
|
128
|
+
# * `~/.aws/credentials`
|
129
|
+
# * `~/.aws/config`
|
130
|
+
# * EC2/ECS IMDS instance profile - When used by default, the timeouts
|
131
|
+
# are very aggressive. Construct and pass an instance of
|
132
|
+
# `Aws::InstanceProfileCredentails` or `Aws::ECSCredentials` to
|
133
|
+
# enable retries and extended timeouts. Instance profile credential
|
134
|
+
# fetching can be disabled by setting ENV['AWS_EC2_METADATA_DISABLED']
|
135
|
+
# to true.
|
136
|
+
#
|
137
|
+
# @option options [required, String] :region
|
138
|
+
# The AWS region to connect to. The configured `:region` is
|
139
|
+
# used to determine the service `:endpoint`. When not passed,
|
140
|
+
# a default `:region` is searched for in the following locations:
|
141
|
+
#
|
142
|
+
# * `Aws.config[:region]`
|
143
|
+
# * `ENV['AWS_REGION']`
|
144
|
+
# * `ENV['AMAZON_REGION']`
|
145
|
+
# * `ENV['AWS_DEFAULT_REGION']`
|
146
|
+
# * `~/.aws/credentials`
|
147
|
+
# * `~/.aws/config`
|
148
|
+
#
|
149
|
+
# @option options [String] :access_key_id
|
150
|
+
#
|
151
|
+
# @option options [Boolean] :active_endpoint_cache (false)
|
152
|
+
# When set to `true`, a thread polling for endpoints will be running in
|
153
|
+
# the background every 60 secs (default). Defaults to `false`.
|
154
|
+
#
|
155
|
+
# @option options [Boolean] :adaptive_retry_wait_to_fill (true)
|
156
|
+
# Used only in `adaptive` retry mode. When true, the request will sleep
|
157
|
+
# until there is sufficent client side capacity to retry the request.
|
158
|
+
# When false, the request will raise a `RetryCapacityNotAvailableError` and will
|
159
|
+
# not retry instead of sleeping.
|
160
|
+
#
|
161
|
+
# @option options [Boolean] :client_side_monitoring (false)
|
162
|
+
# When `true`, client-side metrics will be collected for all API requests from
|
163
|
+
# this client.
|
164
|
+
#
|
165
|
+
# @option options [String] :client_side_monitoring_client_id ("")
|
166
|
+
# Allows you to provide an identifier for this client which will be attached to
|
167
|
+
# all generated client side metrics. Defaults to an empty string.
|
168
|
+
#
|
169
|
+
# @option options [String] :client_side_monitoring_host ("127.0.0.1")
|
170
|
+
# Allows you to specify the DNS hostname or IPv4 or IPv6 address that the client
|
171
|
+
# side monitoring agent is running on, where client metrics will be published via UDP.
|
172
|
+
#
|
173
|
+
# @option options [Integer] :client_side_monitoring_port (31000)
|
174
|
+
# Required for publishing client metrics. The port that the client side monitoring
|
175
|
+
# agent is running on, where client metrics will be published via UDP.
|
176
|
+
#
|
177
|
+
# @option options [Aws::ClientSideMonitoring::Publisher] :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher)
|
178
|
+
# Allows you to provide a custom client-side monitoring publisher class. By default,
|
179
|
+
# will use the Client Side Monitoring Agent Publisher.
|
180
|
+
#
|
181
|
+
# @option options [Boolean] :convert_params (true)
|
182
|
+
# When `true`, an attempt is made to coerce request parameters into
|
183
|
+
# the required types.
|
184
|
+
#
|
185
|
+
# @option options [Boolean] :correct_clock_skew (true)
|
186
|
+
# Used only in `standard` and adaptive retry modes. Specifies whether to apply
|
187
|
+
# a clock skew correction and retry requests with skewed client clocks.
|
188
|
+
#
|
189
|
+
# @option options [String] :defaults_mode ("legacy")
|
190
|
+
# See {Aws::DefaultsModeConfiguration} for a list of the
|
191
|
+
# accepted modes and the configuration defaults that are included.
|
192
|
+
#
|
193
|
+
# @option options [Boolean] :disable_host_prefix_injection (false)
|
194
|
+
# Set to true to disable SDK automatically adding host prefix
|
195
|
+
# to default service endpoint when available.
|
196
|
+
#
|
197
|
+
# @option options [Boolean] :disable_request_compression (false)
|
198
|
+
# When set to 'true' the request body will not be compressed
|
199
|
+
# for supported operations.
|
200
|
+
#
|
201
|
+
# @option options [String] :endpoint
|
202
|
+
# The client endpoint is normally constructed from the `:region`
|
203
|
+
# option. You should only configure an `:endpoint` when connecting
|
204
|
+
# to test or custom endpoints. This should be a valid HTTP(S) URI.
|
205
|
+
#
|
206
|
+
# @option options [Integer] :endpoint_cache_max_entries (1000)
|
207
|
+
# Used for the maximum size limit of the LRU cache storing endpoints data
|
208
|
+
# for endpoint discovery enabled operations. Defaults to 1000.
|
209
|
+
#
|
210
|
+
# @option options [Integer] :endpoint_cache_max_threads (10)
|
211
|
+
# Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.
|
212
|
+
#
|
213
|
+
# @option options [Integer] :endpoint_cache_poll_interval (60)
|
214
|
+
# When :endpoint_discovery and :active_endpoint_cache is enabled,
|
215
|
+
# Use this option to config the time interval in seconds for making
|
216
|
+
# requests fetching endpoints information. Defaults to 60 sec.
|
217
|
+
#
|
218
|
+
# @option options [Boolean] :endpoint_discovery (false)
|
219
|
+
# When set to `true`, endpoint discovery will be enabled for operations when available.
|
220
|
+
#
|
221
|
+
# @option options [Proc] :event_stream_handler
|
222
|
+
# When an EventStream or Proc object is provided, it will be used as callback for each chunk of event stream response received along the way.
|
223
|
+
#
|
224
|
+
# @option options [Boolean] :ignore_configured_endpoint_urls
|
225
|
+
# Setting to true disables use of endpoint URLs provided via environment
|
226
|
+
# variables and the shared configuration file.
|
227
|
+
#
|
228
|
+
# @option options [Proc] :input_event_stream_handler
|
229
|
+
# When an EventStream or Proc object is provided, it can be used for sending events for the event stream.
|
230
|
+
#
|
231
|
+
# @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
|
232
|
+
# The log formatter.
|
233
|
+
#
|
234
|
+
# @option options [Symbol] :log_level (:info)
|
235
|
+
# The log level to send messages to the `:logger` at.
|
236
|
+
#
|
237
|
+
# @option options [Logger] :logger
|
238
|
+
# The Logger instance to send log messages to. If this option
|
239
|
+
# is not set, logging will be disabled.
|
240
|
+
#
|
241
|
+
# @option options [Integer] :max_attempts (3)
|
242
|
+
# An integer representing the maximum number attempts that will be made for
|
243
|
+
# a single request, including the initial attempt. For example,
|
244
|
+
# setting this value to 5 will result in a request being retried up to
|
245
|
+
# 4 times. Used in `standard` and `adaptive` retry modes.
|
246
|
+
#
|
247
|
+
# @option options [Proc] :output_event_stream_handler
|
248
|
+
# When an EventStream or Proc object is provided, it will be used as callback for each chunk of event stream response received along the way.
|
249
|
+
#
|
250
|
+
# @option options [String] :profile ("default")
|
251
|
+
# Used when loading credentials from the shared credentials file
|
252
|
+
# at HOME/.aws/credentials. When not specified, 'default' is used.
|
253
|
+
#
|
254
|
+
# @option options [Integer] :request_min_compression_size_bytes (10240)
|
255
|
+
# The minimum size in bytes that triggers compression for request
|
256
|
+
# bodies. The value must be non-negative integer value between 0
|
257
|
+
# and 10485780 bytes inclusive.
|
258
|
+
#
|
259
|
+
# @option options [Proc] :retry_backoff
|
260
|
+
# A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay.
|
261
|
+
# This option is only used in the `legacy` retry mode.
|
262
|
+
#
|
263
|
+
# @option options [Float] :retry_base_delay (0.3)
|
264
|
+
# The base delay in seconds used by the default backoff function. This option
|
265
|
+
# is only used in the `legacy` retry mode.
|
266
|
+
#
|
267
|
+
# @option options [Symbol] :retry_jitter (:none)
|
268
|
+
# A delay randomiser function used by the default backoff function.
|
269
|
+
# Some predefined functions can be referenced by name - :none, :equal, :full,
|
270
|
+
# otherwise a Proc that takes and returns a number. This option is only used
|
271
|
+
# in the `legacy` retry mode.
|
272
|
+
#
|
273
|
+
# @see https://www.awsarchitectureblog.com/2015/03/backoff.html
|
274
|
+
#
|
275
|
+
# @option options [Integer] :retry_limit (3)
|
276
|
+
# The maximum number of times to retry failed requests. Only
|
277
|
+
# ~ 500 level server errors and certain ~ 400 level client errors
|
278
|
+
# are retried. Generally, these are throttling errors, data
|
279
|
+
# checksum errors, networking errors, timeout errors, auth errors,
|
280
|
+
# endpoint discovery, and errors from expired credentials.
|
281
|
+
# This option is only used in the `legacy` retry mode.
|
282
|
+
#
|
283
|
+
# @option options [Integer] :retry_max_delay (0)
|
284
|
+
# The maximum number of seconds to delay between retries (0 for no limit)
|
285
|
+
# used by the default backoff function. This option is only used in the
|
286
|
+
# `legacy` retry mode.
|
287
|
+
#
|
288
|
+
# @option options [String] :retry_mode ("legacy")
|
289
|
+
# Specifies which retry algorithm to use. Values are:
|
290
|
+
#
|
291
|
+
# * `legacy` - The pre-existing retry behavior. This is default value if
|
292
|
+
# no retry mode is provided.
|
293
|
+
#
|
294
|
+
# * `standard` - A standardized set of retry rules across the AWS SDKs.
|
295
|
+
# This includes support for retry quotas, which limit the number of
|
296
|
+
# unsuccessful retries a client can make.
|
297
|
+
#
|
298
|
+
# * `adaptive` - An experimental retry mode that includes all the
|
299
|
+
# functionality of `standard` mode along with automatic client side
|
300
|
+
# throttling. This is a provisional mode that may change behavior
|
301
|
+
# in the future.
|
302
|
+
#
|
303
|
+
#
|
304
|
+
# @option options [String] :sdk_ua_app_id
|
305
|
+
# A unique and opaque application ID that is appended to the
|
306
|
+
# User-Agent header as app/<sdk_ua_app_id>. It should have a
|
307
|
+
# maximum length of 50.
|
308
|
+
#
|
309
|
+
# @option options [String] :secret_access_key
|
310
|
+
#
|
311
|
+
# @option options [String] :session_token
|
312
|
+
#
|
313
|
+
# @option options [Boolean] :stub_responses (false)
|
314
|
+
# Causes the client to return stubbed responses. By default
|
315
|
+
# fake responses are generated and returned. You can specify
|
316
|
+
# the response data to return or errors to raise by calling
|
317
|
+
# {ClientStubs#stub_responses}. See {ClientStubs} for more information.
|
318
|
+
#
|
319
|
+
# ** Please note ** When response stubbing is enabled, no HTTP
|
320
|
+
# requests are made, and retries are disabled.
|
321
|
+
#
|
322
|
+
# @option options [Aws::TokenProvider] :token_provider
|
323
|
+
# A Bearer Token Provider. This can be an instance of any one of the
|
324
|
+
# following classes:
|
325
|
+
#
|
326
|
+
# * `Aws::StaticTokenProvider` - Used for configuring static, non-refreshing
|
327
|
+
# tokens.
|
328
|
+
#
|
329
|
+
# * `Aws::SSOTokenProvider` - Used for loading tokens from AWS SSO using an
|
330
|
+
# access token generated from `aws login`.
|
331
|
+
#
|
332
|
+
# When `:token_provider` is not configured directly, the `Aws::TokenProviderChain`
|
333
|
+
# will be used to search for tokens configured for your profile in shared configuration files.
|
334
|
+
#
|
335
|
+
# @option options [Boolean] :use_dualstack_endpoint
|
336
|
+
# When set to `true`, dualstack enabled endpoints (with `.aws` TLD)
|
337
|
+
# will be used if available.
|
338
|
+
#
|
339
|
+
# @option options [Boolean] :use_fips_endpoint
|
340
|
+
# When set to `true`, fips compatible endpoints will be used if available.
|
341
|
+
# When a `fips` region is used, the region is normalized and this config
|
342
|
+
# is set to `true`.
|
343
|
+
#
|
344
|
+
# @option options [Boolean] :validate_params (true)
|
345
|
+
# When `true`, request parameters are validated before
|
346
|
+
# sending the request.
|
347
|
+
#
|
348
|
+
# @option options [Aws::BedrockAgentRuntime::EndpointProvider] :endpoint_provider
|
349
|
+
# The endpoint provider used to resolve endpoints. Any object that responds to `#resolve_endpoint(parameters)` where `parameters` is a Struct similar to `Aws::BedrockAgentRuntime::EndpointParameters`
|
350
|
+
#
|
351
|
+
# @option options [URI::HTTP,String] :http_proxy A proxy to send
|
352
|
+
# requests through. Formatted like 'http://proxy.com:123'.
|
353
|
+
#
|
354
|
+
# @option options [Float] :http_open_timeout (15) The number of
|
355
|
+
# seconds to wait when opening a HTTP session before raising a
|
356
|
+
# `Timeout::Error`.
|
357
|
+
#
|
358
|
+
# @option options [Float] :http_read_timeout (60) The default
|
359
|
+
# number of seconds to wait for response data. This value can
|
360
|
+
# safely be set per-request on the session.
|
361
|
+
#
|
362
|
+
# @option options [Float] :http_idle_timeout (5) The number of
|
363
|
+
# seconds a connection is allowed to sit idle before it is
|
364
|
+
# considered stale. Stale connections are closed and removed
|
365
|
+
# from the pool before making a request.
|
366
|
+
#
|
367
|
+
# @option options [Float] :http_continue_timeout (1) The number of
|
368
|
+
# seconds to wait for a 100-continue response before sending the
|
369
|
+
# request body. This option has no effect unless the request has
|
370
|
+
# "Expect" header set to "100-continue". Defaults to `nil` which
|
371
|
+
# disables this behaviour. This value can safely be set per
|
372
|
+
# request on the session.
|
373
|
+
#
|
374
|
+
# @option options [Float] :ssl_timeout (nil) Sets the SSL timeout
|
375
|
+
# in seconds.
|
376
|
+
#
|
377
|
+
# @option options [Boolean] :http_wire_trace (false) When `true`,
|
378
|
+
# HTTP debug output will be sent to the `:logger`.
|
379
|
+
#
|
380
|
+
# @option options [Boolean] :ssl_verify_peer (true) When `true`,
|
381
|
+
# SSL peer certificates are verified when establishing a
|
382
|
+
# connection.
|
383
|
+
#
|
384
|
+
# @option options [String] :ssl_ca_bundle Full path to the SSL
|
385
|
+
# certificate authority bundle file that should be used when
|
386
|
+
# verifying peer certificates. If you do not pass
|
387
|
+
# `:ssl_ca_bundle` or `:ssl_ca_directory` the the system default
|
388
|
+
# will be used if available.
|
389
|
+
#
|
390
|
+
# @option options [String] :ssl_ca_directory Full path of the
|
391
|
+
# directory that contains the unbundled SSL certificate
|
392
|
+
# authority files for verifying peer certificates. If you do
|
393
|
+
# not pass `:ssl_ca_bundle` or `:ssl_ca_directory` the the
|
394
|
+
# system default will be used if available.
|
395
|
+
#
|
396
|
+
def initialize(*args)
|
397
|
+
super
|
398
|
+
end
|
399
|
+
|
400
|
+
# @!group API Operations
|
401
|
+
|
402
|
+
# Invokes the specified Bedrock model to run inference using the input
|
403
|
+
# provided in the request body.
|
404
|
+
#
|
405
|
+
# @option params [Types::SessionState] :session_state
|
406
|
+
# Session state passed by customer. Base64 encoded json string
|
407
|
+
# representation of SessionState.
|
408
|
+
#
|
409
|
+
# @option params [required, String] :agent_id
|
410
|
+
# Identifier for Agent
|
411
|
+
#
|
412
|
+
# @option params [required, String] :agent_alias_id
|
413
|
+
# Identifier for Agent Alias
|
414
|
+
#
|
415
|
+
# @option params [required, String] :session_id
|
416
|
+
# Identifier used for the current session
|
417
|
+
#
|
418
|
+
# @option params [Boolean] :end_session
|
419
|
+
# End current session
|
420
|
+
#
|
421
|
+
# @option params [Boolean] :enable_trace
|
422
|
+
# Enable agent trace events for improved debugging
|
423
|
+
#
|
424
|
+
# @option params [required, String] :input_text
|
425
|
+
# Input data in the format specified in the Content-Type request header.
|
426
|
+
#
|
427
|
+
# @return [Types::InvokeAgentResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
428
|
+
#
|
429
|
+
# * {Types::InvokeAgentResponse#completion #completion} => Types::ResponseStream
|
430
|
+
# * {Types::InvokeAgentResponse#content_type #content_type} => String
|
431
|
+
# * {Types::InvokeAgentResponse#session_id #session_id} => String
|
432
|
+
#
|
433
|
+
# @example EventStream Operation Example
|
434
|
+
#
|
435
|
+
# You can process event once it arrives immediately, or wait until
|
436
|
+
# full response complete and iterate through eventstream enumerator.
|
437
|
+
#
|
438
|
+
# To interact with event immediately, you need to register #invoke_agent
|
439
|
+
# with callbacks, callbacks can be register for specifc events or for all events,
|
440
|
+
# callback for errors in the event stream is also available for register.
|
441
|
+
#
|
442
|
+
# Callbacks can be passed in by `:event_stream_handler` option or within block
|
443
|
+
# statement attached to #invoke_agent call directly. Hybrid pattern of both
|
444
|
+
# is also supported.
|
445
|
+
#
|
446
|
+
# `:event_stream_handler` option takes in either Proc object or
|
447
|
+
# Aws::BedrockAgentRuntime::EventStreams::ResponseStream object.
|
448
|
+
#
|
449
|
+
# Usage pattern a): callbacks with a block attached to #invoke_agent
|
450
|
+
# Example for registering callbacks for all event types and error event
|
451
|
+
#
|
452
|
+
# client.invoke_agent( # params input# ) do |stream|
|
453
|
+
# stream.on_error_event do |event|
|
454
|
+
# # catch unmodeled error event in the stream
|
455
|
+
# raise event
|
456
|
+
# # => Aws::Errors::EventError
|
457
|
+
# # event.event_type => :error
|
458
|
+
# # event.error_code => String
|
459
|
+
# # event.error_message => String
|
460
|
+
# end
|
461
|
+
#
|
462
|
+
# stream.on_event do |event|
|
463
|
+
# # process all events arrive
|
464
|
+
# puts event.event_type
|
465
|
+
# ...
|
466
|
+
# end
|
467
|
+
#
|
468
|
+
# end
|
469
|
+
#
|
470
|
+
# Usage pattern b): pass in `:event_stream_handler` for #invoke_agent
|
471
|
+
#
|
472
|
+
# 1) create a Aws::BedrockAgentRuntime::EventStreams::ResponseStream object
|
473
|
+
# Example for registering callbacks with specific events
|
474
|
+
#
|
475
|
+
# handler = Aws::BedrockAgentRuntime::EventStreams::ResponseStream.new
|
476
|
+
# handler.on_chunk_event do |event|
|
477
|
+
# event # => Aws::BedrockAgentRuntime::Types::chunk
|
478
|
+
# end
|
479
|
+
# handler.on_trace_event do |event|
|
480
|
+
# event # => Aws::BedrockAgentRuntime::Types::trace
|
481
|
+
# end
|
482
|
+
# handler.on_internal_server_exception_event do |event|
|
483
|
+
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
484
|
+
# end
|
485
|
+
# handler.on_validation_exception_event do |event|
|
486
|
+
# event # => Aws::BedrockAgentRuntime::Types::validationException
|
487
|
+
# end
|
488
|
+
# handler.on_resource_not_found_exception_event do |event|
|
489
|
+
# event # => Aws::BedrockAgentRuntime::Types::resourceNotFoundException
|
490
|
+
# end
|
491
|
+
# handler.on_service_quota_exceeded_exception_event do |event|
|
492
|
+
# event # => Aws::BedrockAgentRuntime::Types::serviceQuotaExceededException
|
493
|
+
# end
|
494
|
+
# handler.on_throttling_exception_event do |event|
|
495
|
+
# event # => Aws::BedrockAgentRuntime::Types::throttlingException
|
496
|
+
# end
|
497
|
+
# handler.on_access_denied_exception_event do |event|
|
498
|
+
# event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
|
499
|
+
# end
|
500
|
+
# handler.on_conflict_exception_event do |event|
|
501
|
+
# event # => Aws::BedrockAgentRuntime::Types::conflictException
|
502
|
+
# end
|
503
|
+
# handler.on_dependency_failed_exception_event do |event|
|
504
|
+
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
505
|
+
# end
|
506
|
+
# handler.on_bad_gateway_exception_event do |event|
|
507
|
+
# event # => Aws::BedrockAgentRuntime::Types::badGatewayException
|
508
|
+
# end
|
509
|
+
#
|
510
|
+
# client.invoke_agent( # params input #, event_stream_handler: handler)
|
511
|
+
#
|
512
|
+
# 2) use a Ruby Proc object
|
513
|
+
# Example for registering callbacks with specific events
|
514
|
+
#
|
515
|
+
# handler = Proc.new do |stream|
|
516
|
+
# stream.on_chunk_event do |event|
|
517
|
+
# event # => Aws::BedrockAgentRuntime::Types::chunk
|
518
|
+
# end
|
519
|
+
# stream.on_trace_event do |event|
|
520
|
+
# event # => Aws::BedrockAgentRuntime::Types::trace
|
521
|
+
# end
|
522
|
+
# stream.on_internal_server_exception_event do |event|
|
523
|
+
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
524
|
+
# end
|
525
|
+
# stream.on_validation_exception_event do |event|
|
526
|
+
# event # => Aws::BedrockAgentRuntime::Types::validationException
|
527
|
+
# end
|
528
|
+
# stream.on_resource_not_found_exception_event do |event|
|
529
|
+
# event # => Aws::BedrockAgentRuntime::Types::resourceNotFoundException
|
530
|
+
# end
|
531
|
+
# stream.on_service_quota_exceeded_exception_event do |event|
|
532
|
+
# event # => Aws::BedrockAgentRuntime::Types::serviceQuotaExceededException
|
533
|
+
# end
|
534
|
+
# stream.on_throttling_exception_event do |event|
|
535
|
+
# event # => Aws::BedrockAgentRuntime::Types::throttlingException
|
536
|
+
# end
|
537
|
+
# stream.on_access_denied_exception_event do |event|
|
538
|
+
# event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
|
539
|
+
# end
|
540
|
+
# stream.on_conflict_exception_event do |event|
|
541
|
+
# event # => Aws::BedrockAgentRuntime::Types::conflictException
|
542
|
+
# end
|
543
|
+
# stream.on_dependency_failed_exception_event do |event|
|
544
|
+
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
545
|
+
# end
|
546
|
+
# stream.on_bad_gateway_exception_event do |event|
|
547
|
+
# event # => Aws::BedrockAgentRuntime::Types::badGatewayException
|
548
|
+
# end
|
549
|
+
# end
|
550
|
+
#
|
551
|
+
# client.invoke_agent( # params input #, event_stream_handler: handler)
|
552
|
+
#
|
553
|
+
# Usage pattern c): hybird pattern of a) and b)
|
554
|
+
#
|
555
|
+
# handler = Aws::BedrockAgentRuntime::EventStreams::ResponseStream.new
|
556
|
+
# handler.on_chunk_event do |event|
|
557
|
+
# event # => Aws::BedrockAgentRuntime::Types::chunk
|
558
|
+
# end
|
559
|
+
# handler.on_trace_event do |event|
|
560
|
+
# event # => Aws::BedrockAgentRuntime::Types::trace
|
561
|
+
# end
|
562
|
+
# handler.on_internal_server_exception_event do |event|
|
563
|
+
# event # => Aws::BedrockAgentRuntime::Types::internalServerException
|
564
|
+
# end
|
565
|
+
# handler.on_validation_exception_event do |event|
|
566
|
+
# event # => Aws::BedrockAgentRuntime::Types::validationException
|
567
|
+
# end
|
568
|
+
# handler.on_resource_not_found_exception_event do |event|
|
569
|
+
# event # => Aws::BedrockAgentRuntime::Types::resourceNotFoundException
|
570
|
+
# end
|
571
|
+
# handler.on_service_quota_exceeded_exception_event do |event|
|
572
|
+
# event # => Aws::BedrockAgentRuntime::Types::serviceQuotaExceededException
|
573
|
+
# end
|
574
|
+
# handler.on_throttling_exception_event do |event|
|
575
|
+
# event # => Aws::BedrockAgentRuntime::Types::throttlingException
|
576
|
+
# end
|
577
|
+
# handler.on_access_denied_exception_event do |event|
|
578
|
+
# event # => Aws::BedrockAgentRuntime::Types::accessDeniedException
|
579
|
+
# end
|
580
|
+
# handler.on_conflict_exception_event do |event|
|
581
|
+
# event # => Aws::BedrockAgentRuntime::Types::conflictException
|
582
|
+
# end
|
583
|
+
# handler.on_dependency_failed_exception_event do |event|
|
584
|
+
# event # => Aws::BedrockAgentRuntime::Types::dependencyFailedException
|
585
|
+
# end
|
586
|
+
# handler.on_bad_gateway_exception_event do |event|
|
587
|
+
# event # => Aws::BedrockAgentRuntime::Types::badGatewayException
|
588
|
+
# end
|
589
|
+
#
|
590
|
+
# client.invoke_agent( # params input #, event_stream_handler: handler) do |stream|
|
591
|
+
# stream.on_error_event do |event|
|
592
|
+
# # catch unmodeled error event in the stream
|
593
|
+
# raise event
|
594
|
+
# # => Aws::Errors::EventError
|
595
|
+
# # event.event_type => :error
|
596
|
+
# # event.error_code => String
|
597
|
+
# # event.error_message => String
|
598
|
+
# end
|
599
|
+
# end
|
600
|
+
#
|
601
|
+
# Besides above usage patterns for process events when they arrive immediately, you can also
|
602
|
+
# iterate through events after response complete.
|
603
|
+
#
|
604
|
+
# Events are available at resp.completion # => Enumerator
|
605
|
+
# For parameter input example, please refer to following request syntax
|
606
|
+
#
|
607
|
+
# @example Request syntax with placeholder values
|
608
|
+
#
|
609
|
+
# resp = client.invoke_agent({
|
610
|
+
# session_state: {
|
611
|
+
# session_attributes: {
|
612
|
+
# "String" => "String",
|
613
|
+
# },
|
614
|
+
# prompt_session_attributes: {
|
615
|
+
# "String" => "String",
|
616
|
+
# },
|
617
|
+
# },
|
618
|
+
# agent_id: "AgentId", # required
|
619
|
+
# agent_alias_id: "AgentAliasId", # required
|
620
|
+
# session_id: "SessionId", # required
|
621
|
+
# end_session: false,
|
622
|
+
# enable_trace: false,
|
623
|
+
# input_text: "InputText", # required
|
624
|
+
# })
|
625
|
+
#
|
626
|
+
# @example Response structure
|
627
|
+
#
|
628
|
+
# All events are available at resp.completion:
|
629
|
+
# resp.completion #=> Enumerator
|
630
|
+
# resp.completion.event_types #=> [:chunk, :trace, :internal_server_exception, :validation_exception, :resource_not_found_exception, :service_quota_exceeded_exception, :throttling_exception, :access_denied_exception, :conflict_exception, :dependency_failed_exception, :bad_gateway_exception]
|
631
|
+
#
|
632
|
+
# For :chunk event available at #on_chunk_event callback and response eventstream enumerator:
|
633
|
+
# event.bytes #=> String
|
634
|
+
# event.attribution.citations #=> Array
|
635
|
+
# event.attribution.citations[0].generated_response_part.text_response_part.text #=> String
|
636
|
+
# event.attribution.citations[0].generated_response_part.text_response_part.span.start #=> Integer
|
637
|
+
# event.attribution.citations[0].generated_response_part.text_response_part.span.end #=> Integer
|
638
|
+
# event.attribution.citations[0].retrieved_references #=> Array
|
639
|
+
# event.attribution.citations[0].retrieved_references[0].content.text #=> String
|
640
|
+
# event.attribution.citations[0].retrieved_references[0].location.type #=> String, one of "S3"
|
641
|
+
# event.attribution.citations[0].retrieved_references[0].location.s3_location.uri #=> String
|
642
|
+
#
|
643
|
+
# For :trace event available at #on_trace_event callback and response eventstream enumerator:
|
644
|
+
# event.agent_id #=> String
|
645
|
+
# event.agent_alias_id #=> String
|
646
|
+
# event.session_id #=> String
|
647
|
+
# event.trace.pre_processing_trace.model_invocation_input.trace_id #=> String
|
648
|
+
# event.trace.pre_processing_trace.model_invocation_input.text #=> String
|
649
|
+
# event.trace.pre_processing_trace.model_invocation_input.type #=> String, one of "PRE_PROCESSING", "ORCHESTRATION", "KNOWLEDGE_BASE_RESPONSE_GENERATION", "POST_PROCESSING"
|
650
|
+
# event.trace.pre_processing_trace.model_invocation_input.inference_configuration.temperature #=> Float
|
651
|
+
# event.trace.pre_processing_trace.model_invocation_input.inference_configuration.top_p #=> Float
|
652
|
+
# event.trace.pre_processing_trace.model_invocation_input.inference_configuration.top_k #=> Integer
|
653
|
+
# event.trace.pre_processing_trace.model_invocation_input.inference_configuration.maximum_length #=> Integer
|
654
|
+
# event.trace.pre_processing_trace.model_invocation_input.inference_configuration.stop_sequences #=> Array
|
655
|
+
# event.trace.pre_processing_trace.model_invocation_input.inference_configuration.stop_sequences[0] #=> String
|
656
|
+
# event.trace.pre_processing_trace.model_invocation_input.override_lambda #=> String
|
657
|
+
# event.trace.pre_processing_trace.model_invocation_input.prompt_creation_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
|
658
|
+
# event.trace.pre_processing_trace.model_invocation_input.parser_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
|
659
|
+
# event.trace.pre_processing_trace.model_invocation_output.trace_id #=> String
|
660
|
+
# event.trace.pre_processing_trace.model_invocation_output.parsed_response.rationale #=> String
|
661
|
+
# event.trace.pre_processing_trace.model_invocation_output.parsed_response.is_valid #=> Boolean
|
662
|
+
# event.trace.orchestration_trace.rationale.trace_id #=> String
|
663
|
+
# event.trace.orchestration_trace.rationale.text #=> String
|
664
|
+
# event.trace.orchestration_trace.invocation_input.trace_id #=> String
|
665
|
+
# event.trace.orchestration_trace.invocation_input.invocation_type #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "FINISH"
|
666
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.action_group_name #=> String
|
667
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.verb #=> String
|
668
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.api_path #=> String
|
669
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.parameters #=> Array
|
670
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.parameters[0].name #=> String
|
671
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.parameters[0].type #=> String
|
672
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.parameters[0].value #=> String
|
673
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.request_body.content #=> Hash
|
674
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.request_body.content["String"] #=> Array
|
675
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.request_body.content["String"][0].name #=> String
|
676
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.request_body.content["String"][0].type #=> String
|
677
|
+
# event.trace.orchestration_trace.invocation_input.action_group_invocation_input.request_body.content["String"][0].value #=> String
|
678
|
+
# event.trace.orchestration_trace.invocation_input.knowledge_base_lookup_input.text #=> String
|
679
|
+
# event.trace.orchestration_trace.invocation_input.knowledge_base_lookup_input.knowledge_base_id #=> String
|
680
|
+
# event.trace.orchestration_trace.observation.trace_id #=> String
|
681
|
+
# event.trace.orchestration_trace.observation.type #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "FINISH", "ASK_USER", "REPROMPT"
|
682
|
+
# event.trace.orchestration_trace.observation.action_group_invocation_output.text #=> String
|
683
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references #=> Array
|
684
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].content.text #=> String
|
685
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.type #=> String, one of "S3"
|
686
|
+
# event.trace.orchestration_trace.observation.knowledge_base_lookup_output.retrieved_references[0].location.s3_location.uri #=> String
|
687
|
+
# event.trace.orchestration_trace.observation.final_response.text #=> String
|
688
|
+
# event.trace.orchestration_trace.observation.reprompt_response.text #=> String
|
689
|
+
# event.trace.orchestration_trace.observation.reprompt_response.source #=> String, one of "ACTION_GROUP", "KNOWLEDGE_BASE", "PARSER"
|
690
|
+
# event.trace.orchestration_trace.model_invocation_input.trace_id #=> String
|
691
|
+
# event.trace.orchestration_trace.model_invocation_input.text #=> String
|
692
|
+
# event.trace.orchestration_trace.model_invocation_input.type #=> String, one of "PRE_PROCESSING", "ORCHESTRATION", "KNOWLEDGE_BASE_RESPONSE_GENERATION", "POST_PROCESSING"
|
693
|
+
# event.trace.orchestration_trace.model_invocation_input.inference_configuration.temperature #=> Float
|
694
|
+
# event.trace.orchestration_trace.model_invocation_input.inference_configuration.top_p #=> Float
|
695
|
+
# event.trace.orchestration_trace.model_invocation_input.inference_configuration.top_k #=> Integer
|
696
|
+
# event.trace.orchestration_trace.model_invocation_input.inference_configuration.maximum_length #=> Integer
|
697
|
+
# event.trace.orchestration_trace.model_invocation_input.inference_configuration.stop_sequences #=> Array
|
698
|
+
# event.trace.orchestration_trace.model_invocation_input.inference_configuration.stop_sequences[0] #=> String
|
699
|
+
# event.trace.orchestration_trace.model_invocation_input.override_lambda #=> String
|
700
|
+
# event.trace.orchestration_trace.model_invocation_input.prompt_creation_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
|
701
|
+
# event.trace.orchestration_trace.model_invocation_input.parser_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
|
702
|
+
# event.trace.post_processing_trace.model_invocation_input.trace_id #=> String
|
703
|
+
# event.trace.post_processing_trace.model_invocation_input.text #=> String
|
704
|
+
# event.trace.post_processing_trace.model_invocation_input.type #=> String, one of "PRE_PROCESSING", "ORCHESTRATION", "KNOWLEDGE_BASE_RESPONSE_GENERATION", "POST_PROCESSING"
|
705
|
+
# event.trace.post_processing_trace.model_invocation_input.inference_configuration.temperature #=> Float
|
706
|
+
# event.trace.post_processing_trace.model_invocation_input.inference_configuration.top_p #=> Float
|
707
|
+
# event.trace.post_processing_trace.model_invocation_input.inference_configuration.top_k #=> Integer
|
708
|
+
# event.trace.post_processing_trace.model_invocation_input.inference_configuration.maximum_length #=> Integer
|
709
|
+
# event.trace.post_processing_trace.model_invocation_input.inference_configuration.stop_sequences #=> Array
|
710
|
+
# event.trace.post_processing_trace.model_invocation_input.inference_configuration.stop_sequences[0] #=> String
|
711
|
+
# event.trace.post_processing_trace.model_invocation_input.override_lambda #=> String
|
712
|
+
# event.trace.post_processing_trace.model_invocation_input.prompt_creation_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
|
713
|
+
# event.trace.post_processing_trace.model_invocation_input.parser_mode #=> String, one of "DEFAULT", "OVERRIDDEN"
|
714
|
+
# event.trace.post_processing_trace.model_invocation_output.trace_id #=> String
|
715
|
+
# event.trace.post_processing_trace.model_invocation_output.parsed_response.text #=> String
|
716
|
+
# event.trace.failure_trace.trace_id #=> String
|
717
|
+
# event.trace.failure_trace.failure_reason #=> String
|
718
|
+
#
|
719
|
+
# For :internal_server_exception event available at #on_internal_server_exception_event callback and response eventstream enumerator:
|
720
|
+
# event.message #=> String
|
721
|
+
#
|
722
|
+
# For :validation_exception event available at #on_validation_exception_event callback and response eventstream enumerator:
|
723
|
+
# event.message #=> String
|
724
|
+
#
|
725
|
+
# For :resource_not_found_exception event available at #on_resource_not_found_exception_event callback and response eventstream enumerator:
|
726
|
+
# event.message #=> String
|
727
|
+
#
|
728
|
+
# For :service_quota_exceeded_exception event available at #on_service_quota_exceeded_exception_event callback and response eventstream enumerator:
|
729
|
+
# event.message #=> String
|
730
|
+
#
|
731
|
+
# For :throttling_exception event available at #on_throttling_exception_event callback and response eventstream enumerator:
|
732
|
+
# event.message #=> String
|
733
|
+
#
|
734
|
+
# For :access_denied_exception event available at #on_access_denied_exception_event callback and response eventstream enumerator:
|
735
|
+
# event.message #=> String
|
736
|
+
#
|
737
|
+
# For :conflict_exception event available at #on_conflict_exception_event callback and response eventstream enumerator:
|
738
|
+
# event.message #=> String
|
739
|
+
#
|
740
|
+
# For :dependency_failed_exception event available at #on_dependency_failed_exception_event callback and response eventstream enumerator:
|
741
|
+
# event.message #=> String
|
742
|
+
# event.resource_name #=> String
|
743
|
+
#
|
744
|
+
# For :bad_gateway_exception event available at #on_bad_gateway_exception_event callback and response eventstream enumerator:
|
745
|
+
# event.message #=> String
|
746
|
+
# event.resource_name #=> String
|
747
|
+
#
|
748
|
+
# resp.content_type #=> String
|
749
|
+
# resp.session_id #=> String
|
750
|
+
#
|
751
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/InvokeAgent AWS API Documentation
|
752
|
+
#
|
753
|
+
# @overload invoke_agent(params = {})
|
754
|
+
# @param [Hash] params ({})
|
755
|
+
def invoke_agent(params = {}, options = {}, &block)
|
756
|
+
params = params.dup
|
757
|
+
event_stream_handler = case handler = params.delete(:event_stream_handler)
|
758
|
+
when EventStreams::ResponseStream then handler
|
759
|
+
when Proc then EventStreams::ResponseStream.new.tap(&handler)
|
760
|
+
when nil then EventStreams::ResponseStream.new
|
761
|
+
else
|
762
|
+
msg = "expected :event_stream_handler to be a block or "\
|
763
|
+
"instance of Aws::BedrockAgentRuntime::EventStreams::ResponseStream"\
|
764
|
+
", got `#{handler.inspect}` instead"
|
765
|
+
raise ArgumentError, msg
|
766
|
+
end
|
767
|
+
|
768
|
+
yield(event_stream_handler) if block_given?
|
769
|
+
|
770
|
+
req = build_request(:invoke_agent, params)
|
771
|
+
|
772
|
+
req.context[:event_stream_handler] = event_stream_handler
|
773
|
+
req.handlers.add(Aws::Binary::DecodeHandler, priority: 95)
|
774
|
+
|
775
|
+
req.send_request(options, &block)
|
776
|
+
end
|
777
|
+
|
778
|
+
# Retrieve from knowledge base.
|
779
|
+
#
|
780
|
+
# @option params [required, String] :knowledge_base_id
|
781
|
+
# Identifier of the KnowledgeBase
|
782
|
+
#
|
783
|
+
# @option params [required, Types::KnowledgeBaseQuery] :retrieval_query
|
784
|
+
# Knowledge base input query.
|
785
|
+
#
|
786
|
+
# @option params [Types::KnowledgeBaseRetrievalConfiguration] :retrieval_configuration
|
787
|
+
# Search parameters for retrieving from knowledge base.
|
788
|
+
#
|
789
|
+
# @option params [String] :next_token
|
790
|
+
# Opaque continuation token of previous paginated response.
|
791
|
+
#
|
792
|
+
# @return [Types::RetrieveResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
793
|
+
#
|
794
|
+
# * {Types::RetrieveResponse#retrieval_results #retrieval_results} => Array<Types::KnowledgeBaseRetrievalResult>
|
795
|
+
# * {Types::RetrieveResponse#next_token #next_token} => String
|
796
|
+
#
|
797
|
+
# The returned {Seahorse::Client::Response response} is a pageable response and is Enumerable. For details on usage see {Aws::PageableResponse PageableResponse}.
|
798
|
+
#
|
799
|
+
# @example Request syntax with placeholder values
|
800
|
+
#
|
801
|
+
# resp = client.retrieve({
|
802
|
+
# knowledge_base_id: "KnowledgeBaseId", # required
|
803
|
+
# retrieval_query: { # required
|
804
|
+
# text: "KnowledgeBaseQueryTextString", # required
|
805
|
+
# },
|
806
|
+
# retrieval_configuration: {
|
807
|
+
# vector_search_configuration: { # required
|
808
|
+
# number_of_results: 1, # required
|
809
|
+
# },
|
810
|
+
# },
|
811
|
+
# next_token: "NextToken",
|
812
|
+
# })
|
813
|
+
#
|
814
|
+
# @example Response structure
|
815
|
+
#
|
816
|
+
# resp.retrieval_results #=> Array
|
817
|
+
# resp.retrieval_results[0].content.text #=> String
|
818
|
+
# resp.retrieval_results[0].location.type #=> String, one of "S3"
|
819
|
+
# resp.retrieval_results[0].location.s3_location.uri #=> String
|
820
|
+
# resp.retrieval_results[0].score #=> Float
|
821
|
+
# resp.next_token #=> String
|
822
|
+
#
|
823
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/Retrieve AWS API Documentation
|
824
|
+
#
|
825
|
+
# @overload retrieve(params = {})
|
826
|
+
# @param [Hash] params ({})
|
827
|
+
def retrieve(params = {}, options = {})
|
828
|
+
req = build_request(:retrieve, params)
|
829
|
+
req.send_request(options)
|
830
|
+
end
|
831
|
+
|
832
|
+
# RetrieveAndGenerate API
|
833
|
+
#
|
834
|
+
# @option params [String] :session_id
|
835
|
+
# Identifier of the session.
|
836
|
+
#
|
837
|
+
# @option params [required, Types::RetrieveAndGenerateInput] :input
|
838
|
+
# Customer input of the turn
|
839
|
+
#
|
840
|
+
# @option params [Types::RetrieveAndGenerateConfiguration] :retrieve_and_generate_configuration
|
841
|
+
# Configures the retrieval and generation for the session.
|
842
|
+
#
|
843
|
+
# @option params [Types::RetrieveAndGenerateSessionConfiguration] :session_configuration
|
844
|
+
# Configures common parameters of the session.
|
845
|
+
#
|
846
|
+
# @return [Types::RetrieveAndGenerateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
847
|
+
#
|
848
|
+
# * {Types::RetrieveAndGenerateResponse#session_id #session_id} => String
|
849
|
+
# * {Types::RetrieveAndGenerateResponse#output #output} => Types::RetrieveAndGenerateOutput
|
850
|
+
# * {Types::RetrieveAndGenerateResponse#citations #citations} => Array<Types::Citation>
|
851
|
+
#
|
852
|
+
# @example Request syntax with placeholder values
|
853
|
+
#
|
854
|
+
# resp = client.retrieve_and_generate({
|
855
|
+
# session_id: "SessionId",
|
856
|
+
# input: { # required
|
857
|
+
# text: "RetrieveAndGenerateInputTextString", # required
|
858
|
+
# },
|
859
|
+
# retrieve_and_generate_configuration: {
|
860
|
+
# type: "KNOWLEDGE_BASE", # required, accepts KNOWLEDGE_BASE
|
861
|
+
# knowledge_base_configuration: {
|
862
|
+
# knowledge_base_id: "KnowledgeBaseId", # required
|
863
|
+
# model_arn: "BedrockModelArn", # required
|
864
|
+
# },
|
865
|
+
# },
|
866
|
+
# session_configuration: {
|
867
|
+
# kms_key_arn: "KmsKeyArn", # required
|
868
|
+
# },
|
869
|
+
# })
|
870
|
+
#
|
871
|
+
# @example Response structure
|
872
|
+
#
|
873
|
+
# resp.session_id #=> String
|
874
|
+
# resp.output.text #=> String
|
875
|
+
# resp.citations #=> Array
|
876
|
+
# resp.citations[0].generated_response_part.text_response_part.text #=> String
|
877
|
+
# resp.citations[0].generated_response_part.text_response_part.span.start #=> Integer
|
878
|
+
# resp.citations[0].generated_response_part.text_response_part.span.end #=> Integer
|
879
|
+
# resp.citations[0].retrieved_references #=> Array
|
880
|
+
# resp.citations[0].retrieved_references[0].content.text #=> String
|
881
|
+
# resp.citations[0].retrieved_references[0].location.type #=> String, one of "S3"
|
882
|
+
# resp.citations[0].retrieved_references[0].location.s3_location.uri #=> String
|
883
|
+
#
|
884
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerate AWS API Documentation
|
885
|
+
#
|
886
|
+
# @overload retrieve_and_generate(params = {})
|
887
|
+
# @param [Hash] params ({})
|
888
|
+
def retrieve_and_generate(params = {}, options = {})
|
889
|
+
req = build_request(:retrieve_and_generate, params)
|
890
|
+
req.send_request(options)
|
891
|
+
end
|
892
|
+
|
893
|
+
# @!endgroup
|
894
|
+
|
895
|
+
# @param params ({})
|
896
|
+
# @api private
|
897
|
+
def build_request(operation_name, params = {})
|
898
|
+
handlers = @handlers.for(operation_name)
|
899
|
+
context = Seahorse::Client::RequestContext.new(
|
900
|
+
operation_name: operation_name,
|
901
|
+
operation: config.api.operation(operation_name),
|
902
|
+
client: self,
|
903
|
+
params: params,
|
904
|
+
config: config)
|
905
|
+
context[:gem_name] = 'aws-sdk-bedrockagentruntime'
|
906
|
+
context[:gem_version] = '1.0.0'
|
907
|
+
Seahorse::Client::Request.new(handlers, context)
|
908
|
+
end
|
909
|
+
|
910
|
+
# @api private
|
911
|
+
# @deprecated
|
912
|
+
def waiter_names
|
913
|
+
[]
|
914
|
+
end
|
915
|
+
|
916
|
+
class << self
|
917
|
+
|
918
|
+
# @api private
|
919
|
+
attr_reader :identifier
|
920
|
+
|
921
|
+
# @api private
|
922
|
+
def errors_module
|
923
|
+
Errors
|
924
|
+
end
|
925
|
+
|
926
|
+
end
|
927
|
+
end
|
928
|
+
end
|