aws-sdk-bedrockruntime 1.43.0 → 1.44.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/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-bedrockruntime/async_client.rb +626 -0
- data/lib/aws-sdk-bedrockruntime/client.rb +1 -1
- data/lib/aws-sdk-bedrockruntime/client_api.rb +60 -4
- data/lib/aws-sdk-bedrockruntime/event_streams.rb +87 -0
- data/lib/aws-sdk-bedrockruntime/types.rb +115 -0
- data/lib/aws-sdk-bedrockruntime.rb +2 -1
- data/sig/client.rbs +11 -0
- data/sig/types.rbs +31 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df167de5e14a9cd5c29ba11937858d05db1247d48546fb4a847cbe7262aec3d2
|
4
|
+
data.tar.gz: 788336ed16edce2eed9a6a34b3cbb4cbce8d035abebd6f2f9fc6c77944788ed6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c75cdcc7a54dbb4c3aa9a310baa25b5336aff81d9ef3f4e83e5064ed1a1a66fbcad7208c3eaa6e50c04fcb92d2c6a93a0f30288493bdc1cd3b7a80f9fa268f16
|
7
|
+
data.tar.gz: 8a0049209c16a70292c969265643cd89676e50137680860368e4e1619a67b91285ea23a967200386e1ebc62289ab50f74b0544803e549afc5658ecba71239756
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
Unreleased Changes
|
2
2
|
------------------
|
3
3
|
|
4
|
+
1.44.0 (2025-04-08)
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* Feature - This release introduces our latest bedrock runtime API, InvokeModelWithBidirectionalStream. The API supports both input and output streams and is supported by only HTTP2.0.
|
8
|
+
|
4
9
|
1.43.0 (2025-04-07)
|
5
10
|
------------------
|
6
11
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.44.0
|
@@ -0,0 +1,626 @@
|
|
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
|
+
begin
|
11
|
+
require 'http/2'
|
12
|
+
rescue LoadError; end
|
13
|
+
require 'aws-sdk-core/plugins/credentials_configuration.rb'
|
14
|
+
require 'aws-sdk-core/plugins/logging.rb'
|
15
|
+
require 'aws-sdk-core/plugins/param_converter.rb'
|
16
|
+
require 'aws-sdk-core/plugins/param_validator.rb'
|
17
|
+
require 'aws-sdk-core/plugins/user_agent.rb'
|
18
|
+
require 'aws-sdk-core/plugins/helpful_socket_errors.rb'
|
19
|
+
require 'aws-sdk-core/plugins/retry_errors.rb'
|
20
|
+
require 'aws-sdk-core/plugins/global_configuration.rb'
|
21
|
+
require 'aws-sdk-core/plugins/regional_endpoint.rb'
|
22
|
+
require 'aws-sdk-core/plugins/stub_responses.rb'
|
23
|
+
require 'aws-sdk-core/plugins/idempotency_token.rb'
|
24
|
+
require 'aws-sdk-core/plugins/invocation_id.rb'
|
25
|
+
require 'aws-sdk-core/plugins/jsonvalue_converter.rb'
|
26
|
+
require 'aws-sdk-core/plugins/http_checksum.rb'
|
27
|
+
require 'aws-sdk-core/plugins/checksum_algorithm.rb'
|
28
|
+
require 'aws-sdk-core/plugins/request_compression.rb'
|
29
|
+
require 'aws-sdk-core/plugins/defaults_mode.rb'
|
30
|
+
require 'aws-sdk-core/plugins/recursion_detection.rb'
|
31
|
+
require 'aws-sdk-core/plugins/telemetry.rb'
|
32
|
+
require 'aws-sdk-core/plugins/sign.rb'
|
33
|
+
require 'aws-sdk-core/plugins/protocols/rest_json.rb'
|
34
|
+
require 'aws-sdk-core/plugins/event_stream_configuration.rb'
|
35
|
+
|
36
|
+
Aws::Plugins::GlobalConfiguration.add_identifier(:bedrockruntime)
|
37
|
+
|
38
|
+
module Aws::BedrockRuntime
|
39
|
+
class AsyncClient < Seahorse::Client::AsyncBase
|
40
|
+
|
41
|
+
include Aws::AsyncClientStubs
|
42
|
+
|
43
|
+
@identifier = :bedrockruntime
|
44
|
+
|
45
|
+
set_api(ClientApi::API)
|
46
|
+
|
47
|
+
add_plugin(Aws::Plugins::CredentialsConfiguration)
|
48
|
+
add_plugin(Aws::Plugins::Logging)
|
49
|
+
add_plugin(Aws::Plugins::ParamConverter)
|
50
|
+
add_plugin(Aws::Plugins::ParamValidator)
|
51
|
+
add_plugin(Aws::Plugins::UserAgent)
|
52
|
+
add_plugin(Aws::Plugins::HelpfulSocketErrors)
|
53
|
+
add_plugin(Aws::Plugins::RetryErrors)
|
54
|
+
add_plugin(Aws::Plugins::GlobalConfiguration)
|
55
|
+
add_plugin(Aws::Plugins::RegionalEndpoint)
|
56
|
+
add_plugin(Aws::Plugins::StubResponses)
|
57
|
+
add_plugin(Aws::Plugins::IdempotencyToken)
|
58
|
+
add_plugin(Aws::Plugins::InvocationId)
|
59
|
+
add_plugin(Aws::Plugins::JsonvalueConverter)
|
60
|
+
add_plugin(Aws::Plugins::HttpChecksum)
|
61
|
+
add_plugin(Aws::Plugins::ChecksumAlgorithm)
|
62
|
+
add_plugin(Aws::Plugins::RequestCompression)
|
63
|
+
add_plugin(Aws::Plugins::DefaultsMode)
|
64
|
+
add_plugin(Aws::Plugins::RecursionDetection)
|
65
|
+
add_plugin(Aws::Plugins::Telemetry)
|
66
|
+
add_plugin(Aws::Plugins::Sign)
|
67
|
+
add_plugin(Aws::Plugins::Protocols::RestJson)
|
68
|
+
add_plugin(Aws::Plugins::EventStreamConfiguration)
|
69
|
+
add_plugin(Aws::BedrockRuntime::Plugins::Endpoints)
|
70
|
+
|
71
|
+
# @option options [required, Aws::CredentialProvider] :credentials
|
72
|
+
# Your AWS credentials. This can be an instance of any one of the
|
73
|
+
# following classes:
|
74
|
+
#
|
75
|
+
# * `Aws::Credentials` - Used for configuring static, non-refreshing
|
76
|
+
# credentials.
|
77
|
+
#
|
78
|
+
# * `Aws::SharedCredentials` - Used for loading static credentials from a
|
79
|
+
# shared file, such as `~/.aws/config`.
|
80
|
+
#
|
81
|
+
# * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
|
82
|
+
#
|
83
|
+
# * `Aws::AssumeRoleWebIdentityCredentials` - Used when you need to
|
84
|
+
# assume a role after providing credentials via the web.
|
85
|
+
#
|
86
|
+
# * `Aws::SSOCredentials` - Used for loading credentials from AWS SSO using an
|
87
|
+
# access token generated from `aws login`.
|
88
|
+
#
|
89
|
+
# * `Aws::ProcessCredentials` - Used for loading credentials from a
|
90
|
+
# process that outputs to stdout.
|
91
|
+
#
|
92
|
+
# * `Aws::InstanceProfileCredentials` - Used for loading credentials
|
93
|
+
# from an EC2 IMDS on an EC2 instance.
|
94
|
+
#
|
95
|
+
# * `Aws::ECSCredentials` - Used for loading credentials from
|
96
|
+
# instances running in ECS.
|
97
|
+
#
|
98
|
+
# * `Aws::CognitoIdentityCredentials` - Used for loading credentials
|
99
|
+
# from the Cognito Identity service.
|
100
|
+
#
|
101
|
+
# When `:credentials` are not configured directly, the following
|
102
|
+
# locations will be searched for credentials:
|
103
|
+
#
|
104
|
+
# * `Aws.config[:credentials]`
|
105
|
+
# * The `:access_key_id`, `:secret_access_key`, `:session_token`, and
|
106
|
+
# `:account_id` options.
|
107
|
+
# * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'],
|
108
|
+
# ENV['AWS_SESSION_TOKEN'], and ENV['AWS_ACCOUNT_ID']
|
109
|
+
# * `~/.aws/credentials`
|
110
|
+
# * `~/.aws/config`
|
111
|
+
# * EC2/ECS IMDS instance profile - When used by default, the timeouts
|
112
|
+
# are very aggressive. Construct and pass an instance of
|
113
|
+
# `Aws::InstanceProfileCredentials` or `Aws::ECSCredentials` to
|
114
|
+
# enable retries and extended timeouts. Instance profile credential
|
115
|
+
# fetching can be disabled by setting ENV['AWS_EC2_METADATA_DISABLED']
|
116
|
+
# to true.
|
117
|
+
#
|
118
|
+
# @option options [required, String] :region
|
119
|
+
# The AWS region to connect to. The configured `:region` is
|
120
|
+
# used to determine the service `:endpoint`. When not passed,
|
121
|
+
# a default `:region` is searched for in the following locations:
|
122
|
+
#
|
123
|
+
# * `Aws.config[:region]`
|
124
|
+
# * `ENV['AWS_REGION']`
|
125
|
+
# * `ENV['AMAZON_REGION']`
|
126
|
+
# * `ENV['AWS_DEFAULT_REGION']`
|
127
|
+
# * `~/.aws/credentials`
|
128
|
+
# * `~/.aws/config`
|
129
|
+
#
|
130
|
+
# @option options [String] :access_key_id
|
131
|
+
#
|
132
|
+
# @option options [String] :account_id
|
133
|
+
#
|
134
|
+
# @option options [Boolean] :adaptive_retry_wait_to_fill (true)
|
135
|
+
# Used only in `adaptive` retry mode. When true, the request will sleep
|
136
|
+
# until there is sufficent client side capacity to retry the request.
|
137
|
+
# When false, the request will raise a `RetryCapacityNotAvailableError` and will
|
138
|
+
# not retry instead of sleeping.
|
139
|
+
#
|
140
|
+
# @option options [Boolean] :convert_params (true)
|
141
|
+
# When `true`, an attempt is made to coerce request parameters into
|
142
|
+
# the required types.
|
143
|
+
#
|
144
|
+
# @option options [Boolean] :correct_clock_skew (true)
|
145
|
+
# Used only in `standard` and adaptive retry modes. Specifies whether to apply
|
146
|
+
# a clock skew correction and retry requests with skewed client clocks.
|
147
|
+
#
|
148
|
+
# @option options [String] :defaults_mode ("legacy")
|
149
|
+
# See {Aws::DefaultsModeConfiguration} for a list of the
|
150
|
+
# accepted modes and the configuration defaults that are included.
|
151
|
+
#
|
152
|
+
# @option options [Boolean] :disable_request_compression (false)
|
153
|
+
# When set to 'true' the request body will not be compressed
|
154
|
+
# for supported operations.
|
155
|
+
#
|
156
|
+
# @option options [String, URI::HTTPS, URI::HTTP] :endpoint
|
157
|
+
# Normally you should not configure the `:endpoint` option
|
158
|
+
# directly. This is normally constructed from the `:region`
|
159
|
+
# option. Configuring `:endpoint` is normally reserved for
|
160
|
+
# connecting to test or custom endpoints. The endpoint should
|
161
|
+
# be a URI formatted like:
|
162
|
+
#
|
163
|
+
# 'http://example.com'
|
164
|
+
# 'https://example.com'
|
165
|
+
# 'http://example.com:123'
|
166
|
+
#
|
167
|
+
# @option options [Proc] :event_stream_handler
|
168
|
+
# 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.
|
169
|
+
#
|
170
|
+
# @option options [Boolean] :ignore_configured_endpoint_urls
|
171
|
+
# Setting to true disables use of endpoint URLs provided via environment
|
172
|
+
# variables and the shared configuration file.
|
173
|
+
#
|
174
|
+
# @option options [Proc] :input_event_stream_handler
|
175
|
+
# When an EventStream or Proc object is provided, it can be used for sending events for the event stream.
|
176
|
+
#
|
177
|
+
# @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
|
178
|
+
# The log formatter.
|
179
|
+
#
|
180
|
+
# @option options [Symbol] :log_level (:info)
|
181
|
+
# The log level to send messages to the `:logger` at.
|
182
|
+
#
|
183
|
+
# @option options [Logger] :logger
|
184
|
+
# The Logger instance to send log messages to. If this option
|
185
|
+
# is not set, logging will be disabled.
|
186
|
+
#
|
187
|
+
# @option options [Integer] :max_attempts (3)
|
188
|
+
# An integer representing the maximum number attempts that will be made for
|
189
|
+
# a single request, including the initial attempt. For example,
|
190
|
+
# setting this value to 5 will result in a request being retried up to
|
191
|
+
# 4 times. Used in `standard` and `adaptive` retry modes.
|
192
|
+
#
|
193
|
+
# @option options [Proc] :output_event_stream_handler
|
194
|
+
# 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.
|
195
|
+
#
|
196
|
+
# @option options [String] :profile ("default")
|
197
|
+
# Used when loading credentials from the shared credentials file
|
198
|
+
# at HOME/.aws/credentials. When not specified, 'default' is used.
|
199
|
+
#
|
200
|
+
# @option options [String] :request_checksum_calculation ("when_supported")
|
201
|
+
# Determines when a checksum will be calculated for request payloads. Values are:
|
202
|
+
#
|
203
|
+
# * `when_supported` - (default) When set, a checksum will be
|
204
|
+
# calculated for all request payloads of operations modeled with the
|
205
|
+
# `httpChecksum` trait where `requestChecksumRequired` is `true` and/or a
|
206
|
+
# `requestAlgorithmMember` is modeled.
|
207
|
+
# * `when_required` - When set, a checksum will only be calculated for
|
208
|
+
# request payloads of operations modeled with the `httpChecksum` trait where
|
209
|
+
# `requestChecksumRequired` is `true` or where a `requestAlgorithmMember`
|
210
|
+
# is modeled and supplied.
|
211
|
+
#
|
212
|
+
# @option options [Integer] :request_min_compression_size_bytes (10240)
|
213
|
+
# The minimum size in bytes that triggers compression for request
|
214
|
+
# bodies. The value must be non-negative integer value between 0
|
215
|
+
# and 10485780 bytes inclusive.
|
216
|
+
#
|
217
|
+
# @option options [String] :response_checksum_validation ("when_supported")
|
218
|
+
# Determines when checksum validation will be performed on response payloads. Values are:
|
219
|
+
#
|
220
|
+
# * `when_supported` - (default) When set, checksum validation is performed on all
|
221
|
+
# response payloads of operations modeled with the `httpChecksum` trait where
|
222
|
+
# `responseAlgorithms` is modeled, except when no modeled checksum algorithms
|
223
|
+
# are supported.
|
224
|
+
# * `when_required` - When set, checksum validation is not performed on
|
225
|
+
# response payloads of operations unless the checksum algorithm is supported and
|
226
|
+
# the `requestValidationModeMember` member is set to `ENABLED`.
|
227
|
+
#
|
228
|
+
# @option options [Proc] :retry_backoff
|
229
|
+
# A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay.
|
230
|
+
# This option is only used in the `legacy` retry mode.
|
231
|
+
#
|
232
|
+
# @option options [Float] :retry_base_delay (0.3)
|
233
|
+
# The base delay in seconds used by the default backoff function. This option
|
234
|
+
# is only used in the `legacy` retry mode.
|
235
|
+
#
|
236
|
+
# @option options [Symbol] :retry_jitter (:none)
|
237
|
+
# A delay randomiser function used by the default backoff function.
|
238
|
+
# Some predefined functions can be referenced by name - :none, :equal, :full,
|
239
|
+
# otherwise a Proc that takes and returns a number. This option is only used
|
240
|
+
# in the `legacy` retry mode.
|
241
|
+
#
|
242
|
+
# @see https://www.awsarchitectureblog.com/2015/03/backoff.html
|
243
|
+
#
|
244
|
+
# @option options [Integer] :retry_limit (3)
|
245
|
+
# The maximum number of times to retry failed requests. Only
|
246
|
+
# ~ 500 level server errors and certain ~ 400 level client errors
|
247
|
+
# are retried. Generally, these are throttling errors, data
|
248
|
+
# checksum errors, networking errors, timeout errors, auth errors,
|
249
|
+
# endpoint discovery, and errors from expired credentials.
|
250
|
+
# This option is only used in the `legacy` retry mode.
|
251
|
+
#
|
252
|
+
# @option options [Integer] :retry_max_delay (0)
|
253
|
+
# The maximum number of seconds to delay between retries (0 for no limit)
|
254
|
+
# used by the default backoff function. This option is only used in the
|
255
|
+
# `legacy` retry mode.
|
256
|
+
#
|
257
|
+
# @option options [String] :retry_mode ("legacy")
|
258
|
+
# Specifies which retry algorithm to use. Values are:
|
259
|
+
#
|
260
|
+
# * `legacy` - The pre-existing retry behavior. This is default value if
|
261
|
+
# no retry mode is provided.
|
262
|
+
#
|
263
|
+
# * `standard` - A standardized set of retry rules across the AWS SDKs.
|
264
|
+
# This includes support for retry quotas, which limit the number of
|
265
|
+
# unsuccessful retries a client can make.
|
266
|
+
#
|
267
|
+
# * `adaptive` - An experimental retry mode that includes all the
|
268
|
+
# functionality of `standard` mode along with automatic client side
|
269
|
+
# throttling. This is a provisional mode that may change behavior
|
270
|
+
# in the future.
|
271
|
+
#
|
272
|
+
# @option options [String] :sdk_ua_app_id
|
273
|
+
# A unique and opaque application ID that is appended to the
|
274
|
+
# User-Agent header as app/sdk_ua_app_id. It should have a
|
275
|
+
# maximum length of 50. This variable is sourced from environment
|
276
|
+
# variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
|
277
|
+
#
|
278
|
+
# @option options [String] :secret_access_key
|
279
|
+
#
|
280
|
+
# @option options [String] :session_token
|
281
|
+
#
|
282
|
+
# @option options [Array] :sigv4a_signing_region_set
|
283
|
+
# A list of regions that should be signed with SigV4a signing. When
|
284
|
+
# not passed, a default `:sigv4a_signing_region_set` is searched for
|
285
|
+
# in the following locations:
|
286
|
+
#
|
287
|
+
# * `Aws.config[:sigv4a_signing_region_set]`
|
288
|
+
# * `ENV['AWS_SIGV4A_SIGNING_REGION_SET']`
|
289
|
+
# * `~/.aws/config`
|
290
|
+
#
|
291
|
+
# @option options [Boolean] :stub_responses (false)
|
292
|
+
# Causes the client to return stubbed responses. By default
|
293
|
+
# fake responses are generated and returned. You can specify
|
294
|
+
# the response data to return or errors to raise by calling
|
295
|
+
# {ClientStubs#stub_responses}. See {ClientStubs} for more information.
|
296
|
+
#
|
297
|
+
# ** Please note ** When response stubbing is enabled, no HTTP
|
298
|
+
# requests are made, and retries are disabled.
|
299
|
+
#
|
300
|
+
# @option options [Aws::Telemetry::TelemetryProviderBase] :telemetry_provider (Aws::Telemetry::NoOpTelemetryProvider)
|
301
|
+
# Allows you to provide a telemetry provider, which is used to
|
302
|
+
# emit telemetry data. By default, uses `NoOpTelemetryProvider` which
|
303
|
+
# will not record or emit any telemetry data. The SDK supports the
|
304
|
+
# following telemetry providers:
|
305
|
+
#
|
306
|
+
# * OpenTelemetry (OTel) - To use the OTel provider, install and require the
|
307
|
+
# `opentelemetry-sdk` gem and then, pass in an instance of a
|
308
|
+
# `Aws::Telemetry::OTelProvider` for telemetry provider.
|
309
|
+
#
|
310
|
+
# @option options [Aws::TokenProvider] :token_provider
|
311
|
+
# A Bearer Token Provider. This can be an instance of any one of the
|
312
|
+
# following classes:
|
313
|
+
#
|
314
|
+
# * `Aws::StaticTokenProvider` - Used for configuring static, non-refreshing
|
315
|
+
# tokens.
|
316
|
+
#
|
317
|
+
# * `Aws::SSOTokenProvider` - Used for loading tokens from AWS SSO using an
|
318
|
+
# access token generated from `aws login`.
|
319
|
+
#
|
320
|
+
# When `:token_provider` is not configured directly, the `Aws::TokenProviderChain`
|
321
|
+
# will be used to search for tokens configured for your profile in shared configuration files.
|
322
|
+
#
|
323
|
+
# @option options [Boolean] :use_dualstack_endpoint
|
324
|
+
# When set to `true`, dualstack enabled endpoints (with `.aws` TLD)
|
325
|
+
# will be used if available.
|
326
|
+
#
|
327
|
+
# @option options [Boolean] :use_fips_endpoint
|
328
|
+
# When set to `true`, fips compatible endpoints will be used if available.
|
329
|
+
# When a `fips` region is used, the region is normalized and this config
|
330
|
+
# is set to `true`.
|
331
|
+
#
|
332
|
+
# @option options [Boolean] :validate_params (true)
|
333
|
+
# When `true`, request parameters are validated before
|
334
|
+
# sending the request.
|
335
|
+
#
|
336
|
+
# @option options [Aws::BedrockRuntime::EndpointProvider] :endpoint_provider
|
337
|
+
# The endpoint provider used to resolve endpoints. Any object that responds to
|
338
|
+
# `#resolve_endpoint(parameters)` where `parameters` is a Struct similar to
|
339
|
+
# `Aws::BedrockRuntime::EndpointParameters`.
|
340
|
+
#
|
341
|
+
# @option options [Integer] :connection_read_timeout (60)
|
342
|
+
# Connection read timeout in seconds, defaults to 60 sec.
|
343
|
+
#
|
344
|
+
# @option options [Integer] :connection_timeout (60)
|
345
|
+
# Connection timeout in seconds, defaults to 60 sec.
|
346
|
+
#
|
347
|
+
# @option options [Boolean] :enable_alpn (true)
|
348
|
+
# Set to `false` to disable ALPN in HTTP2 over TLS. ALPN requires Openssl version >= 1.0.2.
|
349
|
+
# Note: RFC7540 requires HTTP2 to use ALPN over TLS but some
|
350
|
+
# services may not fully support ALPN and require setting this to `false`.
|
351
|
+
#
|
352
|
+
# @option options [Boolean] :http_wire_trace (false)
|
353
|
+
# When `true`, HTTP2 debug output will be sent to the `:logger`.
|
354
|
+
#
|
355
|
+
# @option options [Integer] :max_concurrent_streams (100)
|
356
|
+
# Maximum concurrent streams used in HTTP2 connection, defaults to 100. Note that server may send back
|
357
|
+
# :settings_max_concurrent_streams value which will take priority when initializing new streams.
|
358
|
+
#
|
359
|
+
# @option options [Boolean] :raise_response_errors (true)
|
360
|
+
# Defaults to `true`, raises errors if exist when #wait or #join! is called upon async response.
|
361
|
+
#
|
362
|
+
# @option options [Integer] :read_chunk_size (1024)
|
363
|
+
#
|
364
|
+
# @option options [String] :ssl_ca_bundle
|
365
|
+
# Full path to the SSL certificate authority bundle file that should be used when
|
366
|
+
# verifying peer certificates. If you do not pass `:ssl_ca_directory` or `:ssl_ca_bundle`
|
367
|
+
# the system default will be used if available.
|
368
|
+
#
|
369
|
+
# @option options [String] :ssl_ca_directory
|
370
|
+
# Full path of the directory that contains the unbundled SSL certificate authority
|
371
|
+
# files for verifying peer certificates. If you do not pass `:ssl_ca_bundle` or
|
372
|
+
# `:ssl_ca_directory` the system default will be used if available.
|
373
|
+
#
|
374
|
+
# @option options [String] :ssl_ca_store
|
375
|
+
#
|
376
|
+
# @option options [Boolean] :ssl_verify_peer (true)
|
377
|
+
# When `true`, SSL peer certificates are verified when establishing a connection.
|
378
|
+
#
|
379
|
+
def initialize(*args)
|
380
|
+
unless Kernel.const_defined?("HTTP2")
|
381
|
+
raise "Must include http/2 gem to use AsyncClient instances."
|
382
|
+
end
|
383
|
+
super
|
384
|
+
end
|
385
|
+
|
386
|
+
# @!group API Operations
|
387
|
+
|
388
|
+
# Invoke the specified Amazon Bedrock model to run inference using the
|
389
|
+
# bidirectional stream. The response is returned in a stream that
|
390
|
+
# remains open for 8 minutes. A single session can contain multiple
|
391
|
+
# prompts and responses from the model. The prompts to the model are
|
392
|
+
# provided as audio files and the model's responses are spoken back to
|
393
|
+
# the user and transcribed.
|
394
|
+
#
|
395
|
+
# It is possible for users to interrupt the model's response with a new
|
396
|
+
# prompt, which will halt the response speech. The model will retain
|
397
|
+
# contextual awareness of the conversation while pivoting to respond to
|
398
|
+
# the new prompt.
|
399
|
+
#
|
400
|
+
# @option params [required, String] :model_id
|
401
|
+
# The model ID or ARN of the model ID to use. Currently, only
|
402
|
+
# `amazon.nova-sonic-v1:0` is supported.
|
403
|
+
#
|
404
|
+
# @return [Types::InvokeModelWithBidirectionalStreamResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
405
|
+
#
|
406
|
+
# * {Types::InvokeModelWithBidirectionalStreamResponse#body #body} => Types::InvokeModelWithBidirectionalStreamOutput
|
407
|
+
#
|
408
|
+
# @example Bi-directional EventStream Operation Example
|
409
|
+
#
|
410
|
+
# You can signal input events after the initial request is established. Events
|
411
|
+
# will be sent to the stream immediately once the stream connection is
|
412
|
+
# established successfully.
|
413
|
+
#
|
414
|
+
# To signal events, you can call the #signal methods from an Aws::BedrockRuntime::EventStreams::InvokeModelWithBidirectionalStreamInput
|
415
|
+
# object. You must signal events before calling #wait or #join! on the async response.
|
416
|
+
#
|
417
|
+
# input_stream = Aws::BedrockRuntime::EventStreams::InvokeModelWithBidirectionalStreamInput.new
|
418
|
+
#
|
419
|
+
# async_resp = client.invoke_model_with_bidirectional_stream(
|
420
|
+
# # params input
|
421
|
+
# input_event_stream_handler: input_stream) do |out_stream|
|
422
|
+
#
|
423
|
+
# # register callbacks for events
|
424
|
+
# out_stream.on_chunk_event do |event|
|
425
|
+
# event # => Aws::BedrockRuntime::Types::chunk
|
426
|
+
# end
|
427
|
+
# out_stream.on_internal_server_exception_event do |event|
|
428
|
+
# event # => Aws::BedrockRuntime::Types::internalServerException
|
429
|
+
# end
|
430
|
+
# out_stream.on_model_stream_error_exception_event do |event|
|
431
|
+
# event # => Aws::BedrockRuntime::Types::modelStreamErrorException
|
432
|
+
# end
|
433
|
+
# out_stream.on_validation_exception_event do |event|
|
434
|
+
# event # => Aws::BedrockRuntime::Types::validationException
|
435
|
+
# end
|
436
|
+
# out_stream.on_throttling_exception_event do |event|
|
437
|
+
# event # => Aws::BedrockRuntime::Types::throttlingException
|
438
|
+
# end
|
439
|
+
# out_stream.on_model_timeout_exception_event do |event|
|
440
|
+
# event # => Aws::BedrockRuntime::Types::modelTimeoutException
|
441
|
+
# end
|
442
|
+
# out_stream.on_service_unavailable_exception_event do |event|
|
443
|
+
# event # => Aws::BedrockRuntime::Types::serviceUnavailableException
|
444
|
+
# end
|
445
|
+
#
|
446
|
+
# end
|
447
|
+
# # => Aws::Seahorse::Client::AsyncResponse
|
448
|
+
#
|
449
|
+
# # signal events
|
450
|
+
# input_stream.signal_chunk_event( ... )
|
451
|
+
#
|
452
|
+
# # make sure to signal :end_stream at the end
|
453
|
+
# input_stream.signal_end_stream
|
454
|
+
#
|
455
|
+
# # wait until stream is closed before finalizing the sync response
|
456
|
+
# resp = async_resp.wait
|
457
|
+
# # Or close the stream and finalize sync response immediately
|
458
|
+
# # resp = async_resp.join!
|
459
|
+
#
|
460
|
+
# You can also provide an Aws::BedrockRuntime::EventStreams::InvokeModelWithBidirectionalStreamOutput object to register callbacks
|
461
|
+
# before initializing the request instead of processing from the request block.
|
462
|
+
#
|
463
|
+
# output_stream = Aws::BedrockRuntime::EventStreams::InvokeModelWithBidirectionalStreamOutput.new
|
464
|
+
# # register callbacks for output events
|
465
|
+
# output_stream.on_chunk_event do |event|
|
466
|
+
# event # => Aws::BedrockRuntime::Types::chunk
|
467
|
+
# end
|
468
|
+
# output_stream.on_internal_server_exception_event do |event|
|
469
|
+
# event # => Aws::BedrockRuntime::Types::internalServerException
|
470
|
+
# end
|
471
|
+
# output_stream.on_model_stream_error_exception_event do |event|
|
472
|
+
# event # => Aws::BedrockRuntime::Types::modelStreamErrorException
|
473
|
+
# end
|
474
|
+
# output_stream.on_validation_exception_event do |event|
|
475
|
+
# event # => Aws::BedrockRuntime::Types::validationException
|
476
|
+
# end
|
477
|
+
# output_stream.on_throttling_exception_event do |event|
|
478
|
+
# event # => Aws::BedrockRuntime::Types::throttlingException
|
479
|
+
# end
|
480
|
+
# output_stream.on_model_timeout_exception_event do |event|
|
481
|
+
# event # => Aws::BedrockRuntime::Types::modelTimeoutException
|
482
|
+
# end
|
483
|
+
# output_stream.on_service_unavailable_exception_event do |event|
|
484
|
+
# event # => Aws::BedrockRuntime::Types::serviceUnavailableException
|
485
|
+
# end
|
486
|
+
# output_stream.on_error_event do |event|
|
487
|
+
# # catch unmodeled error event in the stream
|
488
|
+
# raise event
|
489
|
+
# # => Aws::Errors::EventError
|
490
|
+
# # event.event_type => :error
|
491
|
+
# # event.error_code => String
|
492
|
+
# # event.error_message => String
|
493
|
+
# end
|
494
|
+
#
|
495
|
+
# async_resp = client.invoke_model_with_bidirectional_stream (
|
496
|
+
# # params input
|
497
|
+
# input_event_stream_handler: input_stream
|
498
|
+
# output_event_stream_handler: output_stream
|
499
|
+
# )
|
500
|
+
#
|
501
|
+
# resp = async_resp.join!
|
502
|
+
#
|
503
|
+
# You can also iterate through events after the response is complete.
|
504
|
+
#
|
505
|
+
# Events are available at resp.body # => Enumerator
|
506
|
+
#
|
507
|
+
# @example Request syntax with placeholder values
|
508
|
+
#
|
509
|
+
# async_resp = async_client.invoke_model_with_bidirectional_stream({
|
510
|
+
# model_id: "InvokeModelIdentifier", # required
|
511
|
+
# input_event_stream_hander: EventStreams::InvokeModelWithBidirectionalStreamInput.new,
|
512
|
+
# })
|
513
|
+
# # => Seahorse::Client::AsyncResponse
|
514
|
+
# async_resp.wait
|
515
|
+
# # => Seahorse::Client::Response
|
516
|
+
# # Or use async_resp.join!
|
517
|
+
#
|
518
|
+
# @example Response structure
|
519
|
+
#
|
520
|
+
# All events are available at resp.body:
|
521
|
+
# resp.body #=> Enumerator
|
522
|
+
# resp.body.event_types #=> [:chunk, :internal_server_exception, :model_stream_error_exception, :validation_exception, :throttling_exception, :model_timeout_exception, :service_unavailable_exception]
|
523
|
+
#
|
524
|
+
# For :chunk event available at #on_chunk_event callback and response eventstream enumerator:
|
525
|
+
# event.bytes #=> String
|
526
|
+
#
|
527
|
+
# For :internal_server_exception event available at #on_internal_server_exception_event callback and response eventstream enumerator:
|
528
|
+
# event.message #=> String
|
529
|
+
#
|
530
|
+
# For :model_stream_error_exception event available at #on_model_stream_error_exception_event callback and response eventstream enumerator:
|
531
|
+
# event.message #=> String
|
532
|
+
# event.original_status_code #=> Integer
|
533
|
+
# event.original_message #=> String
|
534
|
+
#
|
535
|
+
# For :validation_exception event available at #on_validation_exception_event callback and response eventstream enumerator:
|
536
|
+
# event.message #=> String
|
537
|
+
#
|
538
|
+
# For :throttling_exception event available at #on_throttling_exception_event callback and response eventstream enumerator:
|
539
|
+
# event.message #=> String
|
540
|
+
#
|
541
|
+
# For :model_timeout_exception event available at #on_model_timeout_exception_event callback and response eventstream enumerator:
|
542
|
+
# event.message #=> String
|
543
|
+
#
|
544
|
+
# For :service_unavailable_exception event available at #on_service_unavailable_exception_event callback and response eventstream enumerator:
|
545
|
+
# event.message #=> String
|
546
|
+
#
|
547
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelWithBidirectionalStream AWS API Documentation
|
548
|
+
#
|
549
|
+
# @overload invoke_model_with_bidirectional_stream(params = {})
|
550
|
+
# @param [Hash] params ({})
|
551
|
+
def invoke_model_with_bidirectional_stream(params = {}, options = {}, &block)
|
552
|
+
params = params.dup
|
553
|
+
input_event_stream_handler = _event_stream_handler(
|
554
|
+
:input,
|
555
|
+
params.delete(:input_event_stream_handler),
|
556
|
+
EventStreams::InvokeModelWithBidirectionalStreamInput
|
557
|
+
)
|
558
|
+
output_event_stream_handler = _event_stream_handler(
|
559
|
+
:output,
|
560
|
+
params.delete(:output_event_stream_handler) || params.delete(:event_stream_handler),
|
561
|
+
EventStreams::InvokeModelWithBidirectionalStreamOutput
|
562
|
+
)
|
563
|
+
|
564
|
+
yield(output_event_stream_handler) if block_given?
|
565
|
+
|
566
|
+
req = build_request(:invoke_model_with_bidirectional_stream, params)
|
567
|
+
|
568
|
+
req.context[:input_event_stream_handler] = input_event_stream_handler
|
569
|
+
req.handlers.add(Aws::Binary::EncodeHandler, priority: 55)
|
570
|
+
req.context[:output_event_stream_handler] = output_event_stream_handler
|
571
|
+
req.handlers.add(Aws::Binary::DecodeHandler, priority: 55)
|
572
|
+
|
573
|
+
req.send_request(options, &block)
|
574
|
+
end
|
575
|
+
|
576
|
+
# @!endgroup
|
577
|
+
|
578
|
+
# @param params ({})
|
579
|
+
# @api private
|
580
|
+
def build_request(operation_name, params = {})
|
581
|
+
handlers = @handlers.for(operation_name)
|
582
|
+
tracer = config.telemetry_provider.tracer_provider.tracer(
|
583
|
+
Aws::Telemetry.module_to_tracer_name('Aws::BedrockRuntime')
|
584
|
+
)
|
585
|
+
context = Seahorse::Client::RequestContext.new(
|
586
|
+
operation_name: operation_name,
|
587
|
+
operation: config.api.operation(operation_name),
|
588
|
+
client: self,
|
589
|
+
params: params,
|
590
|
+
http_response: Seahorse::Client::Http::AsyncResponse.new,
|
591
|
+
config: config,
|
592
|
+
tracer: tracer
|
593
|
+
)
|
594
|
+
context[:gem_name] = 'aws-sdk-bedrockruntime'
|
595
|
+
context[:gem_version] = '1.44.0'
|
596
|
+
Seahorse::Client::Request.new(handlers, context)
|
597
|
+
end
|
598
|
+
|
599
|
+
private
|
600
|
+
|
601
|
+
def _event_stream_handler(type, handler, event_stream_class)
|
602
|
+
case handler
|
603
|
+
when event_stream_class then handler
|
604
|
+
when Proc then event_stream_class.new.tap(&handler)
|
605
|
+
when nil then event_stream_class.new
|
606
|
+
else
|
607
|
+
msg = "expected #{type}_event_stream_handler to be a block or "\
|
608
|
+
"instance of Aws::BedrockRuntime::#{event_stream_class}"\
|
609
|
+
", got `#{handler.inspect}` instead"
|
610
|
+
raise ArgumentError, msg
|
611
|
+
end
|
612
|
+
end
|
613
|
+
|
614
|
+
class << self
|
615
|
+
|
616
|
+
# @api private
|
617
|
+
attr_reader :identifier
|
618
|
+
|
619
|
+
# @api private
|
620
|
+
def errors_module
|
621
|
+
Errors
|
622
|
+
end
|
623
|
+
|
624
|
+
end
|
625
|
+
end
|
626
|
+
end
|
@@ -2548,7 +2548,7 @@ module Aws::BedrockRuntime
|
|
2548
2548
|
tracer: tracer
|
2549
2549
|
)
|
2550
2550
|
context[:gem_name] = 'aws-sdk-bedrockruntime'
|
2551
|
-
context[:gem_version] = '1.
|
2551
|
+
context[:gem_version] = '1.44.0'
|
2552
2552
|
Seahorse::Client::Request.new(handlers, context)
|
2553
2553
|
end
|
2554
2554
|
|
@@ -29,6 +29,8 @@ module Aws::BedrockRuntime
|
|
29
29
|
AsyncInvokeSummaries = Shapes::ListShape.new(name: 'AsyncInvokeSummaries')
|
30
30
|
AsyncInvokeSummary = Shapes::StructureShape.new(name: 'AsyncInvokeSummary')
|
31
31
|
AutoToolChoice = Shapes::StructureShape.new(name: 'AutoToolChoice')
|
32
|
+
BidirectionalInputPayloadPart = Shapes::StructureShape.new(name: 'BidirectionalInputPayloadPart')
|
33
|
+
BidirectionalOutputPayloadPart = Shapes::StructureShape.new(name: 'BidirectionalOutputPayloadPart')
|
32
34
|
Blob = Shapes::BlobShape.new(name: 'Blob')
|
33
35
|
Body = Shapes::BlobShape.new(name: 'Body')
|
34
36
|
Boolean = Shapes::BooleanShape.new(name: 'Boolean')
|
@@ -163,6 +165,10 @@ module Aws::BedrockRuntime
|
|
163
165
|
InvokeModelIdentifier = Shapes::StringShape.new(name: 'InvokeModelIdentifier')
|
164
166
|
InvokeModelRequest = Shapes::StructureShape.new(name: 'InvokeModelRequest')
|
165
167
|
InvokeModelResponse = Shapes::StructureShape.new(name: 'InvokeModelResponse')
|
168
|
+
InvokeModelWithBidirectionalStreamInput = Shapes::StructureShape.new(name: 'InvokeModelWithBidirectionalStreamInput')
|
169
|
+
InvokeModelWithBidirectionalStreamOutput = Shapes::StructureShape.new(name: 'InvokeModelWithBidirectionalStreamOutput')
|
170
|
+
InvokeModelWithBidirectionalStreamRequest = Shapes::StructureShape.new(name: 'InvokeModelWithBidirectionalStreamRequest')
|
171
|
+
InvokeModelWithBidirectionalStreamResponse = Shapes::StructureShape.new(name: 'InvokeModelWithBidirectionalStreamResponse')
|
166
172
|
InvokeModelWithResponseStreamRequest = Shapes::StructureShape.new(name: 'InvokeModelWithResponseStreamRequest')
|
167
173
|
InvokeModelWithResponseStreamResponse = Shapes::StructureShape.new(name: 'InvokeModelWithResponseStreamResponse')
|
168
174
|
InvokedModelId = Shapes::StringShape.new(name: 'InvokedModelId')
|
@@ -297,6 +303,12 @@ module Aws::BedrockRuntime
|
|
297
303
|
|
298
304
|
AutoToolChoice.struct_class = Types::AutoToolChoice
|
299
305
|
|
306
|
+
BidirectionalInputPayloadPart.add_member(:bytes, Shapes::ShapeRef.new(shape: PartBody, location_name: "bytes"))
|
307
|
+
BidirectionalInputPayloadPart.struct_class = Types::BidirectionalInputPayloadPart
|
308
|
+
|
309
|
+
BidirectionalOutputPayloadPart.add_member(:bytes, Shapes::ShapeRef.new(shape: PartBody, location_name: "bytes"))
|
310
|
+
BidirectionalOutputPayloadPart.struct_class = Types::BidirectionalOutputPayloadPart
|
311
|
+
|
300
312
|
CachePointBlock.add_member(:type, Shapes::ShapeRef.new(shape: CachePointType, required: true, location_name: "type"))
|
301
313
|
CachePointBlock.struct_class = Types::CachePointBlock
|
302
314
|
|
@@ -691,6 +703,29 @@ module Aws::BedrockRuntime
|
|
691
703
|
InvokeModelResponse[:payload] = :body
|
692
704
|
InvokeModelResponse[:payload_member] = InvokeModelResponse.member(:body)
|
693
705
|
|
706
|
+
InvokeModelWithBidirectionalStreamInput.add_member(:chunk, Shapes::ShapeRef.new(shape: BidirectionalInputPayloadPart, event: true, location_name: "chunk"))
|
707
|
+
InvokeModelWithBidirectionalStreamInput.struct_class = Types::InvokeModelWithBidirectionalStreamInput
|
708
|
+
|
709
|
+
InvokeModelWithBidirectionalStreamOutput.add_member(:chunk, Shapes::ShapeRef.new(shape: BidirectionalOutputPayloadPart, event: true, location_name: "chunk"))
|
710
|
+
InvokeModelWithBidirectionalStreamOutput.add_member(:internal_server_exception, Shapes::ShapeRef.new(shape: InternalServerException, location_name: "internalServerException"))
|
711
|
+
InvokeModelWithBidirectionalStreamOutput.add_member(:model_stream_error_exception, Shapes::ShapeRef.new(shape: ModelStreamErrorException, location_name: "modelStreamErrorException"))
|
712
|
+
InvokeModelWithBidirectionalStreamOutput.add_member(:validation_exception, Shapes::ShapeRef.new(shape: ValidationException, location_name: "validationException"))
|
713
|
+
InvokeModelWithBidirectionalStreamOutput.add_member(:throttling_exception, Shapes::ShapeRef.new(shape: ThrottlingException, location_name: "throttlingException"))
|
714
|
+
InvokeModelWithBidirectionalStreamOutput.add_member(:model_timeout_exception, Shapes::ShapeRef.new(shape: ModelTimeoutException, location_name: "modelTimeoutException"))
|
715
|
+
InvokeModelWithBidirectionalStreamOutput.add_member(:service_unavailable_exception, Shapes::ShapeRef.new(shape: ServiceUnavailableException, location_name: "serviceUnavailableException"))
|
716
|
+
InvokeModelWithBidirectionalStreamOutput.struct_class = Types::InvokeModelWithBidirectionalStreamOutput
|
717
|
+
|
718
|
+
InvokeModelWithBidirectionalStreamRequest.add_member(:model_id, Shapes::ShapeRef.new(shape: InvokeModelIdentifier, required: true, location: "uri", location_name: "modelId"))
|
719
|
+
InvokeModelWithBidirectionalStreamRequest.add_member(:body, Shapes::ShapeRef.new(shape: InvokeModelWithBidirectionalStreamInput, required: true, eventstream: true, location_name: "body"))
|
720
|
+
InvokeModelWithBidirectionalStreamRequest.struct_class = Types::InvokeModelWithBidirectionalStreamRequest
|
721
|
+
InvokeModelWithBidirectionalStreamRequest[:payload] = :body
|
722
|
+
InvokeModelWithBidirectionalStreamRequest[:payload_member] = InvokeModelWithBidirectionalStreamRequest.member(:body)
|
723
|
+
|
724
|
+
InvokeModelWithBidirectionalStreamResponse.add_member(:body, Shapes::ShapeRef.new(shape: InvokeModelWithBidirectionalStreamOutput, required: true, eventstream: true, location_name: "body"))
|
725
|
+
InvokeModelWithBidirectionalStreamResponse.struct_class = Types::InvokeModelWithBidirectionalStreamResponse
|
726
|
+
InvokeModelWithBidirectionalStreamResponse[:payload] = :body
|
727
|
+
InvokeModelWithBidirectionalStreamResponse[:payload_member] = InvokeModelWithBidirectionalStreamResponse.member(:body)
|
728
|
+
|
694
729
|
InvokeModelWithResponseStreamRequest.add_member(:body, Shapes::ShapeRef.new(shape: Body, location_name: "body"))
|
695
730
|
InvokeModelWithResponseStreamRequest.add_member(:content_type, Shapes::ShapeRef.new(shape: MimeType, location: "header", location_name: "Content-Type"))
|
696
731
|
InvokeModelWithResponseStreamRequest.add_member(:accept, Shapes::ShapeRef.new(shape: MimeType, location: "header", location_name: "X-Amzn-Bedrock-Accept"))
|
@@ -954,6 +989,7 @@ module Aws::BedrockRuntime
|
|
954
989
|
"auth" => ["aws.auth#sigv4"],
|
955
990
|
"endpointPrefix" => "bedrock-runtime",
|
956
991
|
"protocol" => "rest-json",
|
992
|
+
"protocolSettings" => {"h2"=>"optional"},
|
957
993
|
"protocols" => ["rest-json"],
|
958
994
|
"serviceFullName" => "Amazon Bedrock Runtime",
|
959
995
|
"serviceId" => "Bedrock Runtime",
|
@@ -983,8 +1019,8 @@ module Aws::BedrockRuntime
|
|
983
1019
|
o.input = Shapes::ShapeRef.new(shape: ConverseRequest)
|
984
1020
|
o.output = Shapes::ShapeRef.new(shape: ConverseResponse)
|
985
1021
|
o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
|
986
|
-
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
|
987
1022
|
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
|
1023
|
+
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
|
988
1024
|
o.errors << Shapes::ShapeRef.new(shape: ModelTimeoutException)
|
989
1025
|
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
|
990
1026
|
o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailableException)
|
@@ -1000,8 +1036,8 @@ module Aws::BedrockRuntime
|
|
1000
1036
|
o.input = Shapes::ShapeRef.new(shape: ConverseStreamRequest)
|
1001
1037
|
o.output = Shapes::ShapeRef.new(shape: ConverseStreamResponse)
|
1002
1038
|
o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
|
1003
|
-
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
|
1004
1039
|
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
|
1040
|
+
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
|
1005
1041
|
o.errors << Shapes::ShapeRef.new(shape: ModelTimeoutException)
|
1006
1042
|
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
|
1007
1043
|
o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailableException)
|
@@ -1035,9 +1071,29 @@ module Aws::BedrockRuntime
|
|
1035
1071
|
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
|
1036
1072
|
o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailableException)
|
1037
1073
|
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
|
1074
|
+
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
|
1038
1075
|
o.errors << Shapes::ShapeRef.new(shape: ModelNotReadyException)
|
1076
|
+
o.errors << Shapes::ShapeRef.new(shape: ModelErrorException)
|
1077
|
+
end)
|
1078
|
+
|
1079
|
+
api.add_operation(:invoke_model_with_bidirectional_stream, Seahorse::Model::Operation.new.tap do |o|
|
1080
|
+
o.name = "InvokeModelWithBidirectionalStream"
|
1081
|
+
o.http_method = "POST"
|
1082
|
+
o.http_request_uri = "/model/{modelId}/invoke-with-bidirectional-stream"
|
1083
|
+
o.input = Shapes::ShapeRef.new(shape: InvokeModelWithBidirectionalStreamRequest)
|
1084
|
+
o.output = Shapes::ShapeRef.new(shape: InvokeModelWithBidirectionalStreamResponse)
|
1085
|
+
o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
|
1086
|
+
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
|
1087
|
+
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
|
1088
|
+
o.errors << Shapes::ShapeRef.new(shape: ModelTimeoutException)
|
1089
|
+
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
|
1090
|
+
o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailableException)
|
1091
|
+
o.errors << Shapes::ShapeRef.new(shape: ModelStreamErrorException)
|
1092
|
+
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
|
1039
1093
|
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
|
1094
|
+
o.errors << Shapes::ShapeRef.new(shape: ModelNotReadyException)
|
1040
1095
|
o.errors << Shapes::ShapeRef.new(shape: ModelErrorException)
|
1096
|
+
o.async = true
|
1041
1097
|
end)
|
1042
1098
|
|
1043
1099
|
api.add_operation(:invoke_model_with_response_stream, Seahorse::Model::Operation.new.tap do |o|
|
@@ -1054,8 +1110,8 @@ module Aws::BedrockRuntime
|
|
1054
1110
|
o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailableException)
|
1055
1111
|
o.errors << Shapes::ShapeRef.new(shape: ModelStreamErrorException)
|
1056
1112
|
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
|
1057
|
-
o.errors << Shapes::ShapeRef.new(shape: ModelNotReadyException)
|
1058
1113
|
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
|
1114
|
+
o.errors << Shapes::ShapeRef.new(shape: ModelNotReadyException)
|
1059
1115
|
o.errors << Shapes::ShapeRef.new(shape: ModelErrorException)
|
1060
1116
|
end)
|
1061
1117
|
|
@@ -1084,8 +1140,8 @@ module Aws::BedrockRuntime
|
|
1084
1140
|
o.input = Shapes::ShapeRef.new(shape: StartAsyncInvokeRequest)
|
1085
1141
|
o.output = Shapes::ShapeRef.new(shape: StartAsyncInvokeResponse)
|
1086
1142
|
o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
|
1087
|
-
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
|
1088
1143
|
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
|
1144
|
+
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
|
1089
1145
|
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
|
1090
1146
|
o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailableException)
|
1091
1147
|
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
|
@@ -9,6 +9,29 @@
|
|
9
9
|
|
10
10
|
module Aws::BedrockRuntime
|
11
11
|
module EventStreams
|
12
|
+
class InvokeModelWithBidirectionalStreamInput
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@event_emitter = Aws::EventEmitter.new
|
16
|
+
end
|
17
|
+
|
18
|
+
# @option params [String, StringIO, File] :bytes
|
19
|
+
# The audio content for the bidirectional input.
|
20
|
+
#
|
21
|
+
def signal_chunk_event(params = {})
|
22
|
+
@event_emitter.emit(:chunk, params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def signal_end_stream
|
26
|
+
@event_emitter.emit(:end_stream, {})
|
27
|
+
end
|
28
|
+
|
29
|
+
# @api private
|
30
|
+
# @return Aws::EventEmitter
|
31
|
+
attr_reader :event_emitter
|
32
|
+
|
33
|
+
end
|
34
|
+
|
12
35
|
class ConverseStreamOutput
|
13
36
|
|
14
37
|
def initialize
|
@@ -92,6 +115,70 @@ module Aws::BedrockRuntime
|
|
92
115
|
# @return Aws::EventEmitter
|
93
116
|
attr_reader :event_emitter
|
94
117
|
|
118
|
+
end
|
119
|
+
class InvokeModelWithBidirectionalStreamOutput
|
120
|
+
|
121
|
+
def initialize
|
122
|
+
@event_emitter = Aws::EventEmitter.new
|
123
|
+
end
|
124
|
+
|
125
|
+
def on_chunk_event(&block)
|
126
|
+
@event_emitter.on(:chunk, block) if block_given?
|
127
|
+
end
|
128
|
+
|
129
|
+
def on_internal_server_exception_event(&block)
|
130
|
+
@event_emitter.on(:internal_server_exception, block) if block_given?
|
131
|
+
end
|
132
|
+
|
133
|
+
def on_model_stream_error_exception_event(&block)
|
134
|
+
@event_emitter.on(:model_stream_error_exception, block) if block_given?
|
135
|
+
end
|
136
|
+
|
137
|
+
def on_validation_exception_event(&block)
|
138
|
+
@event_emitter.on(:validation_exception, block) if block_given?
|
139
|
+
end
|
140
|
+
|
141
|
+
def on_throttling_exception_event(&block)
|
142
|
+
@event_emitter.on(:throttling_exception, block) if block_given?
|
143
|
+
end
|
144
|
+
|
145
|
+
def on_model_timeout_exception_event(&block)
|
146
|
+
@event_emitter.on(:model_timeout_exception, block) if block_given?
|
147
|
+
end
|
148
|
+
|
149
|
+
def on_service_unavailable_exception_event(&block)
|
150
|
+
@event_emitter.on(:service_unavailable_exception, block) if block_given?
|
151
|
+
end
|
152
|
+
|
153
|
+
def on_error_event(&block)
|
154
|
+
@event_emitter.on(:error, block) if block_given?
|
155
|
+
end
|
156
|
+
|
157
|
+
def on_initial_response_event(&block)
|
158
|
+
@event_emitter.on(:initial_response, block) if block_given?
|
159
|
+
end
|
160
|
+
|
161
|
+
def on_unknown_event(&block)
|
162
|
+
@event_emitter.on(:unknown_event, block) if block_given?
|
163
|
+
end
|
164
|
+
|
165
|
+
def on_event(&block)
|
166
|
+
on_chunk_event(&block)
|
167
|
+
on_internal_server_exception_event(&block)
|
168
|
+
on_model_stream_error_exception_event(&block)
|
169
|
+
on_validation_exception_event(&block)
|
170
|
+
on_throttling_exception_event(&block)
|
171
|
+
on_model_timeout_exception_event(&block)
|
172
|
+
on_service_unavailable_exception_event(&block)
|
173
|
+
on_error_event(&block)
|
174
|
+
on_initial_response_event(&block)
|
175
|
+
on_unknown_event(&block)
|
176
|
+
end
|
177
|
+
|
178
|
+
# @api private
|
179
|
+
# @return Aws::EventEmitter
|
180
|
+
attr_reader :event_emitter
|
181
|
+
|
95
182
|
end
|
96
183
|
class ResponseStream
|
97
184
|
|
@@ -225,6 +225,38 @@ module Aws::BedrockRuntime
|
|
225
225
|
#
|
226
226
|
class AutoToolChoice < Aws::EmptyStructure; end
|
227
227
|
|
228
|
+
# Payload content for the bidirectional input. The input is an audio
|
229
|
+
# stream.
|
230
|
+
#
|
231
|
+
# @!attribute [rw] bytes
|
232
|
+
# The audio content for the bidirectional input.
|
233
|
+
# @return [String]
|
234
|
+
#
|
235
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/BidirectionalInputPayloadPart AWS API Documentation
|
236
|
+
#
|
237
|
+
class BidirectionalInputPayloadPart < Struct.new(
|
238
|
+
:bytes,
|
239
|
+
:event_type)
|
240
|
+
SENSITIVE = [:bytes]
|
241
|
+
include Aws::Structure
|
242
|
+
end
|
243
|
+
|
244
|
+
# Output from the bidirectional stream. The output is speech and a text
|
245
|
+
# transcription.
|
246
|
+
#
|
247
|
+
# @!attribute [rw] bytes
|
248
|
+
# The speech output of the bidirectional stream.
|
249
|
+
# @return [String]
|
250
|
+
#
|
251
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/BidirectionalOutputPayloadPart AWS API Documentation
|
252
|
+
#
|
253
|
+
class BidirectionalOutputPayloadPart < Struct.new(
|
254
|
+
:bytes,
|
255
|
+
:event_type)
|
256
|
+
SENSITIVE = [:bytes]
|
257
|
+
include Aws::Structure
|
258
|
+
end
|
259
|
+
|
228
260
|
# Defines a section of content to be cached for reuse in subsequent API
|
229
261
|
# calls.
|
230
262
|
#
|
@@ -2106,6 +2138,47 @@ module Aws::BedrockRuntime
|
|
2106
2138
|
include Aws::Structure
|
2107
2139
|
end
|
2108
2140
|
|
2141
|
+
# @!attribute [rw] model_id
|
2142
|
+
# The model ID or ARN of the model ID to use. Currently, only
|
2143
|
+
# `amazon.nova-sonic-v1:0` is supported.
|
2144
|
+
# @return [String]
|
2145
|
+
#
|
2146
|
+
# @!attribute [rw] body
|
2147
|
+
# The prompt and inference parameters in the format specified in the
|
2148
|
+
# `BidirectionalInputPayloadPart` in the header. You must provide the
|
2149
|
+
# body in JSON format. To see the format and content of the request
|
2150
|
+
# and response bodies for different models, refer to [Inference
|
2151
|
+
# parameters][1]. For more information, see [Run inference][2] in the
|
2152
|
+
# Bedrock User Guide.
|
2153
|
+
#
|
2154
|
+
#
|
2155
|
+
#
|
2156
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
|
2157
|
+
# [2]: https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html
|
2158
|
+
# @return [Types::InvokeModelWithBidirectionalStreamInput]
|
2159
|
+
#
|
2160
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelWithBidirectionalStreamRequest AWS API Documentation
|
2161
|
+
#
|
2162
|
+
class InvokeModelWithBidirectionalStreamRequest < Struct.new(
|
2163
|
+
:model_id,
|
2164
|
+
:body)
|
2165
|
+
SENSITIVE = []
|
2166
|
+
include Aws::Structure
|
2167
|
+
end
|
2168
|
+
|
2169
|
+
# @!attribute [rw] body
|
2170
|
+
# Streaming response from the model in the format specified by the
|
2171
|
+
# `BidirectionalOutputPayloadPart` header.
|
2172
|
+
# @return [Types::InvokeModelWithBidirectionalStreamOutput]
|
2173
|
+
#
|
2174
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelWithBidirectionalStreamResponse AWS API Documentation
|
2175
|
+
#
|
2176
|
+
class InvokeModelWithBidirectionalStreamResponse < Struct.new(
|
2177
|
+
:body)
|
2178
|
+
SENSITIVE = []
|
2179
|
+
include Aws::Structure
|
2180
|
+
end
|
2181
|
+
|
2109
2182
|
# @!attribute [rw] body
|
2110
2183
|
# The prompt and inference parameters in the format specified in the
|
2111
2184
|
# `contentType` in the header. You must provide the body in JSON
|
@@ -3260,6 +3333,48 @@ module Aws::BedrockRuntime
|
|
3260
3333
|
|
3261
3334
|
end
|
3262
3335
|
|
3336
|
+
# Payload content, the speech chunk, for the bidirectional input of the
|
3337
|
+
# invocation step.
|
3338
|
+
#
|
3339
|
+
# EventStream is an Enumerator of Events.
|
3340
|
+
# #event_types #=> Array, returns all modeled event types in the stream
|
3341
|
+
#
|
3342
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelWithBidirectionalStreamInput AWS API Documentation
|
3343
|
+
#
|
3344
|
+
class InvokeModelWithBidirectionalStreamInput < Enumerator
|
3345
|
+
|
3346
|
+
def event_types
|
3347
|
+
[
|
3348
|
+
:chunk
|
3349
|
+
]
|
3350
|
+
end
|
3351
|
+
|
3352
|
+
end
|
3353
|
+
|
3354
|
+
# Output from the bidirectional stream that was used for model
|
3355
|
+
# invocation.
|
3356
|
+
#
|
3357
|
+
# EventStream is an Enumerator of Events.
|
3358
|
+
# #event_types #=> Array, returns all modeled event types in the stream
|
3359
|
+
#
|
3360
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelWithBidirectionalStreamOutput AWS API Documentation
|
3361
|
+
#
|
3362
|
+
class InvokeModelWithBidirectionalStreamOutput < Enumerator
|
3363
|
+
|
3364
|
+
def event_types
|
3365
|
+
[
|
3366
|
+
:chunk,
|
3367
|
+
:internal_server_exception,
|
3368
|
+
:model_stream_error_exception,
|
3369
|
+
:validation_exception,
|
3370
|
+
:throttling_exception,
|
3371
|
+
:model_timeout_exception,
|
3372
|
+
:service_unavailable_exception
|
3373
|
+
]
|
3374
|
+
end
|
3375
|
+
|
3376
|
+
end
|
3377
|
+
|
3263
3378
|
# Definition of content in the response stream.
|
3264
3379
|
#
|
3265
3380
|
# EventStream is an Enumerator of Events.
|
@@ -54,9 +54,10 @@ module Aws::BedrockRuntime
|
|
54
54
|
autoload :EndpointParameters, 'aws-sdk-bedrockruntime/endpoint_parameters'
|
55
55
|
autoload :EndpointProvider, 'aws-sdk-bedrockruntime/endpoint_provider'
|
56
56
|
autoload :Endpoints, 'aws-sdk-bedrockruntime/endpoints'
|
57
|
+
autoload :AsyncClient, 'aws-sdk-bedrockruntime/async_client'
|
57
58
|
autoload :EventStreams, 'aws-sdk-bedrockruntime/event_streams'
|
58
59
|
|
59
|
-
GEM_VERSION = '1.
|
60
|
+
GEM_VERSION = '1.44.0'
|
60
61
|
|
61
62
|
end
|
62
63
|
|
data/sig/client.rbs
CHANGED
@@ -500,6 +500,17 @@ module Aws
|
|
500
500
|
) -> _InvokeModelResponseSuccess
|
501
501
|
| (Hash[Symbol, untyped] params, ?Hash[Symbol, untyped] options) -> _InvokeModelResponseSuccess
|
502
502
|
|
503
|
+
interface _InvokeModelWithBidirectionalStreamResponseSuccess
|
504
|
+
include ::Seahorse::Client::_ResponseSuccess[Types::InvokeModelWithBidirectionalStreamResponse]
|
505
|
+
def body: () -> Types::InvokeModelWithBidirectionalStreamOutput
|
506
|
+
end
|
507
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/BedrockRuntime/Client.html#invoke_model_with_bidirectional_stream-instance_method
|
508
|
+
def invoke_model_with_bidirectional_stream: (
|
509
|
+
model_id: ::String,
|
510
|
+
input_event_stream_hander: untyped
|
511
|
+
) ?{ (*untyped) -> void } -> _InvokeModelWithBidirectionalStreamResponseSuccess
|
512
|
+
| (Hash[Symbol, untyped] params, ?Hash[Symbol, untyped] options) ?{ (*untyped) -> void } -> _InvokeModelWithBidirectionalStreamResponseSuccess
|
513
|
+
|
503
514
|
interface _InvokeModelWithResponseStreamResponseSuccess
|
504
515
|
include ::Seahorse::Client::_ResponseSuccess[Types::InvokeModelWithResponseStreamResponse]
|
505
516
|
def body: () -> Types::ResponseStream
|
data/sig/types.rbs
CHANGED
@@ -69,6 +69,18 @@ module Aws::BedrockRuntime
|
|
69
69
|
class AutoToolChoice < Aws::EmptyStructure
|
70
70
|
end
|
71
71
|
|
72
|
+
class BidirectionalInputPayloadPart
|
73
|
+
attr_accessor bytes: ::String
|
74
|
+
attr_accessor event_type: untyped
|
75
|
+
SENSITIVE: [:bytes]
|
76
|
+
end
|
77
|
+
|
78
|
+
class BidirectionalOutputPayloadPart
|
79
|
+
attr_accessor bytes: ::String
|
80
|
+
attr_accessor event_type: untyped
|
81
|
+
SENSITIVE: [:bytes]
|
82
|
+
end
|
83
|
+
|
72
84
|
class CachePointBlock
|
73
85
|
attr_accessor type: ("default")
|
74
86
|
SENSITIVE: []
|
@@ -569,6 +581,17 @@ module Aws::BedrockRuntime
|
|
569
581
|
SENSITIVE: [:body]
|
570
582
|
end
|
571
583
|
|
584
|
+
class InvokeModelWithBidirectionalStreamRequest
|
585
|
+
attr_accessor model_id: ::String
|
586
|
+
attr_accessor body: Types::InvokeModelWithBidirectionalStreamInput
|
587
|
+
SENSITIVE: []
|
588
|
+
end
|
589
|
+
|
590
|
+
class InvokeModelWithBidirectionalStreamResponse
|
591
|
+
attr_accessor body: Types::InvokeModelWithBidirectionalStreamOutput
|
592
|
+
SENSITIVE: []
|
593
|
+
end
|
594
|
+
|
572
595
|
class InvokeModelWithResponseStreamRequest
|
573
596
|
attr_accessor body: ::String
|
574
597
|
attr_accessor content_type: ::String
|
@@ -926,6 +949,14 @@ module Aws::BedrockRuntime
|
|
926
949
|
def event_types: () -> [:message_start, :content_block_start, :content_block_delta, :content_block_stop, :message_stop, :metadata, :internal_server_exception, :model_stream_error_exception, :validation_exception, :throttling_exception, :service_unavailable_exception]
|
927
950
|
end
|
928
951
|
|
952
|
+
class InvokeModelWithBidirectionalStreamInput < Enumerator[untyped, untyped]
|
953
|
+
def event_types: () -> [:chunk]
|
954
|
+
end
|
955
|
+
|
956
|
+
class InvokeModelWithBidirectionalStreamOutput < Enumerator[untyped, untyped]
|
957
|
+
def event_types: () -> [:chunk, :internal_server_exception, :model_stream_error_exception, :validation_exception, :throttling_exception, :model_timeout_exception, :service_unavailable_exception]
|
958
|
+
end
|
959
|
+
|
929
960
|
class ResponseStream < Enumerator[untyped, untyped]
|
930
961
|
def event_types: () -> [:chunk, :internal_server_exception, :model_stream_error_exception, :validation_exception, :throttling_exception, :model_timeout_exception, :service_unavailable_exception]
|
931
962
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-bedrockruntime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.44.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- LICENSE.txt
|
57
57
|
- VERSION
|
58
58
|
- lib/aws-sdk-bedrockruntime.rb
|
59
|
+
- lib/aws-sdk-bedrockruntime/async_client.rb
|
59
60
|
- lib/aws-sdk-bedrockruntime/client.rb
|
60
61
|
- lib/aws-sdk-bedrockruntime/client_api.rb
|
61
62
|
- lib/aws-sdk-bedrockruntime/customizations.rb
|