aws-sdk-bedrockruntime 1.8.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,613 @@ module Aws::BedrockRuntime
23
23
  include Aws::Structure
24
24
  end
25
25
 
26
+ # The model must request at least one tool (no text is generated).
27
+ #
28
+ # @api private
29
+ #
30
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/AnyToolChoice AWS API Documentation
31
+ #
32
+ class AnyToolChoice < Aws::EmptyStructure; end
33
+
34
+ # The Model automatically decides if a tool should be called or to
35
+ # whether to generate text instead.
36
+ #
37
+ # @api private
38
+ #
39
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/AutoToolChoice AWS API Documentation
40
+ #
41
+ class AutoToolChoice < Aws::EmptyStructure; end
42
+
43
+ # A block of content for a message.
44
+ #
45
+ # @note ContentBlock is a union - when making an API calls you must set exactly one of the members.
46
+ #
47
+ # @note ContentBlock is a union - when returned from an API call exactly one value will be set and the returned type will be a subclass of ContentBlock corresponding to the set member.
48
+ #
49
+ # @!attribute [rw] text
50
+ # Text to include in the message.
51
+ # @return [String]
52
+ #
53
+ # @!attribute [rw] image
54
+ # Image to include in the message.
55
+ #
56
+ # <note markdown="1"> This field is only supported by Anthropic Claude 3 models.
57
+ #
58
+ # </note>
59
+ # @return [Types::ImageBlock]
60
+ #
61
+ # @!attribute [rw] tool_use
62
+ # Information about a tool use request from a model.
63
+ # @return [Types::ToolUseBlock]
64
+ #
65
+ # @!attribute [rw] tool_result
66
+ # The result for a tool request that a model makes.
67
+ # @return [Types::ToolResultBlock]
68
+ #
69
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ContentBlock AWS API Documentation
70
+ #
71
+ class ContentBlock < Struct.new(
72
+ :text,
73
+ :image,
74
+ :tool_use,
75
+ :tool_result,
76
+ :unknown)
77
+ SENSITIVE = []
78
+ include Aws::Structure
79
+ include Aws::Structure::Union
80
+
81
+ class Text < ContentBlock; end
82
+ class Image < ContentBlock; end
83
+ class ToolUse < ContentBlock; end
84
+ class ToolResult < ContentBlock; end
85
+ class Unknown < ContentBlock; end
86
+ end
87
+
88
+ # A bock of content in a streaming response.
89
+ #
90
+ # @note ContentBlockDelta is a union - when returned from an API call exactly one value will be set and the returned type will be a subclass of ContentBlockDelta corresponding to the set member.
91
+ #
92
+ # @!attribute [rw] text
93
+ # The content text.
94
+ # @return [String]
95
+ #
96
+ # @!attribute [rw] tool_use
97
+ # Information about a tool that the model is requesting to use.
98
+ # @return [Types::ToolUseBlockDelta]
99
+ #
100
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ContentBlockDelta AWS API Documentation
101
+ #
102
+ class ContentBlockDelta < Struct.new(
103
+ :text,
104
+ :tool_use,
105
+ :unknown)
106
+ SENSITIVE = []
107
+ include Aws::Structure
108
+ include Aws::Structure::Union
109
+
110
+ class Text < ContentBlockDelta; end
111
+ class ToolUse < ContentBlockDelta; end
112
+ class Unknown < ContentBlockDelta; end
113
+ end
114
+
115
+ # The content block delta event.
116
+ #
117
+ # @!attribute [rw] delta
118
+ # The delta for a content block delta event.
119
+ # @return [Types::ContentBlockDelta]
120
+ #
121
+ # @!attribute [rw] content_block_index
122
+ # The block index for a content block delta event.
123
+ # @return [Integer]
124
+ #
125
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ContentBlockDeltaEvent AWS API Documentation
126
+ #
127
+ class ContentBlockDeltaEvent < Struct.new(
128
+ :delta,
129
+ :content_block_index,
130
+ :event_type)
131
+ SENSITIVE = []
132
+ include Aws::Structure
133
+ end
134
+
135
+ # Content block start information.
136
+ #
137
+ # @note ContentBlockStart is a union - when returned from an API call exactly one value will be set and the returned type will be a subclass of ContentBlockStart corresponding to the set member.
138
+ #
139
+ # @!attribute [rw] tool_use
140
+ # Information about a tool that the model is requesting to use.
141
+ # @return [Types::ToolUseBlockStart]
142
+ #
143
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ContentBlockStart AWS API Documentation
144
+ #
145
+ class ContentBlockStart < Struct.new(
146
+ :tool_use,
147
+ :unknown)
148
+ SENSITIVE = []
149
+ include Aws::Structure
150
+ include Aws::Structure::Union
151
+
152
+ class ToolUse < ContentBlockStart; end
153
+ class Unknown < ContentBlockStart; end
154
+ end
155
+
156
+ # Content block start event.
157
+ #
158
+ # @!attribute [rw] start
159
+ # Start information about a content block start event.
160
+ # @return [Types::ContentBlockStart]
161
+ #
162
+ # @!attribute [rw] content_block_index
163
+ # The index for a content block start event.
164
+ # @return [Integer]
165
+ #
166
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ContentBlockStartEvent AWS API Documentation
167
+ #
168
+ class ContentBlockStartEvent < Struct.new(
169
+ :start,
170
+ :content_block_index,
171
+ :event_type)
172
+ SENSITIVE = []
173
+ include Aws::Structure
174
+ end
175
+
176
+ # A content block stop event.
177
+ #
178
+ # @!attribute [rw] content_block_index
179
+ # The index for a content block.
180
+ # @return [Integer]
181
+ #
182
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ContentBlockStopEvent AWS API Documentation
183
+ #
184
+ class ContentBlockStopEvent < Struct.new(
185
+ :content_block_index,
186
+ :event_type)
187
+ SENSITIVE = []
188
+ include Aws::Structure
189
+ end
190
+
191
+ # Metrics for a call to [Converse][1].
192
+ #
193
+ #
194
+ #
195
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
196
+ #
197
+ # @!attribute [rw] latency_ms
198
+ # The latency of the call to `Converse`, in milliseconds.
199
+ # @return [Integer]
200
+ #
201
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ConverseMetrics AWS API Documentation
202
+ #
203
+ class ConverseMetrics < Struct.new(
204
+ :latency_ms)
205
+ SENSITIVE = []
206
+ include Aws::Structure
207
+ end
208
+
209
+ # The output from a call to [Converse][1].
210
+ #
211
+ #
212
+ #
213
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
214
+ #
215
+ # @note ConverseOutput is a union - when returned from an API call exactly one value will be set and the returned type will be a subclass of ConverseOutput corresponding to the set member.
216
+ #
217
+ # @!attribute [rw] message
218
+ # The message that the model generates.
219
+ # @return [Types::Message]
220
+ #
221
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ConverseOutput AWS API Documentation
222
+ #
223
+ class ConverseOutput < Struct.new(
224
+ :message,
225
+ :unknown)
226
+ SENSITIVE = []
227
+ include Aws::Structure
228
+ include Aws::Structure::Union
229
+
230
+ class Message < ConverseOutput; end
231
+ class Unknown < ConverseOutput; end
232
+ end
233
+
234
+ # @!attribute [rw] model_id
235
+ # The identifier for the model that you want to call.
236
+ #
237
+ # The `modelId` to provide depends on the type of model that you use:
238
+ #
239
+ # * If you use a base model, specify the model ID or its ARN. For a
240
+ # list of model IDs for base models, see [Amazon Bedrock base model
241
+ # IDs (on-demand throughput)][1] in the Amazon Bedrock User Guide.
242
+ #
243
+ # * If you use a provisioned model, specify the ARN of the Provisioned
244
+ # Throughput. For more information, see [Run inference using a
245
+ # Provisioned Throughput][2] in the Amazon Bedrock User Guide.
246
+ #
247
+ # * If you use a custom model, first purchase Provisioned Throughput
248
+ # for it. Then specify the ARN of the resulting provisioned model.
249
+ # For more information, see [Use a custom model in Amazon
250
+ # Bedrock][3] in the Amazon Bedrock User Guide.
251
+ #
252
+ #
253
+ #
254
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns
255
+ # [2]: https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html
256
+ # [3]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html
257
+ # @return [String]
258
+ #
259
+ # @!attribute [rw] messages
260
+ # The messages that you want to send to the model.
261
+ # @return [Array<Types::Message>]
262
+ #
263
+ # @!attribute [rw] system
264
+ # A system prompt to pass to the model.
265
+ # @return [Array<Types::SystemContentBlock>]
266
+ #
267
+ # @!attribute [rw] inference_config
268
+ # Inference parameters to pass to the model. `Converse` supports a
269
+ # base set of inference parameters. If you need to pass additional
270
+ # parameters that the model supports, use the
271
+ # `additionalModelRequestFields` request field.
272
+ # @return [Types::InferenceConfiguration]
273
+ #
274
+ # @!attribute [rw] tool_config
275
+ # Configuration information for the tools that the model can use when
276
+ # generating a response.
277
+ #
278
+ # <note markdown="1"> This field is only supported by Anthropic Claude 3, Cohere Command
279
+ # R, Cohere Command R+, and Mistral Large models.
280
+ #
281
+ # </note>
282
+ # @return [Types::ToolConfiguration]
283
+ #
284
+ # @!attribute [rw] additional_model_request_fields
285
+ # Additional inference parameters that the model supports, beyond the
286
+ # base set of inference parameters that `Converse` supports in the
287
+ # `inferenceConfig` field. For more information, see [Model
288
+ # parameters][1].
289
+ #
290
+ #
291
+ #
292
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
293
+ # @return [Hash,Array,String,Numeric,Boolean]
294
+ #
295
+ # @!attribute [rw] additional_model_response_field_paths
296
+ # Additional model parameters field paths to return in the response.
297
+ # `Converse` returns the requested fields as a JSON Pointer object in
298
+ # the `additionalModelResultFields` field. The following is example
299
+ # JSON for `additionalModelResponseFieldPaths`.
300
+ #
301
+ # `[ "/stop_sequence" ]`
302
+ #
303
+ # For information about the JSON Pointer syntax, see the [Internet
304
+ # Engineering Task Force (IETF)][1] documentation.
305
+ #
306
+ # `Converse` rejects an empty JSON Pointer or incorrectly structured
307
+ # JSON Pointer with a `400` error code. if the JSON Pointer is valid,
308
+ # but the requested field is not in the model response, it is ignored
309
+ # by `Converse`.
310
+ #
311
+ #
312
+ #
313
+ # [1]: https://datatracker.ietf.org/doc/html/rfc6901
314
+ # @return [Array<String>]
315
+ #
316
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ConverseRequest AWS API Documentation
317
+ #
318
+ class ConverseRequest < Struct.new(
319
+ :model_id,
320
+ :messages,
321
+ :system,
322
+ :inference_config,
323
+ :tool_config,
324
+ :additional_model_request_fields,
325
+ :additional_model_response_field_paths)
326
+ SENSITIVE = []
327
+ include Aws::Structure
328
+ end
329
+
330
+ # @!attribute [rw] output
331
+ # The result from the call to `Converse`.
332
+ # @return [Types::ConverseOutput]
333
+ #
334
+ # @!attribute [rw] stop_reason
335
+ # The reason why the model stopped generating output.
336
+ # @return [String]
337
+ #
338
+ # @!attribute [rw] usage
339
+ # The total number of tokens used in the call to `Converse`. The total
340
+ # includes the tokens input to the model and the tokens generated by
341
+ # the model.
342
+ # @return [Types::TokenUsage]
343
+ #
344
+ # @!attribute [rw] metrics
345
+ # Metrics for the call to `Converse`.
346
+ # @return [Types::ConverseMetrics]
347
+ #
348
+ # @!attribute [rw] additional_model_response_fields
349
+ # Additional fields in the response that are unique to the model.
350
+ # @return [Hash,Array,String,Numeric,Boolean]
351
+ #
352
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ConverseResponse AWS API Documentation
353
+ #
354
+ class ConverseResponse < Struct.new(
355
+ :output,
356
+ :stop_reason,
357
+ :usage,
358
+ :metrics,
359
+ :additional_model_response_fields)
360
+ SENSITIVE = []
361
+ include Aws::Structure
362
+ end
363
+
364
+ # A conversation stream metadata event.
365
+ #
366
+ # @!attribute [rw] usage
367
+ # Usage information for the conversation stream event.
368
+ # @return [Types::TokenUsage]
369
+ #
370
+ # @!attribute [rw] metrics
371
+ # The metrics for the conversation stream metadata event.
372
+ # @return [Types::ConverseStreamMetrics]
373
+ #
374
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ConverseStreamMetadataEvent AWS API Documentation
375
+ #
376
+ class ConverseStreamMetadataEvent < Struct.new(
377
+ :usage,
378
+ :metrics,
379
+ :event_type)
380
+ SENSITIVE = []
381
+ include Aws::Structure
382
+ end
383
+
384
+ # Metrics for the stream.
385
+ #
386
+ # @!attribute [rw] latency_ms
387
+ # The latency for the streaming request, in milliseconds.
388
+ # @return [Integer]
389
+ #
390
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ConverseStreamMetrics AWS API Documentation
391
+ #
392
+ class ConverseStreamMetrics < Struct.new(
393
+ :latency_ms)
394
+ SENSITIVE = []
395
+ include Aws::Structure
396
+ end
397
+
398
+ # @!attribute [rw] model_id
399
+ # The ID for the model.
400
+ #
401
+ # The `modelId` to provide depends on the type of model that you use:
402
+ #
403
+ # * If you use a base model, specify the model ID or its ARN. For a
404
+ # list of model IDs for base models, see [Amazon Bedrock base model
405
+ # IDs (on-demand throughput)][1] in the Amazon Bedrock User Guide.
406
+ #
407
+ # * If you use a provisioned model, specify the ARN of the Provisioned
408
+ # Throughput. For more information, see [Run inference using a
409
+ # Provisioned Throughput][2] in the Amazon Bedrock User Guide.
410
+ #
411
+ # * If you use a custom model, first purchase Provisioned Throughput
412
+ # for it. Then specify the ARN of the resulting provisioned model.
413
+ # For more information, see [Use a custom model in Amazon
414
+ # Bedrock][3] in the Amazon Bedrock User Guide.
415
+ #
416
+ #
417
+ #
418
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns
419
+ # [2]: https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html
420
+ # [3]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html
421
+ # @return [String]
422
+ #
423
+ # @!attribute [rw] messages
424
+ # The messages that you want to send to the model.
425
+ # @return [Array<Types::Message>]
426
+ #
427
+ # @!attribute [rw] system
428
+ # A system prompt to send to the model.
429
+ # @return [Array<Types::SystemContentBlock>]
430
+ #
431
+ # @!attribute [rw] inference_config
432
+ # Inference parameters to pass to the model. `ConverseStream` supports
433
+ # a base set of inference parameters. If you need to pass additional
434
+ # parameters that the model supports, use the
435
+ # `additionalModelRequestFields` request field.
436
+ # @return [Types::InferenceConfiguration]
437
+ #
438
+ # @!attribute [rw] tool_config
439
+ # Configuration information for the tools that the model can use when
440
+ # generating a response.
441
+ #
442
+ # <note markdown="1"> This field is only supported by Anthropic Claude 3 models.
443
+ #
444
+ # </note>
445
+ # @return [Types::ToolConfiguration]
446
+ #
447
+ # @!attribute [rw] additional_model_request_fields
448
+ # Additional inference parameters that the model supports, beyond the
449
+ # base set of inference parameters that `ConverseStream` supports in
450
+ # the `inferenceConfig` field.
451
+ # @return [Hash,Array,String,Numeric,Boolean]
452
+ #
453
+ # @!attribute [rw] additional_model_response_field_paths
454
+ # Additional model parameters field paths to return in the response.
455
+ # `ConverseStream` returns the requested fields as a JSON Pointer
456
+ # object in the `additionalModelResultFields` field. The following is
457
+ # example JSON for `additionalModelResponseFieldPaths`.
458
+ #
459
+ # `[ "/stop_sequence" ]`
460
+ #
461
+ # For information about the JSON Pointer syntax, see the [Internet
462
+ # Engineering Task Force (IETF)][1] documentation.
463
+ #
464
+ # `ConverseStream` rejects an empty JSON Pointer or incorrectly
465
+ # structured JSON Pointer with a `400` error code. if the JSON Pointer
466
+ # is valid, but the requested field is not in the model response, it
467
+ # is ignored by `ConverseStream`.
468
+ #
469
+ #
470
+ #
471
+ # [1]: https://datatracker.ietf.org/doc/html/rfc6901
472
+ # @return [Array<String>]
473
+ #
474
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ConverseStreamRequest AWS API Documentation
475
+ #
476
+ class ConverseStreamRequest < Struct.new(
477
+ :model_id,
478
+ :messages,
479
+ :system,
480
+ :inference_config,
481
+ :tool_config,
482
+ :additional_model_request_fields,
483
+ :additional_model_response_field_paths)
484
+ SENSITIVE = []
485
+ include Aws::Structure
486
+ end
487
+
488
+ # @!attribute [rw] stream
489
+ # The output stream that the model generated.
490
+ # @return [Types::ConverseStreamOutput]
491
+ #
492
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ConverseStreamResponse AWS API Documentation
493
+ #
494
+ class ConverseStreamResponse < Struct.new(
495
+ :stream)
496
+ SENSITIVE = []
497
+ include Aws::Structure
498
+ end
499
+
500
+ # Image content for a message.
501
+ #
502
+ # @!attribute [rw] format
503
+ # The format of the image.
504
+ # @return [String]
505
+ #
506
+ # @!attribute [rw] source
507
+ # The source for the image.
508
+ # @return [Types::ImageSource]
509
+ #
510
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ImageBlock AWS API Documentation
511
+ #
512
+ class ImageBlock < Struct.new(
513
+ :format,
514
+ :source)
515
+ SENSITIVE = []
516
+ include Aws::Structure
517
+ end
518
+
519
+ # The source for an image.
520
+ #
521
+ # @note ImageSource is a union - when making an API calls you must set exactly one of the members.
522
+ #
523
+ # @note ImageSource is a union - when returned from an API call exactly one value will be set and the returned type will be a subclass of ImageSource corresponding to the set member.
524
+ #
525
+ # @!attribute [rw] bytes
526
+ # The raw image bytes for the image. If you use an AWS SDK, you don't
527
+ # need to base64 encode the image bytes.
528
+ # @return [String]
529
+ #
530
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ImageSource AWS API Documentation
531
+ #
532
+ class ImageSource < Struct.new(
533
+ :bytes,
534
+ :unknown)
535
+ SENSITIVE = []
536
+ include Aws::Structure
537
+ include Aws::Structure::Union
538
+
539
+ class Bytes < ImageSource; end
540
+ class Unknown < ImageSource; end
541
+ end
542
+
543
+ # Base inference parameters to pass to a model in a call to
544
+ # [Converse][1] or [ConverseStream][2]. For more information, see
545
+ # [Inference parameters for foundation models][3].
546
+ #
547
+ # If you need to pass additional parameters that the model supports, use
548
+ # the `additionalModelRequestFields` request field in the call to
549
+ # `Converse` or `ConverseStream`. For more information, see [Model
550
+ # parameters][3].
551
+ #
552
+ #
553
+ #
554
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
555
+ # [2]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html
556
+ # [3]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
557
+ #
558
+ # @!attribute [rw] max_tokens
559
+ # The maximum number of tokens to allow in the generated response. The
560
+ # default value is the maximum allowed value for the model that you
561
+ # are using. For more information, see [Inference parameters for
562
+ # foundatio\\\{ "messages": \[ \\\{ "role": "user", "content":
563
+ # \[ \\\{ "text": "what's the weather in Queens, NY and Austin,
564
+ # TX?" \\} \] \\}, \\\{ "role": "assistant", "content": \[ \\\{
565
+ # "toolUse": \\\{ "toolUseId": "1", "name": "get\_weather",
566
+ # "input": \\\{ "city": "Queens", "state": "NY" \\} \\} \\},
567
+ # \\\{ "toolUse": \\\{ "toolUseId": "2", "name":
568
+ # "get\_weather", "input": \\\{ "city": "Austin", "state":
569
+ # "TX" \\} \\} \\} \] \\}, \\\{ "role": "user", "content": \[
570
+ # \\\{ "toolResult": \\\{ "toolUseId": "2", "content": \[ \\\{
571
+ # "json": \\\{ "weather": "40" \\} \\} \] \\} \\}, \\\{
572
+ # "text": "..." \\}, \\\{ "toolResult": \\\{ "toolUseId":
573
+ # "1", "content": \[ \\\{ "text": "result text" \\} \] \\} \\}
574
+ # \] \\} \], "toolConfig": \\\{ "tools": \[ \\\{ "name":
575
+ # "get\_weather", "description": "Get weather", "inputSchema":
576
+ # \\\{ "type": "object", "properties": \\\{ "city": \\\{
577
+ # "type": "string", "description": "City of location" \\},
578
+ # "state": \\\{ "type": "string", "description": "State of
579
+ # location" \\} \\}, "required": \["city", "state"\] \\} \\} \]
580
+ # \\} \\} n models][1].
581
+ #
582
+ #
583
+ #
584
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
585
+ # @return [Integer]
586
+ #
587
+ # @!attribute [rw] temperature
588
+ # The likelihood of the model selecting higher-probability options
589
+ # while generating a response. A lower value makes the model more
590
+ # likely to choose higher-probability options, while a higher value
591
+ # makes the model more likely to choose lower-probability options.
592
+ #
593
+ # The default value is the default value for the model that you are
594
+ # using. For more information, see [Inference parameters for
595
+ # foundation models][1].
596
+ #
597
+ #
598
+ #
599
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
600
+ # @return [Float]
601
+ #
602
+ # @!attribute [rw] top_p
603
+ # The percentage of most-likely candidates that the model considers
604
+ # for the next token. For example, if you choose a value of 0.8 for
605
+ # `topP`, the model selects from the top 80% of the probability
606
+ # distribution of tokens that could be next in the sequence.
607
+ #
608
+ # The default value is the default value for the model that you are
609
+ # using. For more information, see [Inference parameters for
610
+ # foundation models][1].
611
+ #
612
+ #
613
+ #
614
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
615
+ # @return [Float]
616
+ #
617
+ # @!attribute [rw] stop_sequences
618
+ # A list of stop sequences. A stop sequence is a sequence of
619
+ # characters that causes the model to stop generating the response.
620
+ # @return [Array<String>]
621
+ #
622
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InferenceConfiguration AWS API Documentation
623
+ #
624
+ class InferenceConfiguration < Struct.new(
625
+ :max_tokens,
626
+ :temperature,
627
+ :top_p,
628
+ :stop_sequences)
629
+ SENSITIVE = []
630
+ include Aws::Structure
631
+ end
632
+
26
633
  # An internal server error occurred. Retry your request.
