Class: Aws::BedrockRuntime::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::BedrockRuntime::Client
- Includes:
- ClientStubs
- Defined in:
- lib/aws-sdk-bedrockruntime/client.rb
Overview
An API client for BedrockRuntime. To construct a client, you need to configure a ‘:region` and `:credentials`.
client = Aws::BedrockRuntime::Client.new(
region: region_name,
credentials: credentials,
# ...
)
For details on configuring region and credentials see the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
See #initialize for a full list of supported configuration options.
Class Attribute Summary collapse
- .identifier ⇒ Object readonly private
API Operations collapse
-
#invoke_model(params = {}) ⇒ Types::InvokeModelResponse
Invokes the specified Bedrock model to run inference using the input provided in the request body.
-
#invoke_model_with_response_stream(params = {}) ⇒ Types::InvokeModelWithResponseStreamResponse
Invoke the specified Bedrock model to run inference using the input provided.
Class Method Summary collapse
- .errors_module ⇒ Object private
Instance Method Summary collapse
- #build_request(operation_name, params = {}) ⇒ Object private
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
- #waiter_names ⇒ Object deprecated private Deprecated.
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
396 397 398 |
# File 'lib/aws-sdk-bedrockruntime/client.rb', line 396 def initialize(*args) super end |
Class Attribute Details
.identifier ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
708 709 710 |
# File 'lib/aws-sdk-bedrockruntime/client.rb', line 708 def identifier @identifier end |
Class Method Details
.errors_module ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
711 712 713 |
# File 'lib/aws-sdk-bedrockruntime/client.rb', line 711 def errors_module Errors end |
Instance Method Details
#build_request(operation_name, params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
686 687 688 689 690 691 692 693 694 695 696 697 |
# File 'lib/aws-sdk-bedrockruntime/client.rb', line 686 def build_request(operation_name, params = {}) handlers = @handlers.for(operation_name) context = Seahorse::Client::RequestContext.new( operation_name: operation_name, operation: config.api.operation(operation_name), client: self, params: params, config: config) context[:gem_name] = 'aws-sdk-bedrockruntime' context[:gem_version] = '1.0.0' Seahorse::Client::Request.new(handlers, context) end |
#invoke_model(params = {}) ⇒ Types::InvokeModelResponse
Invokes the specified Bedrock model to run inference using the input provided in the request body. You use InvokeModel to run inference for text models, image models, and embedding models.
For more information about invoking models, see Using the API in the [Bedrock User Guide].
For example requests, see Examples (after the Errors section).
[1]: d2eo22ngex1n9g.cloudfront.net/Documentation/BedrockUserGuide.pdf
458 459 460 461 |
# File 'lib/aws-sdk-bedrockruntime/client.rb', line 458 def invoke_model(params = {}, = {}) req = build_request(:invoke_model, params) req.send_request() end |
#invoke_model_with_response_stream(params = {}) ⇒ Types::InvokeModelWithResponseStreamResponse
Invoke the specified Bedrock model to run inference using the input provided. Return the response in a stream.
For more information about invoking models, see Using the API in the [Bedrock User Guide].
For an example request and response, see Examples (after the Errors section).
[1]: d2eo22ngex1n9g.cloudfront.net/Documentation/BedrockUserGuide.pdf
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 |
# File 'lib/aws-sdk-bedrockruntime/client.rb', line 659 def invoke_model_with_response_stream(params = {}, = {}, &block) params = params.dup event_stream_handler = case handler = params.delete(:event_stream_handler) when EventStreams::ResponseStream then handler when Proc then EventStreams::ResponseStream.new.tap(&handler) when nil then EventStreams::ResponseStream.new else msg = "expected :event_stream_handler to be a block or "\ "instance of Aws::BedrockRuntime::EventStreams::ResponseStream"\ ", got `#{handler.inspect}` instead" raise ArgumentError, msg end yield(event_stream_handler) if block_given? req = build_request(:invoke_model_with_response_stream, params) req.context[:event_stream_handler] = event_stream_handler req.handlers.add(Aws::Binary::DecodeHandler, priority: 95) req.send_request(, &block) end |
#waiter_names ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
701 702 703 |
# File 'lib/aws-sdk-bedrockruntime/client.rb', line 701 def waiter_names [] end |