aws-sdk-bedrockruntime 1.5.0 → 1.7.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 +10 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-bedrockruntime/client.rb +213 -87
- data/lib/aws-sdk-bedrockruntime/client_api.rb +9 -0
- data/lib/aws-sdk-bedrockruntime/types.rb +121 -16
- data/lib/aws-sdk-bedrockruntime.rb +1 -1
- data/sig/client.rbs +8 -2
- data/sig/types.rbs +6 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ad746f1ac5f474288cfc73bc784c88fa83be0401b44cb551e1a9ebe86ed36bc
|
4
|
+
data.tar.gz: b3d3ba3ad85bf09f70af9e9f4f1de55817f6e278dcbba53e09cfb1194d86418f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a72bef496d6c9bf1ebbc69b516834d57b2b174d837a84cc2d277c001844a4c271226514bfe92894f8da9bef99c4650487dd0bac13f02b4f934ab3a0c6f779b5
|
7
|
+
data.tar.gz: b31a8c29f95a9d21b6a2f79bead4bd27ed3853fe52a3694aa8271cd8260ba640b0eb6d08c6a2e8c69312b2fae6438beca46bc3138b19de7407858c2cd25d9640
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
Unreleased Changes
|
2
2
|
------------------
|
3
3
|
|
4
|
+
1.7.0 (2024-04-25)
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* Feature - Code Generated Changes, see `./build_tools` or `aws-sdk-core`'s CHANGELOG.md for details.
|
8
|
+
|
9
|
+
1.6.0 (2024-04-23)
|
10
|
+
------------------
|
11
|
+
|
12
|
+
* Feature - This release introduces Guardrails for Amazon Bedrock.
|
13
|
+
|
4
14
|
1.5.0 (2024-01-26)
|
5
15
|
------------------
|
6
16
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.7.0
|
@@ -22,6 +22,7 @@ require 'aws-sdk-core/plugins/endpoint_pattern.rb'
|
|
22
22
|
require 'aws-sdk-core/plugins/response_paging.rb'
|
23
23
|
require 'aws-sdk-core/plugins/stub_responses.rb'
|
24
24
|
require 'aws-sdk-core/plugins/idempotency_token.rb'
|
25
|
+
require 'aws-sdk-core/plugins/invocation_id.rb'
|
25
26
|
require 'aws-sdk-core/plugins/jsonvalue_converter.rb'
|
26
27
|
require 'aws-sdk-core/plugins/client_metrics_plugin.rb'
|
27
28
|
require 'aws-sdk-core/plugins/client_metrics_send_plugin.rb'
|
@@ -73,6 +74,7 @@ module Aws::BedrockRuntime
|
|
73
74
|
add_plugin(Aws::Plugins::ResponsePaging)
|
74
75
|
add_plugin(Aws::Plugins::StubResponses)
|
75
76
|
add_plugin(Aws::Plugins::IdempotencyToken)
|
77
|
+
add_plugin(Aws::Plugins::InvocationId)
|
76
78
|
add_plugin(Aws::Plugins::JsonvalueConverter)
|
77
79
|
add_plugin(Aws::Plugins::ClientMetricsPlugin)
|
78
80
|
add_plugin(Aws::Plugins::ClientMetricsSendPlugin)
|
@@ -198,10 +200,17 @@ module Aws::BedrockRuntime
|
|
198
200
|
# When set to 'true' the request body will not be compressed
|
199
201
|
# for supported operations.
|
200
202
|
#
|
201
|
-
# @option options [String] :endpoint
|
202
|
-
#
|
203
|
-
#
|
204
|
-
#
|
203
|
+
# @option options [String, URI::HTTPS, URI::HTTP] :endpoint
|
204
|
+
# Normally you should not configure the `:endpoint` option
|
205
|
+
# directly. This is normally constructed from the `:region`
|
206
|
+
# option. Configuring `:endpoint` is normally reserved for
|
207
|
+
# connecting to test or custom endpoints. The endpoint should
|
208
|
+
# be a URI formatted like:
|
209
|
+
#
|
210
|
+
# 'http://example.com'
|
211
|
+
# 'https://example.com'
|
212
|
+
# 'http://example.com:123'
|
213
|
+
#
|
205
214
|
#
|
206
215
|
# @option options [Integer] :endpoint_cache_max_entries (1000)
|
207
216
|
# Used for the maximum size limit of the LRU cache storing endpoints data
|
@@ -348,50 +357,65 @@ module Aws::BedrockRuntime
|
|
348
357
|
# @option options [Aws::BedrockRuntime::EndpointProvider] :endpoint_provider
|
349
358
|
# The endpoint provider used to resolve endpoints. Any object that responds to `#resolve_endpoint(parameters)` where `parameters` is a Struct similar to `Aws::BedrockRuntime::EndpointParameters`
|
350
359
|
#
|
351
|
-
# @option options [
|
352
|
-
#
|
353
|
-
#
|
354
|
-
#
|
355
|
-
#
|
356
|
-
#
|
357
|
-
#
|
358
|
-
#
|
359
|
-
#
|
360
|
-
#
|
361
|
-
#
|
362
|
-
# @option options [Float] :
|
363
|
-
#
|
364
|
-
#
|
365
|
-
#
|
366
|
-
#
|
367
|
-
#
|
368
|
-
#
|
369
|
-
#
|
370
|
-
#
|
371
|
-
#
|
372
|
-
#
|
373
|
-
#
|
374
|
-
#
|
375
|
-
#
|
376
|
-
#
|
377
|
-
#
|
378
|
-
#
|
360
|
+
# @option options [Float] :http_continue_timeout (1)
|
361
|
+
# The number of seconds to wait for a 100-continue response before sending the
|
362
|
+
# request body. This option has no effect unless the request has "Expect"
|
363
|
+
# header set to "100-continue". Defaults to `nil` which disables this
|
364
|
+
# behaviour. This value can safely be set per request on the session.
|
365
|
+
#
|
366
|
+
# @option options [Float] :http_idle_timeout (5)
|
367
|
+
# The number of seconds a connection is allowed to sit idle before it
|
368
|
+
# is considered stale. Stale connections are closed and removed from the
|
369
|
+
# pool before making a request.
|
370
|
+
#
|
371
|
+
# @option options [Float] :http_open_timeout (15)
|
372
|
+
# The default number of seconds to wait for response data.
|
373
|
+
# This value can safely be set per-request on the session.
|
374
|
+
#
|
375
|
+
# @option options [URI::HTTP,String] :http_proxy
|
376
|
+
# A proxy to send requests through. Formatted like 'http://proxy.com:123'.
|
377
|
+
#
|
378
|
+
# @option options [Float] :http_read_timeout (60)
|
379
|
+
# The default number of seconds to wait for response data.
|
380
|
+
# This value can safely be set per-request on the session.
|
381
|
+
#
|
382
|
+
# @option options [Boolean] :http_wire_trace (false)
|
383
|
+
# When `true`, HTTP debug output will be sent to the `:logger`.
|
384
|
+
#
|
385
|
+
# @option options [Proc] :on_chunk_received
|
386
|
+
# When a Proc object is provided, it will be used as callback when each chunk
|
387
|
+
# of the response body is received. It provides three arguments: the chunk,
|
388
|
+
# the number of bytes received, and the total number of
|
389
|
+
# bytes in the response (or nil if the server did not send a `content-length`).
|
390
|
+
#
|
391
|
+
# @option options [Proc] :on_chunk_sent
|
392
|
+
# When a Proc object is provided, it will be used as callback when each chunk
|
393
|
+
# of the request body is sent. It provides three arguments: the chunk,
|
394
|
+
# the number of bytes read from the body, and the total number of
|
395
|
+
# bytes in the body.
|
396
|
+
#
|
397
|
+
# @option options [Boolean] :raise_response_errors (true)
|
398
|
+
# When `true`, response errors are raised.
|
399
|
+
#
|
400
|
+
# @option options [String] :ssl_ca_bundle
|
401
|
+
# Full path to the SSL certificate authority bundle file that should be used when
|
402
|
+
# verifying peer certificates. If you do not pass `:ssl_ca_bundle` or
|
403
|
+
# `:ssl_ca_directory` the the system default will be used if available.
|
404
|
+
#
|
405
|
+
# @option options [String] :ssl_ca_directory
|
406
|
+
# Full path of the directory that contains the unbundled SSL certificate
|
407
|
+
# authority files for verifying peer certificates. If you do
|
408
|
+
# not pass `:ssl_ca_bundle` or `:ssl_ca_directory` the the system
|
409
|
+
# default will be used if available.
|
379
410
|
#
|
380
|
-
# @option options [
|
381
|
-
#
|
382
|
-
# connection.
|
411
|
+
# @option options [String] :ssl_ca_store
|
412
|
+
# Sets the X509::Store to verify peer certificate.
|
383
413
|
#
|
384
|
-
# @option options [
|
385
|
-
#
|
386
|
-
# verifying peer certificates. If you do not pass
|
387
|
-
# `:ssl_ca_bundle` or `:ssl_ca_directory` the the system default
|
388
|
-
# will be used if available.
|
414
|
+
# @option options [Float] :ssl_timeout
|
415
|
+
# Sets the SSL timeout in seconds
|
389
416
|
#
|
390
|
-
# @option options [
|
391
|
-
#
|
392
|
-
# authority files for verifying peer certificates. If you do
|
393
|
-
# not pass `:ssl_ca_bundle` or `:ssl_ca_directory` the the
|
394
|
-
# system default will be used if available.
|
417
|
+
# @option options [Boolean] :ssl_verify_peer (true)
|
418
|
+
# When `true`, SSL peer certificates are verified when establishing a connection.
|
395
419
|
#
|
396
420
|
def initialize(*args)
|
397
421
|
super
|
@@ -399,27 +423,27 @@ module Aws::BedrockRuntime
|
|
399
423
|
|
400
424
|
# @!group API Operations
|
401
425
|
|
402
|
-
# Invokes the specified Bedrock model to run inference using the
|
403
|
-
# provided in the request body. You use
|
404
|
-
#
|
405
|
-
#
|
406
|
-
# For more information, see [Run inference][1] in the Bedrock User
|
407
|
-
# Guide.
|
426
|
+
# Invokes the specified Amazon Bedrock model to run inference using the
|
427
|
+
# prompt and inference parameters provided in the request body. You use
|
428
|
+
# model inference to generate text, images, and embeddings.
|
408
429
|
#
|
409
|
-
# For example
|
430
|
+
# For example code, see *Invoke model code examples* in the *Amazon
|
431
|
+
# Bedrock User Guide*.
|
410
432
|
#
|
411
|
-
#
|
412
|
-
#
|
413
|
-
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html
|
433
|
+
# This operation requires permission for the `bedrock:InvokeModel`
|
434
|
+
# action.
|
414
435
|
#
|
415
436
|
# @option params [required, String, StringIO, File] :body
|
416
|
-
#
|
417
|
-
# To see the format and content of
|
418
|
-
# refer to [Inference
|
437
|
+
# The prompt and inference parameters in the format specified in the
|
438
|
+
# `contentType` in the header. To see the format and content of the
|
439
|
+
# request and response bodies for different models, refer to [Inference
|
440
|
+
# parameters][1]. For more information, see [Run inference][2] in the
|
441
|
+
# Bedrock User Guide.
|
419
442
|
#
|
420
443
|
#
|
421
444
|
#
|
422
445
|
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
|
446
|
+
# [2]: https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html
|
423
447
|
#
|
424
448
|
# @option params [String] :content_type
|
425
449
|
# The MIME type of the input data in the request. The default value is
|
@@ -430,7 +454,50 @@ module Aws::BedrockRuntime
|
|
430
454
|
# default value is `application/json`.
|
431
455
|
#
|
432
456
|
# @option params [required, String] :model_id
|
433
|
-
#
|
457
|
+
# The unique identifier of the model to invoke to run inference.
|
458
|
+
#
|
459
|
+
# The `modelId` to provide depends on the type of model that you use:
|
460
|
+
#
|
461
|
+
# * If you use a base model, specify the model ID or its ARN. For a list
|
462
|
+
# of model IDs for base models, see [Amazon Bedrock base model IDs
|
463
|
+
# (on-demand throughput)][1] in the Amazon Bedrock User Guide.
|
464
|
+
#
|
465
|
+
# * If you use a provisioned model, specify the ARN of the Provisioned
|
466
|
+
# Throughput. For more information, see [Run inference using a
|
467
|
+
# Provisioned Throughput][2] in the Amazon Bedrock User Guide.
|
468
|
+
#
|
469
|
+
# * If you use a custom model, first purchase Provisioned Throughput for
|
470
|
+
# it. Then specify the ARN of the resulting provisioned model. For
|
471
|
+
# more information, see [Use a custom model in Amazon Bedrock][3] in
|
472
|
+
# the Amazon Bedrock User Guide.
|
473
|
+
#
|
474
|
+
#
|
475
|
+
#
|
476
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns
|
477
|
+
# [2]: https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html
|
478
|
+
# [3]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html
|
479
|
+
#
|
480
|
+
# @option params [String] :trace
|
481
|
+
# Specifies whether to enable or disable the Bedrock trace. If enabled,
|
482
|
+
# you can see the full Bedrock trace.
|
483
|
+
#
|
484
|
+
# @option params [String] :guardrail_identifier
|
485
|
+
# The unique identifier of the guardrail that you want to use. If you
|
486
|
+
# don't provide a value, no guardrail is applied to the invocation.
|
487
|
+
#
|
488
|
+
# An error will be thrown in the following situations.
|
489
|
+
#
|
490
|
+
# * You don't provide a guardrail identifier but you specify the
|
491
|
+
# `amazon-bedrock-guardrailConfig` field in the request body.
|
492
|
+
#
|
493
|
+
# * You enable the guardrail but the `contentType` isn't
|
494
|
+
# `application/json`.
|
495
|
+
#
|
496
|
+
# * You provide a guardrail identifier, but `guardrailVersion` isn't
|
497
|
+
# specified.
|
498
|
+
#
|
499
|
+
# @option params [String] :guardrail_version
|
500
|
+
# The version number for the guardrail. The value can also be `DRAFT`.
|
434
501
|
#
|
435
502
|
# @return [Types::InvokeModelResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
436
503
|
#
|
@@ -444,6 +511,9 @@ module Aws::BedrockRuntime
|
|
444
511
|
# content_type: "MimeType",
|
445
512
|
# accept: "MimeType",
|
446
513
|
# model_id: "InvokeModelIdentifier", # required
|
514
|
+
# trace: "ENABLED", # accepts ENABLED, DISABLED
|
515
|
+
# guardrail_identifier: "GuardrailIdentifier",
|
516
|
+
# guardrail_version: "GuardrailVersion",
|
447
517
|
# })
|
448
518
|
#
|
449
519
|
# @example Response structure
|
@@ -460,27 +530,38 @@ module Aws::BedrockRuntime
|
|
460
530
|
req.send_request(options)
|
461
531
|
end
|
462
532
|
|
463
|
-
# Invoke the specified Bedrock model to run inference using the
|
464
|
-
#
|
533
|
+
# Invoke the specified Amazon Bedrock model to run inference using the
|
534
|
+
# prompt and inference parameters provided in the request body. The
|
535
|
+
# response is returned in a stream.
|
536
|
+
#
|
537
|
+
# To see if a model supports streaming, call [GetFoundationModel][1] and
|
538
|
+
# check the `responseStreamingSupported` field in the response.
|
465
539
|
#
|
466
|
-
#
|
467
|
-
# Guide.
|
540
|
+
# <note markdown="1"> The CLI doesn't support `InvokeModelWithResponseStream`.
|
468
541
|
#
|
469
|
-
#
|
470
|
-
# section).
|
542
|
+
# </note>
|
471
543
|
#
|
544
|
+
# For example code, see *Invoke model with streaming code example* in
|
545
|
+
# the *Amazon Bedrock User Guide*.
|
472
546
|
#
|
547
|
+
# This operation requires permissions to perform the
|
548
|
+
# `bedrock:InvokeModelWithResponseStream` action.
|
473
549
|
#
|
474
|
-
#
|
550
|
+
#
|
551
|
+
#
|
552
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GetFoundationModel.html
|
475
553
|
#
|
476
554
|
# @option params [required, String, StringIO, File] :body
|
477
|
-
#
|
478
|
-
#
|
479
|
-
# [Inference
|
555
|
+
# The prompt and inference parameters in the format specified in the
|
556
|
+
# `contentType` in the header. To see the format and content of the
|
557
|
+
# request and response bodies for different models, refer to [Inference
|
558
|
+
# parameters][1]. For more information, see [Run inference][2] in the
|
559
|
+
# Bedrock User Guide.
|
480
560
|
#
|
481
561
|
#
|
482
562
|
#
|
483
563
|
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
|
564
|
+
# [2]: https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html
|
484
565
|
#
|
485
566
|
# @option params [String] :content_type
|
486
567
|
# The MIME type of the input data in the request. The default value is
|
@@ -491,7 +572,50 @@ module Aws::BedrockRuntime
|
|
491
572
|
# default value is `application/json`.
|
492
573
|
#
|
493
574
|
# @option params [required, String] :model_id
|
494
|
-
#
|
575
|
+
# The unique identifier of the model to invoke to run inference.
|
576
|
+
#
|
577
|
+
# The `modelId` to provide depends on the type of model that you use:
|
578
|
+
#
|
579
|
+
# * If you use a base model, specify the model ID or its ARN. For a list
|
580
|
+
# of model IDs for base models, see [Amazon Bedrock base model IDs
|
581
|
+
# (on-demand throughput)][1] in the Amazon Bedrock User Guide.
|
582
|
+
#
|
583
|
+
# * If you use a provisioned model, specify the ARN of the Provisioned
|
584
|
+
# Throughput. For more information, see [Run inference using a
|
585
|
+
# Provisioned Throughput][2] in the Amazon Bedrock User Guide.
|
586
|
+
#
|
587
|
+
# * If you use a custom model, first purchase Provisioned Throughput for
|
588
|
+
# it. Then specify the ARN of the resulting provisioned model. For
|
589
|
+
# more information, see [Use a custom model in Amazon Bedrock][3] in
|
590
|
+
# the Amazon Bedrock User Guide.
|
591
|
+
#
|
592
|
+
#
|
593
|
+
#
|
594
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns
|
595
|
+
# [2]: https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html
|
596
|
+
# [3]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html
|
597
|
+
#
|
598
|
+
# @option params [String] :trace
|
599
|
+
# Specifies whether to enable or disable the Bedrock trace. If enabled,
|
600
|
+
# you can see the full Bedrock trace.
|
601
|
+
#
|
602
|
+
# @option params [String] :guardrail_identifier
|
603
|
+
# The unique identifier of the guardrail that you want to use. If you
|
604
|
+
# don't provide a value, no guardrail is applied to the invocation.
|
605
|
+
#
|
606
|
+
# An error is thrown in the following situations.
|
607
|
+
#
|
608
|
+
# * You don't provide a guardrail identifier but you specify the
|
609
|
+
# `amazon-bedrock-guardrailConfig` field in the request body.
|
610
|
+
#
|
611
|
+
# * You enable the guardrail but the `contentType` isn't
|
612
|
+
# `application/json`.
|
613
|
+
#
|
614
|
+
# * You provide a guardrail identifier, but `guardrailVersion` isn't
|
615
|
+
# specified.
|
616
|
+
#
|
617
|
+
# @option params [String] :guardrail_version
|
618
|
+
# The version number for the guardrail. The value can also be `DRAFT`.
|
495
619
|
#
|
496
620
|
# @return [Types::InvokeModelWithResponseStreamResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
497
621
|
#
|
@@ -500,22 +624,22 @@ module Aws::BedrockRuntime
|
|
500
624
|
#
|
501
625
|
# @example EventStream Operation Example
|
502
626
|
#
|
503
|
-
# You can process event once it arrives immediately, or wait until
|
504
|
-
# full response complete and iterate through eventstream enumerator.
|
627
|
+
# You can process the event once it arrives immediately, or wait until the
|
628
|
+
# full response is complete and iterate through the eventstream enumerator.
|
505
629
|
#
|
506
630
|
# To interact with event immediately, you need to register #invoke_model_with_response_stream
|
507
|
-
# with callbacks
|
508
|
-
#
|
631
|
+
# with callbacks. Callbacks can be registered for specific events or for all
|
632
|
+
# events, including error events.
|
509
633
|
#
|
510
|
-
# Callbacks can be passed
|
511
|
-
# statement attached to #invoke_model_with_response_stream call directly. Hybrid
|
512
|
-
# is also supported.
|
634
|
+
# Callbacks can be passed into the `:event_stream_handler` option or within a
|
635
|
+
# block statement attached to the #invoke_model_with_response_stream call directly. Hybrid
|
636
|
+
# pattern of both is also supported.
|
513
637
|
#
|
514
|
-
# `:event_stream_handler` option takes in either Proc object or
|
638
|
+
# `:event_stream_handler` option takes in either a Proc object or
|
515
639
|
# Aws::BedrockRuntime::EventStreams::ResponseStream object.
|
516
640
|
#
|
517
|
-
# Usage pattern a):
|
518
|
-
# Example for registering callbacks for all event types and error event
|
641
|
+
# Usage pattern a): Callbacks with a block attached to #invoke_model_with_response_stream
|
642
|
+
# Example for registering callbacks for all event types and an error event
|
519
643
|
#
|
520
644
|
# client.invoke_model_with_response_stream( # params input# ) do |stream|
|
521
645
|
# stream.on_error_event do |event|
|
@@ -535,9 +659,9 @@ module Aws::BedrockRuntime
|
|
535
659
|
#
|
536
660
|
# end
|
537
661
|
#
|
538
|
-
# Usage pattern b):
|
662
|
+
# Usage pattern b): Pass in `:event_stream_handler` for #invoke_model_with_response_stream
|
539
663
|
#
|
540
|
-
# 1)
|
664
|
+
# 1) Create a Aws::BedrockRuntime::EventStreams::ResponseStream object
|
541
665
|
# Example for registering callbacks with specific events
|
542
666
|
#
|
543
667
|
# handler = Aws::BedrockRuntime::EventStreams::ResponseStream.new
|
@@ -562,7 +686,7 @@ module Aws::BedrockRuntime
|
|
562
686
|
#
|
563
687
|
# client.invoke_model_with_response_stream( # params input #, event_stream_handler: handler)
|
564
688
|
#
|
565
|
-
# 2)
|
689
|
+
# 2) Use a Ruby Proc object
|
566
690
|
# Example for registering callbacks with specific events
|
567
691
|
#
|
568
692
|
# handler = Proc.new do |stream|
|
@@ -588,7 +712,7 @@ module Aws::BedrockRuntime
|
|
588
712
|
#
|
589
713
|
# client.invoke_model_with_response_stream( # params input #, event_stream_handler: handler)
|
590
714
|
#
|
591
|
-
# Usage pattern c):
|
715
|
+
# Usage pattern c): Hybrid pattern of a) and b)
|
592
716
|
#
|
593
717
|
# handler = Aws::BedrockRuntime::EventStreams::ResponseStream.new
|
594
718
|
# handler.on_chunk_event do |event|
|
@@ -621,8 +745,7 @@ module Aws::BedrockRuntime
|
|
621
745
|
# end
|
622
746
|
# end
|
623
747
|
#
|
624
|
-
#
|
625
|
-
# iterate through events after response complete.
|
748
|
+
# You can also iterate through events after the response complete.
|
626
749
|
#
|
627
750
|
# Events are available at resp.body # => Enumerator
|
628
751
|
# For parameter input example, please refer to following request syntax
|
@@ -634,6 +757,9 @@ module Aws::BedrockRuntime
|
|
634
757
|
# content_type: "MimeType",
|
635
758
|
# accept: "MimeType",
|
636
759
|
# model_id: "InvokeModelIdentifier", # required
|
760
|
+
# trace: "ENABLED", # accepts ENABLED, DISABLED
|
761
|
+
# guardrail_identifier: "GuardrailIdentifier",
|
762
|
+
# guardrail_version: "GuardrailVersion",
|
637
763
|
# })
|
638
764
|
#
|
639
765
|
# @example Response structure
|
@@ -704,7 +830,7 @@ module Aws::BedrockRuntime
|
|
704
830
|
params: params,
|
705
831
|
config: config)
|
706
832
|
context[:gem_name] = 'aws-sdk-bedrockruntime'
|
707
|
-
context[:gem_version] = '1.
|
833
|
+
context[:gem_version] = '1.7.0'
|
708
834
|
Seahorse::Client::Request.new(handlers, context)
|
709
835
|
end
|
710
836
|
|
@@ -15,6 +15,8 @@ module Aws::BedrockRuntime
|
|
15
15
|
|
16
16
|
AccessDeniedException = Shapes::StructureShape.new(name: 'AccessDeniedException')
|
17
17
|
Body = Shapes::BlobShape.new(name: 'Body')
|
18
|
+
GuardrailIdentifier = Shapes::StringShape.new(name: 'GuardrailIdentifier')
|
19
|
+
GuardrailVersion = Shapes::StringShape.new(name: 'GuardrailVersion')
|
18
20
|
InternalServerException = Shapes::StructureShape.new(name: 'InternalServerException')
|
19
21
|
InvokeModelIdentifier = Shapes::StringShape.new(name: 'InvokeModelIdentifier')
|
20
22
|
InvokeModelRequest = Shapes::StructureShape.new(name: 'InvokeModelRequest')
|
@@ -34,6 +36,7 @@ module Aws::BedrockRuntime
|
|
34
36
|
ServiceQuotaExceededException = Shapes::StructureShape.new(name: 'ServiceQuotaExceededException')
|
35
37
|
StatusCode = Shapes::IntegerShape.new(name: 'StatusCode')
|
36
38
|
ThrottlingException = Shapes::StructureShape.new(name: 'ThrottlingException')
|
39
|
+
Trace = Shapes::StringShape.new(name: 'Trace')
|
37
40
|
ValidationException = Shapes::StructureShape.new(name: 'ValidationException')
|
38
41
|
|
39
42
|
AccessDeniedException.add_member(:message, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "message"))
|
@@ -46,6 +49,9 @@ module Aws::BedrockRuntime
|
|
46
49
|
InvokeModelRequest.add_member(:content_type, Shapes::ShapeRef.new(shape: MimeType, location: "header", location_name: "Content-Type"))
|
47
50
|
InvokeModelRequest.add_member(:accept, Shapes::ShapeRef.new(shape: MimeType, location: "header", location_name: "Accept"))
|
48
51
|
InvokeModelRequest.add_member(:model_id, Shapes::ShapeRef.new(shape: InvokeModelIdentifier, required: true, location: "uri", location_name: "modelId"))
|
52
|
+
InvokeModelRequest.add_member(:trace, Shapes::ShapeRef.new(shape: Trace, location: "header", location_name: "X-Amzn-Bedrock-Trace"))
|
53
|
+
InvokeModelRequest.add_member(:guardrail_identifier, Shapes::ShapeRef.new(shape: GuardrailIdentifier, location: "header", location_name: "X-Amzn-Bedrock-GuardrailIdentifier"))
|
54
|
+
InvokeModelRequest.add_member(:guardrail_version, Shapes::ShapeRef.new(shape: GuardrailVersion, location: "header", location_name: "X-Amzn-Bedrock-GuardrailVersion"))
|
49
55
|
InvokeModelRequest.struct_class = Types::InvokeModelRequest
|
50
56
|
InvokeModelRequest[:payload] = :body
|
51
57
|
InvokeModelRequest[:payload_member] = InvokeModelRequest.member(:body)
|
@@ -60,6 +66,9 @@ module Aws::BedrockRuntime
|
|
60
66
|
InvokeModelWithResponseStreamRequest.add_member(:content_type, Shapes::ShapeRef.new(shape: MimeType, location: "header", location_name: "Content-Type"))
|
61
67
|
InvokeModelWithResponseStreamRequest.add_member(:accept, Shapes::ShapeRef.new(shape: MimeType, location: "header", location_name: "X-Amzn-Bedrock-Accept"))
|
62
68
|
InvokeModelWithResponseStreamRequest.add_member(:model_id, Shapes::ShapeRef.new(shape: InvokeModelIdentifier, required: true, location: "uri", location_name: "modelId"))
|
69
|
+
InvokeModelWithResponseStreamRequest.add_member(:trace, Shapes::ShapeRef.new(shape: Trace, location: "header", location_name: "X-Amzn-Bedrock-Trace"))
|
70
|
+
InvokeModelWithResponseStreamRequest.add_member(:guardrail_identifier, Shapes::ShapeRef.new(shape: GuardrailIdentifier, location: "header", location_name: "X-Amzn-Bedrock-GuardrailIdentifier"))
|
71
|
+
InvokeModelWithResponseStreamRequest.add_member(:guardrail_version, Shapes::ShapeRef.new(shape: GuardrailVersion, location: "header", location_name: "X-Amzn-Bedrock-GuardrailVersion"))
|
63
72
|
InvokeModelWithResponseStreamRequest.struct_class = Types::InvokeModelWithResponseStreamRequest
|
64
73
|
InvokeModelWithResponseStreamRequest[:payload] = :body
|
65
74
|
InvokeModelWithResponseStreamRequest[:payload_member] = InvokeModelWithResponseStreamRequest.member(:body)
|
@@ -38,13 +38,16 @@ module Aws::BedrockRuntime
|
|
38
38
|
end
|
39
39
|
|
40
40
|
# @!attribute [rw] body
|
41
|
-
#
|
42
|
-
# header. To see the format and content of
|
43
|
-
# models, refer to
|
41
|
+
# The prompt and inference parameters in the format specified in the
|
42
|
+
# `contentType` in the header. To see the format and content of the
|
43
|
+
# request and response bodies for different models, refer to
|
44
|
+
# [Inference parameters][1]. For more information, see [Run
|
45
|
+
# inference][2] in the Bedrock User Guide.
|
44
46
|
#
|
45
47
|
#
|
46
48
|
#
|
47
49
|
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
|
50
|
+
# [2]: https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html
|
48
51
|
# @return [String]
|
49
52
|
#
|
50
53
|
# @!attribute [rw] content_type
|
@@ -58,7 +61,53 @@ module Aws::BedrockRuntime
|
|
58
61
|
# @return [String]
|
59
62
|
#
|
60
63
|
# @!attribute [rw] model_id
|
61
|
-
#
|
64
|
+
# The unique identifier of the model to invoke to run inference.
|
65
|
+
#
|
66
|
+
# The `modelId` to provide depends on the type of model that you use:
|
67
|
+
#
|
68
|
+
# * If you use a base model, specify the model ID or its ARN. For a
|
69
|
+
# list of model IDs for base models, see [Amazon Bedrock base model
|
70
|
+
# IDs (on-demand throughput)][1] in the Amazon Bedrock User Guide.
|
71
|
+
#
|
72
|
+
# * If you use a provisioned model, specify the ARN of the Provisioned
|
73
|
+
# Throughput. For more information, see [Run inference using a
|
74
|
+
# Provisioned Throughput][2] in the Amazon Bedrock User Guide.
|
75
|
+
#
|
76
|
+
# * If you use a custom model, first purchase Provisioned Throughput
|
77
|
+
# for it. Then specify the ARN of the resulting provisioned model.
|
78
|
+
# For more information, see [Use a custom model in Amazon
|
79
|
+
# Bedrock][3] in the Amazon Bedrock User Guide.
|
80
|
+
#
|
81
|
+
#
|
82
|
+
#
|
83
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns
|
84
|
+
# [2]: https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html
|
85
|
+
# [3]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html
|
86
|
+
# @return [String]
|
87
|
+
#
|
88
|
+
# @!attribute [rw] trace
|
89
|
+
# Specifies whether to enable or disable the Bedrock trace. If
|
90
|
+
# enabled, you can see the full Bedrock trace.
|
91
|
+
# @return [String]
|
92
|
+
#
|
93
|
+
# @!attribute [rw] guardrail_identifier
|
94
|
+
# The unique identifier of the guardrail that you want to use. If you
|
95
|
+
# don't provide a value, no guardrail is applied to the invocation.
|
96
|
+
#
|
97
|
+
# An error will be thrown in the following situations.
|
98
|
+
#
|
99
|
+
# * You don't provide a guardrail identifier but you specify the
|
100
|
+
# `amazon-bedrock-guardrailConfig` field in the request body.
|
101
|
+
#
|
102
|
+
# * You enable the guardrail but the `contentType` isn't
|
103
|
+
# `application/json`.
|
104
|
+
#
|
105
|
+
# * You provide a guardrail identifier, but `guardrailVersion` isn't
|
106
|
+
# specified.
|
107
|
+
# @return [String]
|
108
|
+
#
|
109
|
+
# @!attribute [rw] guardrail_version
|
110
|
+
# The version number for the guardrail. The value can also be `DRAFT`.
|
62
111
|
# @return [String]
|
63
112
|
#
|
64
113
|
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelRequest AWS API Documentation
|
@@ -67,15 +116,19 @@ module Aws::BedrockRuntime
|
|
67
116
|
:body,
|
68
117
|
:content_type,
|
69
118
|
:accept,
|
70
|
-
:model_id
|
119
|
+
:model_id,
|
120
|
+
:trace,
|
121
|
+
:guardrail_identifier,
|
122
|
+
:guardrail_version)
|
71
123
|
SENSITIVE = [:body]
|
72
124
|
include Aws::Structure
|
73
125
|
end
|
74
126
|
|
75
127
|
# @!attribute [rw] body
|
76
128
|
# Inference response from the model in the format specified in the
|
77
|
-
#
|
78
|
-
#
|
129
|
+
# `contentType` header. To see the format and content of the request
|
130
|
+
# and response bodies for different models, refer to [Inference
|
131
|
+
# parameters][1].
|
79
132
|
#
|
80
133
|
#
|
81
134
|
#
|
@@ -96,13 +149,16 @@ module Aws::BedrockRuntime
|
|
96
149
|
end
|
97
150
|
|
98
151
|
# @!attribute [rw] body
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
152
|
+
# The prompt and inference parameters in the format specified in the
|
153
|
+
# `contentType` in the header. To see the format and content of the
|
154
|
+
# request and response bodies for different models, refer to
|
155
|
+
# [Inference parameters][1]. For more information, see [Run
|
156
|
+
# inference][2] in the Bedrock User Guide.
|
102
157
|
#
|
103
158
|
#
|
104
159
|
#
|
105
160
|
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html
|
161
|
+
# [2]: https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html
|
106
162
|
# @return [String]
|
107
163
|
#
|
108
164
|
# @!attribute [rw] content_type
|
@@ -116,7 +172,53 @@ module Aws::BedrockRuntime
|
|
116
172
|
# @return [String]
|
117
173
|
#
|
118
174
|
# @!attribute [rw] model_id
|
119
|
-
#
|
175
|
+
# The unique identifier of the model to invoke to run inference.
|
176
|
+
#
|
177
|
+
# The `modelId` to provide depends on the type of model that you use:
|
178
|
+
#
|
179
|
+
# * If you use a base model, specify the model ID or its ARN. For a
|
180
|
+
# list of model IDs for base models, see [Amazon Bedrock base model
|
181
|
+
# IDs (on-demand throughput)][1] in the Amazon Bedrock User Guide.
|
182
|
+
#
|
183
|
+
# * If you use a provisioned model, specify the ARN of the Provisioned
|
184
|
+
# Throughput. For more information, see [Run inference using a
|
185
|
+
# Provisioned Throughput][2] in the Amazon Bedrock User Guide.
|
186
|
+
#
|
187
|
+
# * If you use a custom model, first purchase Provisioned Throughput
|
188
|
+
# for it. Then specify the ARN of the resulting provisioned model.
|
189
|
+
# For more information, see [Use a custom model in Amazon
|
190
|
+
# Bedrock][3] in the Amazon Bedrock User Guide.
|
191
|
+
#
|
192
|
+
#
|
193
|
+
#
|
194
|
+
# [1]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns
|
195
|
+
# [2]: https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html
|
196
|
+
# [3]: https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html
|
197
|
+
# @return [String]
|
198
|
+
#
|
199
|
+
# @!attribute [rw] trace
|
200
|
+
# Specifies whether to enable or disable the Bedrock trace. If
|
201
|
+
# enabled, you can see the full Bedrock trace.
|
202
|
+
# @return [String]
|
203
|
+
#
|
204
|
+
# @!attribute [rw] guardrail_identifier
|
205
|
+
# The unique identifier of the guardrail that you want to use. If you
|
206
|
+
# don't provide a value, no guardrail is applied to the invocation.
|
207
|
+
#
|
208
|
+
# An error is thrown in the following situations.
|
209
|
+
#
|
210
|
+
# * You don't provide a guardrail identifier but you specify the
|
211
|
+
# `amazon-bedrock-guardrailConfig` field in the request body.
|
212
|
+
#
|
213
|
+
# * You enable the guardrail but the `contentType` isn't
|
214
|
+
# `application/json`.
|
215
|
+
#
|
216
|
+
# * You provide a guardrail identifier, but `guardrailVersion` isn't
|
217
|
+
# specified.
|
218
|
+
# @return [String]
|
219
|
+
#
|
220
|
+
# @!attribute [rw] guardrail_version
|
221
|
+
# The version number for the guardrail. The value can also be `DRAFT`.
|
120
222
|
# @return [String]
|
121
223
|
#
|
122
224
|
# @see http://docs.aws.amazon.com/goto/WebAPI/bedrock-runtime-2023-09-30/InvokeModelWithResponseStreamRequest AWS API Documentation
|
@@ -125,15 +227,18 @@ module Aws::BedrockRuntime
|
|
125
227
|
:body,
|
126
228
|
:content_type,
|
127
229
|
:accept,
|
128
|
-
:model_id
|
230
|
+
:model_id,
|
231
|
+
:trace,
|
232
|
+
:guardrail_identifier,
|
233
|
+
:guardrail_version)
|
129
234
|
SENSITIVE = [:body]
|
130
235
|
include Aws::Structure
|
131
236
|
end
|
132
237
|
|
133
238
|
# @!attribute [rw] body
|
134
|
-
# Inference response from the model in the format specified by
|
135
|
-
#
|
136
|
-
# different models, refer to [Inference parameters][1].
|
239
|
+
# Inference response from the model in the format specified by the
|
240
|
+
# `contentType` header. To see the format and content of this field
|
241
|
+
# for different models, refer to [Inference parameters][1].
|
137
242
|
#
|
138
243
|
#
|
139
244
|
#
|
@@ -190,7 +295,7 @@ module Aws::BedrockRuntime
|
|
190
295
|
include Aws::Structure
|
191
296
|
end
|
192
297
|
|
193
|
-
# An error occurred while streaming the response.
|
298
|
+
# An error occurred while streaming the response. Retry your request.
|
194
299
|
#
|
195
300
|
# @!attribute [rw] message
|
196
301
|
# @return [String]
|
data/sig/client.rbs
CHANGED
@@ -85,7 +85,10 @@ module Aws
|
|
85
85
|
body: ::String,
|
86
86
|
?content_type: ::String,
|
87
87
|
?accept: ::String,
|
88
|
-
model_id: ::String
|
88
|
+
model_id: ::String,
|
89
|
+
?trace: ("ENABLED" | "DISABLED"),
|
90
|
+
?guardrail_identifier: ::String,
|
91
|
+
?guardrail_version: ::String
|
89
92
|
) -> _InvokeModelResponseSuccess
|
90
93
|
| (Hash[Symbol, untyped] params, ?Hash[Symbol, untyped] options) -> _InvokeModelResponseSuccess
|
91
94
|
|
@@ -99,7 +102,10 @@ module Aws
|
|
99
102
|
body: ::String,
|
100
103
|
?content_type: ::String,
|
101
104
|
?accept: ::String,
|
102
|
-
model_id: ::String
|
105
|
+
model_id: ::String,
|
106
|
+
?trace: ("ENABLED" | "DISABLED"),
|
107
|
+
?guardrail_identifier: ::String,
|
108
|
+
?guardrail_version: ::String
|
103
109
|
) ?{ (*untyped) -> void } -> _InvokeModelWithResponseStreamResponseSuccess
|
104
110
|
| (Hash[Symbol, untyped] params, ?Hash[Symbol, untyped] options) ?{ (*untyped) -> void } -> _InvokeModelWithResponseStreamResponseSuccess
|
105
111
|
end
|
data/sig/types.rbs
CHANGED
@@ -24,6 +24,9 @@ module Aws::BedrockRuntime
|
|
24
24
|
attr_accessor content_type: ::String
|
25
25
|
attr_accessor accept: ::String
|
26
26
|
attr_accessor model_id: ::String
|
27
|
+
attr_accessor trace: ("ENABLED" | "DISABLED")
|
28
|
+
attr_accessor guardrail_identifier: ::String
|
29
|
+
attr_accessor guardrail_version: ::String
|
27
30
|
SENSITIVE: [:body]
|
28
31
|
end
|
29
32
|
|
@@ -38,6 +41,9 @@ module Aws::BedrockRuntime
|
|
38
41
|
attr_accessor content_type: ::String
|
39
42
|
attr_accessor accept: ::String
|
40
43
|
attr_accessor model_id: ::String
|
44
|
+
attr_accessor trace: ("ENABLED" | "DISABLED")
|
45
|
+
attr_accessor guardrail_identifier: ::String
|
46
|
+
attr_accessor guardrail_version: ::String
|
41
47
|
SENSITIVE: [:body]
|
42
48
|
end
|
43
49
|
|
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.7.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-
|
11
|
+
date: 2024-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 3.
|
22
|
+
version: 3.193.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '3'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.
|
32
|
+
version: 3.193.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: aws-sigv4
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|