27
634
  #
28
635
  # @!attribute [rw] message
@@ -258,6 +865,66 @@ module Aws::BedrockRuntime
258
865
  include Aws::Structure
259
866
  end
260
867
 
868
+ # A message in the [Message][1] field. Use to send a message in a call
869
+ # to [Converse][2].
870
+ #
871
+ #
872
+ #
873
+ # [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Message.html
874
+ # [2]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html
875
+ #
876
+ # @!attribute [rw] role
877
+ # The role that the message plays in the message.
878
+ # @return [String]
879
+ #
880
+ # @!attribute [rw] content
881
+ # The message content.
882
+ # @return [Array<Types::ContentBlock>]
883
+ #
884
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/Message AWS API Documentation
885
+ #
886
+ class Message < Struct.new(
887
+ :role,
888
+ :content)
889
+ SENSITIVE = []
890
+ include Aws::Structure
891
+ end
892
+
893
+ # The start of a message.
894
+ #
895
+ # @!attribute [rw] role
896
+ # The role for the message.
897
+ # @return [String]
898
+ #
899
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/MessageStartEvent AWS API Documentation
900
+ #
901
+ class MessageStartEvent < Struct.new(
902
+ :role,
903
+ :event_type)
904
+ SENSITIVE = []
905
+ include Aws::Structure
906
+ end
907
+
908
+ # The stop event for a message.
909
+ #
910
+ # @!attribute [rw] stop_reason
911
+ # The reason why the model stopped generating output.
912
+ # @return [String]
913
+ #
914
+ # @!attribute [rw] additional_model_response_fields
915
+ # The additional model response fields.
916
+ # @return [Hash,Array,String,Numeric,Boolean]
917
+ #
918
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/MessageStopEvent AWS API Documentation
919
+ #
920
+ class MessageStopEvent < Struct.new(
921
+ :stop_reason,
922
+ :additional_model_response_fields,
923
+ :event_type)
924
+ SENSITIVE = []
925
+ include Aws::Structure
926
+ end
927
+
261
928
  # The request failed due to an error while processing the model.
