aws-sdk-bedrockruntime 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-bedrockruntime/client.rb +634 -1
- data/lib/aws-sdk-bedrockruntime/client_api.rb +311 -0
- data/lib/aws-sdk-bedrockruntime/endpoints.rb +28 -0
- data/lib/aws-sdk-bedrockruntime/event_streams.rb +79 -0
- data/lib/aws-sdk-bedrockruntime/plugins/endpoints.rb +4 -0
- data/lib/aws-sdk-bedrockruntime/types.rb +1012 -0
- data/lib/aws-sdk-bedrockruntime.rb +2 -2
- data/sig/client.rbs +176 -0
- data/sig/types.rbs +300 -0
- metadata +2 -2
@@ -34,7 +34,7 @@ require_relative 'aws-sdk-bedrockruntime/event_streams'
|
|
34
34
|
# structure.
|
35
35
|
#
|
36
36
|
# bedrock_runtime = Aws::BedrockRuntime::Client.new
|
37
|
-
# resp = bedrock_runtime.
|
37
|
+
# resp = bedrock_runtime.converse(params)
|
38
38
|
#
|
39
39
|
# See {Client} for more information.
|
40
40
|
#
|
@@ -54,6 +54,6 @@ require_relative 'aws-sdk-bedrockruntime/event_streams'
|
|
54
54
|
# @!group service
|
55
55
|
module Aws::BedrockRuntime
|
56
56
|
|
57
|
-
GEM_VERSION = '1.
|
57
|
+
GEM_VERSION = '1.9.0'
|
58
58
|
|
59
59
|
end
|
data/sig/client.rbs
CHANGED
@@ -75,6 +75,182 @@ module Aws
|
|
75
75
|
| (?Hash[Symbol, untyped]) -> instance
|
76
76
|
|
77
77
|
|
78
|
+
interface _ConverseResponseSuccess
|
79
|
+
include ::Seahorse::Client::_ResponseSuccess[Types::ConverseResponse]
|
80
|
+
def output: () -> Types::ConverseOutput
|
81
|
+
def stop_reason: () -> ("end_turn" | "tool_use" | "max_tokens" | "stop_sequence" | "content_filtered")
|
82
|
+
def usage: () -> Types::TokenUsage
|
83
|
+
def metrics: () -> Types::ConverseMetrics
|
84
|
+
def additional_model_response_fields: () -> untyped
|
85
|
+
end
|
86
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/BedrockRuntime/Client.html#converse-instance_method
|
87
|
+
def converse: (
|
88
|
+
model_id: ::String,
|
89
|
+
messages: Array[
|
90
|
+
{
|
91
|
+
role: ("user" | "assistant"),
|
92
|
+
content: Array[
|
93
|
+
{
|
94
|
+
text: ::String?,
|
95
|
+
image: {
|
96
|
+
format: ("png" | "jpeg" | "gif" | "webp"),
|
97
|
+
source: {
|
98
|
+
bytes: ::String?
|
99
|
+
}
|
100
|
+
}?,
|
101
|
+
tool_use: {
|
102
|
+
tool_use_id: ::String,
|
103
|
+
name: ::String,
|
104
|
+
input: {
|
105
|
+
}
|
106
|
+
}?,
|
107
|
+
tool_result: {
|
108
|
+
tool_use_id: ::String,
|
109
|
+
content: Array[
|
110
|
+
{
|
111
|
+
json: {
|
112
|
+
}?,
|
113
|
+
text: ::String?,
|
114
|
+
image: {
|
115
|
+
format: ("png" | "jpeg" | "gif" | "webp"),
|
116
|
+
source: {
|
117
|
+
bytes: ::String?
|
118
|
+
}
|
119
|
+
}?
|
120
|
+
},
|
121
|
+
],
|
122
|
+
status: ("success" | "error")?
|
123
|
+
}?
|
124
|
+
},
|
125
|
+
]
|
126
|
+
},
|
127
|
+
],
|
128
|
+
?system: Array[
|
129
|
+
{
|
130
|
+
text: ::String?
|
131
|
+
},
|
132
|
+
],
|
133
|
+
?inference_config: {
|
134
|
+
max_tokens: ::Integer?,
|
135
|
+
temperature: ::Float?,
|
136
|
+
top_p: ::Float?,
|
137
|
+
stop_sequences: Array[::String]?
|
138
|
+
},
|
139
|
+
?tool_config: {
|
140
|
+
tools: Array[
|
141
|
+
{
|
142
|
+
tool_spec: {
|
143
|
+
name: ::String,
|
144
|
+
description: ::String?,
|
145
|
+
input_schema: {
|
146
|
+
json: {
|
147
|
+
}?
|
148
|
+
}
|
149
|
+
}?
|
150
|
+
},
|
151
|
+
],
|
152
|
+
tool_choice: {
|
153
|
+
auto: {
|
154
|
+
}?,
|
155
|
+
any: {
|
156
|
+
}?,
|
157
|
+
tool: {
|
158
|
+
name: ::String
|
159
|
+
}?
|
160
|
+
}?
|
161
|
+
},
|
162
|
+
?additional_model_request_fields: {
|
163
|
+
},
|
164
|
+
?additional_model_response_field_paths: Array[::String]
|
165
|
+
) -> _ConverseResponseSuccess
|
166
|
+
| (Hash[Symbol, untyped] params, ?Hash[Symbol, untyped] options) -> _ConverseResponseSuccess
|
167
|
+
|
168
|
+
interface _ConverseStreamResponseSuccess
|
169
|
+
include ::Seahorse::Client::_ResponseSuccess[Types::ConverseStreamResponse]
|
170
|
+
def stream: () -> Types::ConverseStreamOutput
|
171
|
+
end
|
172
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/BedrockRuntime/Client.html#converse_stream-instance_method
|
173
|
+
def converse_stream: (
|
174
|
+
model_id: ::String,
|
175
|
+
messages: Array[
|
176
|
+
{
|
177
|
+
role: ("user" | "assistant"),
|
178
|
+
content: Array[
|
179
|
+
{
|
180
|
+
text: ::String?,
|
181
|
+
image: {
|
182
|
+
format: ("png" | "jpeg" | "gif" | "webp"),
|
183
|
+
source: {
|
184
|
+
bytes: ::String?
|
185
|
+
}
|
186
|
+
}?,
|
187
|
+
tool_use: {
|
188
|
+
tool_use_id: ::String,
|
189
|
+
name: ::String,
|
190
|
+
input: {
|
191
|
+
}
|
192
|
+
}?,
|
193
|
+
tool_result: {
|
194
|
+
tool_use_id: ::String,
|
195
|
+
content: Array[
|
196
|
+
{
|
197
|
+
json: {
|
198
|
+
}?,
|
199
|
+
text: ::String?,
|
200
|
+
image: {
|
201
|
+
format: ("png" | "jpeg" | "gif" | "webp"),
|
202
|
+
source: {
|
203
|
+
bytes: ::String?
|
204
|
+
}
|
205
|
+
}?
|
206
|
+
},
|
207
|
+
],
|
208
|
+
status: ("success" | "error")?
|
209
|
+
}?
|
210
|
+
},
|
211
|
+
]
|
212
|
+
},
|
213
|
+
],
|
214
|
+
?system: Array[
|
215
|
+
{
|
216
|
+
text: ::String?
|
217
|
+
},
|
218
|
+
],
|
219
|
+
?inference_config: {
|
220
|
+
max_tokens: ::Integer?,
|
221
|
+
temperature: ::Float?,
|
222
|
+
top_p: ::Float?,
|
223
|
+
stop_sequences: Array[::String]?
|
224
|
+
},
|
225
|
+
?tool_config: {
|
226
|
+
tools: Array[
|
227
|
+
{
|
228
|
+
tool_spec: {
|
229
|
+
name: ::String,
|
230
|
+
description: ::String?,
|
231
|
+
input_schema: {
|
232
|
+
json: {
|
233
|
+
}?
|
234
|
+
}
|
235
|
+
}?
|
236
|
+
},
|
237
|
+
],
|
238
|
+
tool_choice: {
|
239
|
+
auto: {
|
240
|
+
}?,
|
241
|
+
any: {
|
242
|
+
}?,
|
243
|
+
tool: {
|
244
|
+
name: ::String
|
245
|
+
}?
|
246
|
+
}?
|
247
|
+
},
|
248
|
+
?additional_model_request_fields: {
|
249
|
+
},
|
250
|
+
?additional_model_response_field_paths: Array[::String]
|
251
|
+
) ?{ (*untyped) -> void } -> _ConverseStreamResponseSuccess
|
252
|
+
| (Hash[Symbol, untyped] params, ?Hash[Symbol, untyped] options) ?{ (*untyped) -> void } -> _ConverseStreamResponseSuccess
|
253
|
+
|
78
254
|
interface _InvokeModelResponseSuccess
|
79
255
|
include ::Seahorse::Client::_ResponseSuccess[Types::InvokeModelResponse]
|
80
256
|
def body: () -> ::String
|
data/sig/types.rbs
CHANGED
@@ -13,6 +13,166 @@ module Aws::BedrockRuntime
|
|
13
13
|
SENSITIVE: []
|
14
14
|
end
|
15
15
|
|
16
|
+
class AnyToolChoice < Aws::EmptyStructure
|
17
|
+
end
|
18
|
+
|
19
|
+
class AutoToolChoice < Aws::EmptyStructure
|
20
|
+
end
|
21
|
+
|
22
|
+
class ContentBlock
|
23
|
+
attr_accessor text: ::String
|
24
|
+
attr_accessor image: Types::ImageBlock
|
25
|
+
attr_accessor tool_use: Types::ToolUseBlock
|
26
|
+
attr_accessor tool_result: Types::ToolResultBlock
|
27
|
+
attr_accessor unknown: untyped
|
28
|
+
SENSITIVE: []
|
29
|
+
|
30
|
+
class Text < ContentBlock
|
31
|
+
end
|
32
|
+
class Image < ContentBlock
|
33
|
+
end
|
34
|
+
class ToolUse < ContentBlock
|
35
|
+
end
|
36
|
+
class ToolResult < ContentBlock
|
37
|
+
end
|
38
|
+
class Unknown < ContentBlock
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class ContentBlockDelta
|
43
|
+
attr_accessor text: ::String
|
44
|
+
attr_accessor tool_use: Types::ToolUseBlockDelta
|
45
|
+
attr_accessor unknown: untyped
|
46
|
+
SENSITIVE: []
|
47
|
+
|
48
|
+
class Text < ContentBlockDelta
|
49
|
+
end
|
50
|
+
class ToolUse < ContentBlockDelta
|
51
|
+
end
|
52
|
+
class Unknown < ContentBlockDelta
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class ContentBlockDeltaEvent
|
57
|
+
attr_accessor delta: Types::ContentBlockDelta
|
58
|
+
attr_accessor content_block_index: ::Integer
|
59
|
+
attr_accessor event_type: untyped
|
60
|
+
SENSITIVE: []
|
61
|
+
end
|
62
|
+
|
63
|
+
class ContentBlockStart
|
64
|
+
attr_accessor tool_use: Types::ToolUseBlockStart
|
65
|
+
attr_accessor unknown: untyped
|
66
|
+
SENSITIVE: []
|
67
|
+
|
68
|
+
class ToolUse < ContentBlockStart
|
69
|
+
end
|
70
|
+
class Unknown < ContentBlockStart
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
class ContentBlockStartEvent
|
75
|
+
attr_accessor start: Types::ContentBlockStart
|
76
|
+
attr_accessor content_block_index: ::Integer
|
77
|
+
attr_accessor event_type: untyped
|
78
|
+
SENSITIVE: []
|
79
|
+
end
|
80
|
+
|
81
|
+
class ContentBlockStopEvent
|
82
|
+
attr_accessor content_block_index: ::Integer
|
83
|
+
attr_accessor event_type: untyped
|
84
|
+
SENSITIVE: []
|
85
|
+
end
|
86
|
+
|
87
|
+
class ConverseMetrics
|
88
|
+
attr_accessor latency_ms: ::Integer
|
89
|
+
SENSITIVE: []
|
90
|
+
end
|
91
|
+
|
92
|
+
class ConverseOutput
|
93
|
+
attr_accessor message: Types::Message
|
94
|
+
attr_accessor unknown: untyped
|
95
|
+
SENSITIVE: []
|
96
|
+
|
97
|
+
class Message < ConverseOutput
|
98
|
+
end
|
99
|
+
class Unknown < ConverseOutput
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class ConverseRequest
|
104
|
+
attr_accessor model_id: ::String
|
105
|
+
attr_accessor messages: ::Array[Types::Message]
|
106
|
+
attr_accessor system: ::Array[Types::SystemContentBlock]
|
107
|
+
attr_accessor inference_config: Types::InferenceConfiguration
|
108
|
+
attr_accessor tool_config: Types::ToolConfiguration
|
109
|
+
attr_accessor additional_model_request_fields: untyped
|
110
|
+
attr_accessor additional_model_response_field_paths: ::Array[::String]
|
111
|
+
SENSITIVE: []
|
112
|
+
end
|
113
|
+
|
114
|
+
class ConverseResponse
|
115
|
+
attr_accessor output: Types::ConverseOutput
|
116
|
+
attr_accessor stop_reason: ("end_turn" | "tool_use" | "max_tokens" | "stop_sequence" | "content_filtered")
|
117
|
+
attr_accessor usage: Types::TokenUsage
|
118
|
+
attr_accessor metrics: Types::ConverseMetrics
|
119
|
+
attr_accessor additional_model_response_fields: untyped
|
120
|
+
SENSITIVE: []
|
121
|
+
end
|
122
|
+
|
123
|
+
class ConverseStreamMetadataEvent
|
124
|
+
attr_accessor usage: Types::TokenUsage
|
125
|
+
attr_accessor metrics: Types::ConverseStreamMetrics
|
126
|
+
attr_accessor event_type: untyped
|
127
|
+
SENSITIVE: []
|
128
|
+
end
|
129
|
+
|
130
|
+
class ConverseStreamMetrics
|
131
|
+
attr_accessor latency_ms: ::Integer
|
132
|
+
SENSITIVE: []
|
133
|
+
end
|
134
|
+
|
135
|
+
class ConverseStreamRequest
|
136
|
+
attr_accessor model_id: ::String
|
137
|
+
attr_accessor messages: ::Array[Types::Message]
|
138
|
+
attr_accessor system: ::Array[Types::SystemContentBlock]
|
139
|
+
attr_accessor inference_config: Types::InferenceConfiguration
|
140
|
+
attr_accessor tool_config: Types::ToolConfiguration
|
141
|
+
attr_accessor additional_model_request_fields: untyped
|
142
|
+
attr_accessor additional_model_response_field_paths: ::Array[::String]
|
143
|
+
SENSITIVE: []
|
144
|
+
end
|
145
|
+
|
146
|
+
class ConverseStreamResponse
|
147
|
+
attr_accessor stream: Types::ConverseStreamOutput
|
148
|
+
SENSITIVE: []
|
149
|
+
end
|
150
|
+
|
151
|
+
class ImageBlock
|
152
|
+
attr_accessor format: ("png" | "jpeg" | "gif" | "webp")
|
153
|
+
attr_accessor source: Types::ImageSource
|
154
|
+
SENSITIVE: []
|
155
|
+
end
|
156
|
+
|
157
|
+
class ImageSource
|
158
|
+
attr_accessor bytes: ::String
|
159
|
+
attr_accessor unknown: untyped
|
160
|
+
SENSITIVE: []
|
161
|
+
|
162
|
+
class Bytes < ImageSource
|
163
|
+
end
|
164
|
+
class Unknown < ImageSource
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
class InferenceConfiguration
|
169
|
+
attr_accessor max_tokens: ::Integer
|
170
|
+
attr_accessor temperature: ::Float
|
171
|
+
attr_accessor top_p: ::Float
|
172
|
+
attr_accessor stop_sequences: ::Array[::String]
|
173
|
+
SENSITIVE: []
|
174
|
+
end
|
175
|
+
|
16
176
|
class InternalServerException
|
17
177
|
attr_accessor message: ::String
|
18
178
|
attr_accessor event_type: untyped
|
@@ -53,6 +213,25 @@ module Aws::BedrockRuntime
|
|
53
213
|
SENSITIVE: []
|
54
214
|
end
|
55
215
|
|
216
|
+
class Message
|
217
|
+
attr_accessor role: ("user" | "assistant")
|
218
|
+
attr_accessor content: ::Array[Types::ContentBlock]
|
219
|
+
SENSITIVE: []
|
220
|
+
end
|
221
|
+
|
222
|
+
class MessageStartEvent
|
223
|
+
attr_accessor role: ("user" | "assistant")
|
224
|
+
attr_accessor event_type: untyped
|
225
|
+
SENSITIVE: []
|
226
|
+
end
|
227
|
+
|
228
|
+
class MessageStopEvent
|
229
|
+
attr_accessor stop_reason: ("end_turn" | "tool_use" | "max_tokens" | "stop_sequence" | "content_filtered")
|
230
|
+
attr_accessor additional_model_response_fields: untyped
|
231
|
+
attr_accessor event_type: untyped
|
232
|
+
SENSITIVE: []
|
233
|
+
end
|
234
|
+
|
56
235
|
class ModelErrorException
|
57
236
|
attr_accessor message: ::String
|
58
237
|
attr_accessor original_status_code: ::Integer
|
@@ -95,18 +274,139 @@ module Aws::BedrockRuntime
|
|
95
274
|
SENSITIVE: []
|
96
275
|
end
|
97
276
|
|
277
|
+
class SpecificToolChoice
|
278
|
+
attr_accessor name: ::String
|
279
|
+
SENSITIVE: []
|
280
|
+
end
|
281
|
+
|
282
|
+
class SystemContentBlock
|
283
|
+
attr_accessor text: ::String
|
284
|
+
attr_accessor unknown: untyped
|
285
|
+
SENSITIVE: []
|
286
|
+
|
287
|
+
class Text < SystemContentBlock
|
288
|
+
end
|
289
|
+
class Unknown < SystemContentBlock
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
98
293
|
class ThrottlingException
|
99
294
|
attr_accessor message: ::String
|
100
295
|
attr_accessor event_type: untyped
|
101
296
|
SENSITIVE: []
|
102
297
|
end
|
103
298
|
|
299
|
+
class TokenUsage
|
300
|
+
attr_accessor input_tokens: ::Integer
|
301
|
+
attr_accessor output_tokens: ::Integer
|
302
|
+
attr_accessor total_tokens: ::Integer
|
303
|
+
SENSITIVE: []
|
304
|
+
end
|
305
|
+
|
306
|
+
class Tool
|
307
|
+
attr_accessor tool_spec: Types::ToolSpecification
|
308
|
+
attr_accessor unknown: untyped
|
309
|
+
SENSITIVE: []
|
310
|
+
|
311
|
+
class ToolSpec < Tool
|
312
|
+
end
|
313
|
+
class Unknown < Tool
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
class ToolChoice
|
318
|
+
attr_accessor auto: Types::AutoToolChoice
|
319
|
+
attr_accessor any: Types::AnyToolChoice
|
320
|
+
attr_accessor tool: Types::SpecificToolChoice
|
321
|
+
attr_accessor unknown: untyped
|
322
|
+
SENSITIVE: []
|
323
|
+
|
324
|
+
class Auto < ToolChoice
|
325
|
+
end
|
326
|
+
class Any < ToolChoice
|
327
|
+
end
|
328
|
+
class Tool < ToolChoice
|
329
|
+
end
|
330
|
+
class Unknown < ToolChoice
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
class ToolConfiguration
|
335
|
+
attr_accessor tools: ::Array[Types::Tool]
|
336
|
+
attr_accessor tool_choice: Types::ToolChoice
|
337
|
+
SENSITIVE: []
|
338
|
+
end
|
339
|
+
|
340
|
+
class ToolInputSchema
|
341
|
+
attr_accessor json: untyped
|
342
|
+
attr_accessor unknown: untyped
|
343
|
+
SENSITIVE: []
|
344
|
+
|
345
|
+
class Json < ToolInputSchema
|
346
|
+
end
|
347
|
+
class Unknown < ToolInputSchema
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
class ToolResultBlock
|
352
|
+
attr_accessor tool_use_id: ::String
|
353
|
+
attr_accessor content: ::Array[Types::ToolResultContentBlock]
|
354
|
+
attr_accessor status: ("success" | "error")
|
355
|
+
SENSITIVE: []
|
356
|
+
end
|
357
|
+
|
358
|
+
class ToolResultContentBlock
|
359
|
+
attr_accessor json: untyped
|
360
|
+
attr_accessor text: ::String
|
361
|
+
attr_accessor image: Types::ImageBlock
|
362
|
+
attr_accessor unknown: untyped
|
363
|
+
SENSITIVE: []
|
364
|
+
|
365
|
+
class Json < ToolResultContentBlock
|
366
|
+
end
|
367
|
+
class Text < ToolResultContentBlock
|
368
|
+
end
|
369
|
+
class Image < ToolResultContentBlock
|
370
|
+
end
|
371
|
+
class Unknown < ToolResultContentBlock
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
class ToolSpecification
|
376
|
+
attr_accessor name: ::String
|
377
|
+
attr_accessor description: ::String
|
378
|
+
attr_accessor input_schema: Types::ToolInputSchema
|
379
|
+
SENSITIVE: []
|
380
|
+
end
|
381
|
+
|
382
|
+
class ToolUseBlock
|
383
|
+
attr_accessor tool_use_id: ::String
|
384
|
+
attr_accessor name: ::String
|
385
|
+
attr_accessor input: untyped
|
386
|
+
SENSITIVE: []
|
387
|
+
end
|
388
|
+
|
389
|
+
class ToolUseBlockDelta
|
390
|
+
attr_accessor input: ::String
|
391
|
+
SENSITIVE: []
|
392
|
+
end
|
393
|
+
|
394
|
+
class ToolUseBlockStart
|
395
|
+
attr_accessor tool_use_id: ::String
|
396
|
+
attr_accessor name: ::String
|
397
|
+
SENSITIVE: []
|
398
|
+
end
|
399
|
+
|
104
400
|
class ValidationException
|
105
401
|
attr_accessor message: ::String
|
106
402
|
attr_accessor event_type: untyped
|
107
403
|
SENSITIVE: []
|
108
404
|
end
|
109
405
|
|
406
|
+
class ConverseStreamOutput < Enumerator[untyped, untyped]
|
407
|
+
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]
|
408
|
+
end
|
409
|
+
|
110
410
|
class ResponseStream < Enumerator[untyped, untyped]
|
111
411
|
def event_types: () -> [:chunk, :internal_server_exception, :model_stream_error_exception, :validation_exception, :throttling_exception, :model_timeout_exception]
|
112
412
|
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.9.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: 2024-05-
|
11
|
+
date: 2024-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|