262
929
  #
263
930
  # @!attribute [rw] message
@@ -377,6 +1044,45 @@ module Aws::BedrockRuntime
377
1044
  include Aws::Structure
378
1045
  end
379
1046
 
1047
+ # The model must request a specific tool.
1048
+ #
1049
+ # <note markdown="1"> This field is only supported by Anthropic Claude 3 models.
1050
+ #
1051
+ # </note>
1052
+ #
1053
+ # @!attribute [rw] name
1054
+ # The name of the tool that the model must request.
1055
+ # @return [String]
1056
+ #
1057
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/SpecificToolChoice AWS API Documentation
1058
+ #
1059
+ class SpecificToolChoice < Struct.new(
1060
+ :name)
1061
+ SENSITIVE = []
1062
+ include Aws::Structure
1063
+ end
1064
+
1065
+ # A system content block
1066
+ #
1067
+ # @note SystemContentBlock is a union - when making an API calls you must set exactly one of the members.
1068
+ #
1069
+ # @!attribute [rw] text
1070
+ # A system prompt for the model.
1071
+ # @return [String]
1072
+ #
1073
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/SystemContentBlock AWS API Documentation
1074
+ #
1075
+ class SystemContentBlock < Struct.new(
1076
+ :text,
1077
+ :unknown)
1078
+ SENSITIVE = []
1079
+ include Aws::Structure
1080
+ include Aws::Structure::Union
1081
+
1082
+ class Text < SystemContentBlock; end
1083
+ class Unknown < SystemContentBlock; end
1084
+ end
1085
+
380
1086
  # The number of requests exceeds the limit. Resubmit your request later.
381
1087
  #
382
1088
  # @!attribute [rw] message
@@ -391,6 +1097,286 @@ module Aws::BedrockRuntime
391
1097
  include Aws::Structure
392
1098
  end
393
1099
 
1100
+ # The tokens used in a message API inference call.
1101
+ #
1102
+ # @!attribute [rw] input_tokens
1103
+ # The number of tokens sent in the request to the model.
1104
+ # @return [Integer]
1105
+ #
1106
+ # @!attribute [rw] output_tokens
1107
+ # The number of tokens that the model generated for the request.
1108
+ # @return [Integer]
1109
+ #
1110
+ # @!attribute [rw] total_tokens
1111
+ # The total of input tokens and tokens generated by the model.
1112
+ # @return [Integer]
1113
+ #
1114
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/TokenUsage AWS API Documentation
1115
+ #
1116
+ class TokenUsage < Struct.new(
1117
+ :input_tokens,
1118
+ :output_tokens,
1119
+ :total_tokens)
1120
+ SENSITIVE = []
1121
+ include Aws::Structure
1122
+ end
1123
+
1124
+ # Information about a tool that you can use with the Converse API.
1125
+ #
1126
+ # @note Tool is a union - when making an API calls you must set exactly one of the members.
1127
+ #
1128
+ # @!attribute [rw] tool_spec
1129
+ # The specfication for the tool.
1130
+ # @return [Types::ToolSpecification]
1131
+ #
1132
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/Tool AWS API Documentation
1133
+ #
1134
+ class Tool < Struct.new(
1135
+ :tool_spec,
1136
+ :unknown)
1137
+ SENSITIVE = []
1138
+ include Aws::Structure
1139
+ include Aws::Structure::Union
1140
+
1141
+ class ToolSpec < Tool; end
1142
+ class Unknown < Tool; end
1143
+ end
1144
+
1145
+ # Forces a model to use a tool.
1146
+ #
1147
+ # @note ToolChoice is a union - when making an API calls you must set exactly one of the members.
1148
+ #
1149
+ # @!attribute [rw] auto
1150
+ # The Model automatically decides if a tool should be called or to
1151
+ # whether to generate text instead.
1152
+ # @return [Types::AutoToolChoice]
1153
+ #
1154
+ # @!attribute [rw] any
1155
+ # The model must request at least one tool (no text is generated).
1156
+ # @return [Types::AnyToolChoice]
1157
+ #
1158
+ # @!attribute [rw] tool
1159
+ # The Model must request the specified tool.
1160
+ # @return [Types::SpecificToolChoice]
1161
+ #
1162
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ToolChoice AWS API Documentation
1163
+ #
1164
+ class ToolChoice < Struct.new(
1165
+ :auto,
1166
+ :any,
1167
+ :tool,
1168
+ :unknown)
1169
+ SENSITIVE = []
1170
+ include Aws::Structure
1171
+ include Aws::Structure::Union
1172
+
1173
+ class Auto < ToolChoice; end
1174
+ class Any < ToolChoice; end
1175
+ class Tool < ToolChoice; end
1176
+ class Unknown < ToolChoice; end
1177
+ end
1178
+
1179
+ # Configuration information for the tools that you pass to a model.
1180
+ #
1181
+ # <note markdown="1"> This field is only supported by Anthropic Claude 3, Cohere Command R,
1182
+ # Cohere Command R+, and Mistral Large models.
1183
+ #
1184
+ # </note>
1185
+ #
1186
+ # @!attribute [rw] tools
1187
+ # An array of tools that you want to pass to a model.
1188
+ # @return [Array<Types::Tool>]
1189
+ #
1190
+ # @!attribute [rw] tool_choice
1191
+ # If supported by model, forces the model to request a tool.
1192
+ # @return [Types::ToolChoice]
1193
+ #
1194
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ToolConfiguration AWS API Documentation
1195
+ #
1196
+ class ToolConfiguration < Struct.new(
1197
+ :tools,
1198
+ :tool_choice)
1199
+ SENSITIVE = []
1200
+ include Aws::Structure
1201
+ end
1202
+
1203
+ # The schema for the tool. The top level schema type must be `object`.
1204
+ #
1205
+ # @note ToolInputSchema is a union - when making an API calls you must set exactly one of the members.
1206
+ #
1207
+ # @!attribute [rw] json
1208
+ # The JSON schema for the tool. For more information, see [JSON Schema
1209
+ # Reference][1].
1210
+ #
1211
+ #
1212
+ #
1213
+ # [1]: https://json-schema.org/understanding-json-schema/reference
1214
+ # @return [Hash,Array,String,Numeric,Boolean]
1215
+ #
1216
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ToolInputSchema AWS API Documentation
1217
+ #
1218
+ class ToolInputSchema < Struct.new(
1219
+ :json,
1220
+ :unknown)
1221
+ SENSITIVE = []
1222
+ include Aws::Structure
1223
+ include Aws::Structure::Union
1224
+
1225
+ class Json < ToolInputSchema; end
1226
+ class Unknown < ToolInputSchema; end
1227
+ end
1228
+
1229
+ # A tool result block that contains the results for a tool request that
1230
+ # the model previously made.
1231
+ #
1232
+ # @!attribute [rw] tool_use_id
1233
+ # The ID of the tool request that this is the result for.
1234
+ # @return [String]
1235
+ #
1236
+ # @!attribute [rw] content
1237
+ # The content for tool result content block.
1238
+ # @return [Array<Types::ToolResultContentBlock>]
1239
+ #
1240
+ # @!attribute [rw] status
1241
+ # The status for the tool result content block.
1242
+ #
1243
+ # <note markdown="1"> This field is only supported Anthropic Claude 3 models.
1244
+ #
1245
+ # </note>
1246
+ # @return [String]
1247
+ #
1248
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ToolResultBlock AWS API Documentation
1249
+ #
1250
+ class ToolResultBlock < Struct.new(
1251
+ :tool_use_id,
1252
+ :content,
1253
+ :status)
1254
+ SENSITIVE = []
1255
+ include Aws::Structure
1256
+ end
1257
+
1258
+ # The tool result content block.
1259
+ #
1260
+ # @note ToolResultContentBlock is a union - when making an API calls you must set exactly one of the members.
1261
+ #
1262
+ # @note ToolResultContentBlock is a union - when returned from an API call exactly one value will be set and the returned type will be a subclass of ToolResultContentBlock corresponding to the set member.
1263
+ #
1264
+ # @!attribute [rw] json
1265
+ # A tool result that is JSON format data.
1266
+ # @return [Hash,Array,String,Numeric,Boolean]
1267
+ #
1268
+ # @!attribute [rw] text
1269
+ # A tool result that is text.
1270
+ # @return [String]
1271
+ #
1272
+ # @!attribute [rw] image
1273
+ # A tool result that is an image.
1274
+ #
1275
+ # <note markdown="1"> This field is only supported by Anthropic Claude 3 models.
1276
+ #
1277
+ # </note>
1278
+ # @return [Types::ImageBlock]
1279
+ #
1280
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ToolResultContentBlock AWS API Documentation
1281
+ #
1282
+ class ToolResultContentBlock < Struct.new(
1283
+ :json,
1284
+ :text,
1285
+ :image,
1286
+ :unknown)
1287
+ SENSITIVE = []
1288
+ include Aws::Structure
1289
+ include Aws::Structure::Union
1290
+
1291
+ class Json < ToolResultContentBlock; end
1292
+ class Text < ToolResultContentBlock; end
1293
+ class Image < ToolResultContentBlock; end
1294
+ class Unknown < ToolResultContentBlock; end
1295
+ end
1296
+
1297
+ # The specification for the tool.
1298
+ #
1299
+ # @!attribute [rw] name
1300
+ # The name for the tool.
1301
+ # @return [String]
1302
+ #
1303
+ # @!attribute [rw] description
1304
+ # The description for the tool.
1305
+ # @return [String]
1306
+ #
1307
+ # @!attribute [rw] input_schema
1308
+ # The input schema for the tool in JSON format.
1309
+ # @return [Types::ToolInputSchema]
1310
+ #
1311
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ToolSpecification AWS API Documentation
1312
+ #
1313
+ class ToolSpecification < Struct.new(
1314
+ :name,
1315
+ :description,
1316
+ :input_schema)
1317
+ SENSITIVE = []
1318
+ include Aws::Structure
1319
+ end
1320
+
1321
+ # A tool use content block. Contains information about a tool that the
1322
+ # model is requesting be run., The model uses the result from the tool
1323
+ # to generate a response.
1324
+ #
1325
+ # @!attribute [rw] tool_use_id
1326
+ # The ID for the tool request.
1327
+ # @return [String]
1328
+ #
1329
+ # @!attribute [rw] name
1330
+ # The name of the tool that the model wants to use.
1331
+ # @return [String]
1332
+ #
1333
+ # @!attribute [rw] input
1334
+ # The input to pass to the tool.
1335
+ # @return [Hash,Array,String,Numeric,Boolean]
1336
+ #
1337
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ToolUseBlock AWS API Documentation
1338
+ #
1339
+ class ToolUseBlock < Struct.new(
1340
+ :tool_use_id,
1341
+ :name,
1342
+ :input)
1343
+ SENSITIVE = []
1344
+ include Aws::Structure
1345
+ end
1346
+
1347
+ # The delta for a tool use block.
1348
+ #
1349
+ # @!attribute [rw] input
1350
+ # The input for a requested tool.
1351
+ # @return [String]
1352
+ #
1353
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ToolUseBlockDelta AWS API Documentation
1354
+ #
1355
+ class ToolUseBlockDelta < Struct.new(
1356
+ :input)
1357
+ SENSITIVE = []
1358
+ include Aws::Structure
1359
+ end
1360
+
1361
+ # The start of a tool use block.
1362
+ #
1363
+ # @!attribute [rw] tool_use_id
1364
+ # The ID for the tool request.
1365
+ # @return [String]
1366
+ #
1367
+ # @!attribute [rw] name
1368
+ # The name of the tool that the model is requesting to use.
1369
+ # @return [String]
1370
+ #
1371
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ToolUseBlockStart AWS API Documentation
1372
+ #
1373
+ class ToolUseBlockStart < Struct.new(
1374
+ :tool_use_id,
1375
+ :name)
1376
+ SENSITIVE = []
1377
+ include Aws::Structure
1378
+ end
1379
+
394
1380
  # Input validation failed. Check your request parameters and retry the
395
1381
  # request.
396
1382
  #
@@ -406,6 +1392,32 @@ module Aws::BedrockRuntime
406
1392
  include Aws::Structure
407
1393
  end
408
1394
 
1395
+ # The messages output stream
1396
+ #
1397
+ # EventStream is an Enumerator of Events.
1398
+ # #event_types #=> Array, returns all modeled event types in the stream
1399
+ #
1400
+ # @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/ConverseStreamOutput AWS API Documentation
1401
+ #
1402
+ class ConverseStreamOutput < Enumerator
1403
+
1404
+ def event_types
1405
+ [
1406
+ :message_start,
1407
+ :content_block_start,
1408
+ :content_block_delta,
1409
+ :content_block_stop,
1410
+ :message_stop,
1411
+ :metadata,
1412
+ :internal_server_exception,
1413
+ :model_stream_error_exception,
1414
+ :validation_exception,
1415
+ :throttling_exception
1416
+ ]
1417
+ end
1418
+
1419
+ end
1420
+
409
1421
  # Definition of content in the response stream.
410
1422
  #
411
1423
  # EventStream is an Enumerator of Events.