AWS SDK for C++

AWS SDK for C++ Version 1.11.645

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
Aws::BedrockRuntime::BedrockRuntimeClient Class Reference

#include <BedrockRuntimeClient.h>

Inheritance diagram for Aws::BedrockRuntime::BedrockRuntimeClient:
[legend]

Public Types

 
 
 

Public Types inherited from Aws::Client::AWSJsonClient

 
 

Public Member Functions

 
 
 
 
 BedrockRuntimeClient (const Aws::Auth::AWSCredentials &credentials, const Aws::Client::ClientConfiguration &clientConfiguration)
 
 BedrockRuntimeClient (const std::shared_ptr< Aws::Auth::AWSCredentialsProvider > &credentialsProvider, const Aws::Client::ClientConfiguration &clientConfiguration)
 
 
 
template<typename ApplyGuardrailRequestT = Model::ApplyGuardrailRequest>
Model::ApplyGuardrailOutcomeCallable ApplyGuardrailCallable (const ApplyGuardrailRequestT &request) const
 
template<typename ApplyGuardrailRequestT = Model::ApplyGuardrailRequest>
void ApplyGuardrailAsync (const ApplyGuardrailRequestT &request, const ApplyGuardrailResponseReceivedHandler &handler, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr) const
 
 
template<typename ConverseRequestT = Model::ConverseRequest>
Model::ConverseOutcomeCallable ConverseCallable (const ConverseRequestT &request) const
 
template<typename ConverseRequestT = Model::ConverseRequest>
void ConverseAsync (const ConverseRequestT &request, const ConverseResponseReceivedHandler &handler, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr) const
 
 
template<typename ConverseStreamRequestT = Model::ConverseStreamRequest>
Model::ConverseStreamOutcomeCallable ConverseStreamCallable (ConverseStreamRequestT &request) const
 
template<typename ConverseStreamRequestT = Model::ConverseStreamRequest>
void ConverseStreamAsync (ConverseStreamRequestT &request, const ConverseStreamResponseReceivedHandler &handler, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr) const
 
 
template<typename CountTokensRequestT = Model::CountTokensRequest>
Model::CountTokensOutcomeCallable CountTokensCallable (const CountTokensRequestT &request) const
 
template<typename CountTokensRequestT = Model::CountTokensRequest>
void CountTokensAsync (const CountTokensRequestT &request, const CountTokensResponseReceivedHandler &handler, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr) const
 
 
template<typename GetAsyncInvokeRequestT = Model::GetAsyncInvokeRequest>
Model::GetAsyncInvokeOutcomeCallable GetAsyncInvokeCallable (const GetAsyncInvokeRequestT &request) const
 
template<typename GetAsyncInvokeRequestT = Model::GetAsyncInvokeRequest>
void GetAsyncInvokeAsync (const GetAsyncInvokeRequestT &request, const GetAsyncInvokeResponseReceivedHandler &handler, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr) const
 
 
template<typename InvokeModelRequestT = Model::InvokeModelRequest>
Model::InvokeModelOutcomeCallable InvokeModelCallable (const InvokeModelRequestT &request) const
 
template<typename InvokeModelRequestT = Model::InvokeModelRequest>
void InvokeModelAsync (const InvokeModelRequestT &request, const InvokeModelResponseReceivedHandler &handler, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr) const
 
 
 
template<typename InvokeModelWithResponseStreamRequestT = Model::InvokeModelWithResponseStreamRequest>
 
template<typename InvokeModelWithResponseStreamRequestT = Model::InvokeModelWithResponseStreamRequest>
void InvokeModelWithResponseStreamAsync (InvokeModelWithResponseStreamRequestT &request, const InvokeModelWithResponseStreamResponseReceivedHandler &handler, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr) const
 
 
template<typename ListAsyncInvokesRequestT = Model::ListAsyncInvokesRequest>
Model::ListAsyncInvokesOutcomeCallable ListAsyncInvokesCallable (const ListAsyncInvokesRequestT &request={}) const
 
template<typename ListAsyncInvokesRequestT = Model::ListAsyncInvokesRequest>
void ListAsyncInvokesAsync (const ListAsyncInvokesResponseReceivedHandler &handler, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr, const ListAsyncInvokesRequestT &request={}) const
 
 
template<typename StartAsyncInvokeRequestT = Model::StartAsyncInvokeRequest>
Model::StartAsyncInvokeOutcomeCallable StartAsyncInvokeCallable (const StartAsyncInvokeRequestT &request) const
 
template<typename StartAsyncInvokeRequestT = Model::StartAsyncInvokeRequest>
void StartAsyncInvokeAsync (const StartAsyncInvokeRequestT &request, const StartAsyncInvokeResponseReceivedHandler &handler, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr) const
 
void OverrideEndpoint (const Aws::String &endpoint)
 
 

Public Member Functions inherited from Aws::Client::AWSJsonClient

 AWSJsonClient (const Aws::Client::ClientConfiguration &configuration, const std::shared_ptr< Aws::Client::AWSAuthSigner > &signer, const std::shared_ptr< AWSErrorMarshaller > &errorMarshaller)
 
 AWSJsonClient (const Aws::Client::ClientConfiguration &configuration, const std::shared_ptr< Aws::Auth::AWSAuthSignerProvider > &signerProvider, const std::shared_ptr< AWSErrorMarshaller > &errorMarshaller)
 
virtual ~AWSJsonClient ()=default
 
 AWSProtocolClient (const Aws::Client::ClientConfiguration &configuration, const std::shared_ptr< Aws::Client::AWSAuthSigner > &signer, const std::shared_ptr< AWSErrorMarshaller > &errorMarshaller)
 
 AWSProtocolClient (const Aws::Client::ClientConfiguration &configuration, const std::shared_ptr< Aws::Auth::AWSAuthSignerProvider > &signerProvider, const std::shared_ptr< AWSErrorMarshaller > &errorMarshaller)
 
virtual ~AWSProtocolClient ()=default
 

Public Member Functions inherited from Aws::Client::AWSClient

 AWSClient (const Aws::Client::ClientConfiguration &configuration, const std::shared_ptr< Aws::Client::AWSAuthSigner > &signer, const std::shared_ptr< AWSErrorMarshaller > &errorMarshaller)
 
 AWSClient (const Aws::Client::ClientConfiguration &configuration, const std::shared_ptr< Aws::Auth::AWSAuthSignerProvider > &signerProvider, const std::shared_ptr< AWSErrorMarshaller > &errorMarshaller)
 
virtual ~AWSClient ()
 
Aws::String GeneratePresignedUrl (const Aws::Http::URI &uri, Aws::Http::HttpMethod method, long long expirationInSeconds=0, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={})
 
Aws::String GeneratePresignedUrl (const Aws::Http::URI &uri, Aws::Http::HttpMethod method, const Aws::Http::HeaderValueCollection &customizedHeaders, long long expirationInSeconds=0, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={})
 
Aws::String GeneratePresignedUrl (const Aws::Http::URI &uri, Aws::Http::HttpMethod method, const char *region, long long expirationInSeconds=0, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={}) const
 
Aws::String GeneratePresignedUrl (const Aws::Http::URI &uri, Aws::Http::HttpMethod method, const char *region, const Aws::Http::HeaderValueCollection &customizedHeaders, long long expirationInSeconds=0, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={})
 
Aws::String GeneratePresignedUrl (const Aws::Http::URI &uri, Aws::Http::HttpMethod method, const char *region, const char *serviceName, long long expirationInSeconds=0, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={}) const
 
Aws::String GeneratePresignedUrl (const Aws::Http::URI &uri, Aws::Http::HttpMethod method, const char *region, const char *serviceName, const Aws::Http::HeaderValueCollection &customizedHeaders, long long expirationInSeconds=0, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={})
 
Aws::String GeneratePresignedUrl (const Aws::Http::URI &uri, Aws::Http::HttpMethod method, const char *region, const char *serviceName, const char *signerName, long long expirationInSeconds=0, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={}) const
 
Aws::String GeneratePresignedUrl (const Aws::Http::URI &uri, Aws::Http::HttpMethod method, const char *region, const char *serviceName, const char *signerName, const Aws::Http::HeaderValueCollection &customizedHeaders, long long expirationInSeconds=0, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={})
 
Aws::String GeneratePresignedUrl (const Aws::Endpoint::AWSEndpoint &endpoint, Aws::Http::HttpMethod method=Http::HttpMethod::HTTP_POST, const Aws::Http::HeaderValueCollection &customizedHeaders={}, uint64_t expirationInSeconds=0, const char *signerName=Aws::Auth::SIGV4_SIGNER, const char *signerRegionOverride=nullptr, const char *signerServiceNameOverride=nullptr, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={})
 
Aws::String GeneratePresignedUrl (const Aws::AmazonWebServiceRequest &request, const Aws::Http::URI &uri, Aws::Http::HttpMethod method, const Aws::Http::QueryStringParameterCollection &extraParams=Aws::Http::QueryStringParameterCollection(), long long expirationInSeconds=0, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={}) const
 
Aws::String GeneratePresignedUrl (const Aws::AmazonWebServiceRequest &request, const Aws::Http::URI &uri, Aws::Http::HttpMethod method, const char *region, const char *serviceName, const char *signerName, const Aws::Http::QueryStringParameterCollection &extraParams=Aws::Http::QueryStringParameterCollection(), long long expirationInSeconds=0, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={}) const
 
Aws::String GeneratePresignedUrl (const Aws::AmazonWebServiceRequest &request, const Aws::Http::URI &uri, Aws::Http::HttpMethod method, const char *region, const char *serviceName, const Aws::Http::QueryStringParameterCollection &extraParams=Aws::Http::QueryStringParameterCollection(), long long expirationInSeconds=0, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={}) const
 
Aws::String GeneratePresignedUrl (const Aws::AmazonWebServiceRequest &request, const Aws::Http::URI &uri, Aws::Http::HttpMethod method, const char *region, const Aws::Http::QueryStringParameterCollection &extraParams=Aws::Http::QueryStringParameterCollection(), long long expirationInSeconds=0, const std::shared_ptr< Aws::Http::ServiceSpecificParameters > serviceSpecificParameter={}) const
 
const std::shared_ptr< Aws::Http::HttpClient > & GetHttpClient () const
 
 
 
virtual const char * GetServiceClientName () const
 
virtual void SetServiceClientName (const Aws::String &name)
 
void AppendToUserAgent (const Aws::String &valueToAppend)
 
 
 
 
 
void SubmitAsync (OperationFuncT operationFunc, const RequestT &request, const HandlerT &handler, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr) const
 
void SubmitAsync (OperationFuncT operationFunc, RequestT &request, const HandlerT &handler, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr) const
 
void SubmitAsync (OperationFuncT operationFunc, const HandlerT &handler, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr) const
 
auto SubmitCallable (OperationFuncT operationFunc, const RequestT &request) const -> std::future< decltype((static_cast< const AwsServiceClientT * >(nullptr) -> *operationFunc)(request))>
 
auto SubmitCallable (OperationFuncT operationFunc, RequestT &request) const -> std::future< decltype((static_cast< const AwsServiceClientT * >(nullptr) -> *operationFunc)(request))>
 
auto SubmitCallable (OperationFuncT operationFunc) const -> std::future< decltype((static_cast< const AwsServiceClientT * >(nullptr) -> *operationFunc)())>
 

Static Public Member Functions

static const char * GetServiceName ()
 
static const char * GetAllocationTag ()
 

Static Public Member Functions inherited from Aws::Client::ClientWithAsyncTemplateMethods< BedrockRuntimeClient >

static void ShutdownSdkClient (void *pThis, int64_t timeoutMs=-1)
 

Friends

 

Additional Inherited Members

OutcomeType MakeRequest (const Aws::AmazonWebServiceRequest &request, const Aws::Endpoint::AWSEndpoint &endpoint, Http::HttpMethod method=Http::HttpMethod::HTTP_POST, const char *signerName=Aws::Auth::SIGV4_SIGNER, const char *signerRegionOverride=nullptr, const char *signerServiceNameOverride=nullptr) const
 
OutcomeType MakeRequest (const Aws::Endpoint::AWSEndpoint &endpoint, Http::HttpMethod method=Http::HttpMethod::HTTP_POST, const char *signerName=Aws::Auth::SIGV4_SIGNER, const char *signerRegionOverride=nullptr, const char *signerServiceNameOverride=nullptr) const
 
OutcomeType MakeRequest (const Aws::Http::URI &uri, const Aws::AmazonWebServiceRequest &request, Http::HttpMethod method=Http::HttpMethod::HTTP_POST, const char *signerName=Aws::Auth::SIGV4_SIGNER, const char *signerRegionOverride=nullptr, const char *signerServiceNameOverride=nullptr) const
 
OutcomeType MakeRequest (const Aws::Http::URI &uri, Http::HttpMethod method=Http::HttpMethod::HTTP_POST, const char *signerName=Aws::Auth::SIGV4_SIGNER, const char *requestName="", const char *signerRegionOverride=nullptr, const char *signerServiceNameOverride=nullptr) const
 
OutcomeType MakeEventStreamRequest (std::shared_ptr< Aws::Http::HttpRequest > &request) const
 
AWSError< CoreErrorsBuildAWSError (const std::shared_ptr< Aws::Http::HttpResponse > &httpResponse) const override
 

Protected Member Functions inherited from Aws::Client::AWSClient

HttpResponseOutcome AttemptExhaustively (const Aws::Http::URI &uri, const Aws::AmazonWebServiceRequest &request, Http::HttpMethod httpMethod, const char *signerName, const char *signerRegionOverride=nullptr, const char *signerServiceNameOverride=nullptr) const
 
HttpResponseOutcome AttemptExhaustively (const Aws::Http::URI &uri, Http::HttpMethod httpMethod, const char *signerName, const char *requestName="", const char *signerRegionOverride=nullptr, const char *signerServiceNameOverride=nullptr) const
 
HttpResponseOutcome AttemptOneRequest (const std::shared_ptr< Http::HttpRequest > &httpRequest, const Aws::AmazonWebServiceRequest &request, const char *signerName, const char *signerRegionOverride=nullptr, const char *signerServiceNameOverride=nullptr) const
 
HttpResponseOutcome AttemptOneRequest (const std::shared_ptr< Http::HttpRequest > &httpRequest, const char *signerName, const char *requestName="", const char *signerRegionOverride=nullptr, const char *signerServiceNameOverride=nullptr) const
 
StreamOutcome MakeRequestWithUnparsedResponse (const Aws::Http::URI &uri, const Aws::AmazonWebServiceRequest &request, Http::HttpMethod method=Http::HttpMethod::HTTP_POST, const char *signerName=Aws::Auth::SIGV4_SIGNER, const char *signerRegionOverride=nullptr, const char *signerServiceNameOverride=nullptr) const
 
StreamOutcome MakeRequestWithUnparsedResponse (const Aws::Http::URI &uri, Http::HttpMethod method=Http::HttpMethod::HTTP_POST, const char *signerName=Aws::Auth::SIGV4_SIGNER, const char *requestName="", const char *signerRegionOverride=nullptr, const char *signerServiceNameOverride=nullptr) const
 
StreamOutcome MakeRequestWithUnparsedResponse (const Aws::AmazonWebServiceRequest &request, const Aws::Endpoint::AWSEndpoint &endpoint, Http::HttpMethod method=Http::HttpMethod::HTTP_POST, const char *signerName=Aws::Auth::SIGV4_SIGNER, const char *signerRegionOverride=nullptr, const char *signerServiceNameOverride=nullptr) const
 
virtual void BuildHttpRequest (const Aws::AmazonWebServiceRequest &request, const std::shared_ptr< Aws::Http::HttpRequest > &httpRequest) const
 
virtual void AddContentLengthToRequest (const std::shared_ptr< Aws::Http::HttpRequest > &httpRequest, const std::shared_ptr< Aws::IOStream > &body, bool isChunked) const
 
const std::shared_ptr< AWSErrorMarshaller > & GetErrorMarshaller () const
 
Aws::Client::AWSAuthSignerGetSignerByName (const char *name) const
 
 
std::shared_ptr< Aws::Http::HttpRequestBuildAndSignHttpRequest (const Aws::Http::URI &uri, const Aws::AmazonWebServiceRequest &request, Http::HttpMethod method, const char *signerName) const
 
std::shared_ptr< Aws::Http::HttpResponseMakeHttpRequest (std::shared_ptr< Aws::Http::HttpRequest > &request) const
 

Static Protected Member Functions inherited from Aws::Client::AWSClient

static void AppendRecursionDetectionHeader (std::shared_ptr< Aws::Http::HttpRequest > ioRequest)
 
 
static bool DoesResponseGenerateError (const std::shared_ptr< Aws::Http::HttpResponse > &response)
 

Protected Attributes inherited from Aws::Client::AWSClient

 
 
 
std::atomic< bool > m_isInitialized
 
std::atomic< size_t > m_operationsProcessed
 
std::condition_variable m_shutdownSignal
 
std::mutex m_shutdownMutex
 

Detailed Description

Describes the API operations for running inference using Amazon Bedrock models.

Definition at line 22 of file BedrockRuntimeClient.h.

Member Typedef Documentation

◆ BASECLASS

Definition at line 25 of file BedrockRuntimeClient.h.

◆ ClientConfigurationType

Definition at line 29 of file BedrockRuntimeClient.h.

◆ EndpointProviderType

Definition at line 30 of file BedrockRuntimeClient.h.

Constructor & Destructor Documentation

◆ BedrockRuntimeClient() [1/6]

Aws::BedrockRuntime::BedrockRuntimeClient::BedrockRuntimeClient ( const Aws::BedrockRuntime::BedrockRuntimeClientConfiguration clientConfiguration = Aws::BedrockRuntime::BedrockRuntimeClientConfiguration(),
std::shared_ptr< BedrockRuntimeEndpointProviderBase endpointProvider = nullptr 
)

Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config is not specified, it will be initialized to default values.

◆ BedrockRuntimeClient() [2/6]

Aws::BedrockRuntime::BedrockRuntimeClient::BedrockRuntimeClient ( const Aws::Auth::AWSCredentials credentials,
std::shared_ptr< BedrockRuntimeEndpointProviderBase endpointProvider = nullptr,
const Aws::BedrockRuntime::BedrockRuntimeClientConfiguration clientConfiguration = Aws::BedrockRuntime::BedrockRuntimeClientConfiguration() 
)

Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config is not specified, it will be initialized to default values.

◆ BedrockRuntimeClient() [3/6]

Aws::BedrockRuntime::BedrockRuntimeClient::BedrockRuntimeClient ( const std::shared_ptr< Aws::Auth::AWSCredentialsProvider > &  credentialsProvider,
std::shared_ptr< BedrockRuntimeEndpointProviderBase endpointProvider = nullptr,
const Aws::BedrockRuntime::BedrockRuntimeClientConfiguration clientConfiguration = Aws::BedrockRuntime::BedrockRuntimeClientConfiguration() 
)

Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, the default http client factory will be used

◆ BedrockRuntimeClient() [4/6]

Aws::BedrockRuntime::BedrockRuntimeClient::BedrockRuntimeClient ( const Aws::Client::ClientConfiguration clientConfiguration)

Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config is not specified, it will be initialized to default values.

◆ BedrockRuntimeClient() [5/6]

Aws::BedrockRuntime::BedrockRuntimeClient::BedrockRuntimeClient ( const Aws::Auth::AWSCredentials credentials,
const Aws::Client::ClientConfiguration clientConfiguration 
)

Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config is not specified, it will be initialized to default values.

◆ BedrockRuntimeClient() [6/6]

Aws::BedrockRuntime::BedrockRuntimeClient::BedrockRuntimeClient ( const std::shared_ptr< Aws::Auth::AWSCredentialsProvider > &  credentialsProvider,
const Aws::Client::ClientConfiguration clientConfiguration 
)

Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, the default http client factory will be used

◆ ~BedrockRuntimeClient()

virtual Aws::BedrockRuntime::BedrockRuntimeClient::~BedrockRuntimeClient ( )
virtual

Member Function Documentation

◆ accessEndpointProvider()

std::shared_ptr< BedrockRuntimeEndpointProviderBase > & Aws::BedrockRuntime::BedrockRuntimeClient::accessEndpointProvider ( )

◆ ApplyGuardrail()

virtual Model::ApplyGuardrailOutcome Aws::BedrockRuntime::BedrockRuntimeClient::ApplyGuardrail ( const Model::ApplyGuardrailRequest request) const
virtual

The action to apply a guardrail.

For troubleshooting some of the common errors you might encounter when using the ApplyGuardrail API, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide

See Also:

AWS API Reference

◆ ApplyGuardrailAsync()

template<typename ApplyGuardrailRequestT = Model::ApplyGuardrailRequest>
void Aws::BedrockRuntime::BedrockRuntimeClient::ApplyGuardrailAsync ( const ApplyGuardrailRequestT &  request,
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
) const
inline

An Async wrapper for ApplyGuardrail that queues the request into a thread executor and triggers associated callback when operation has finished.

Definition at line 105 of file BedrockRuntimeClient.h.

◆ ApplyGuardrailCallable()

template<typename ApplyGuardrailRequestT = Model::ApplyGuardrailRequest>
Model::ApplyGuardrailOutcomeCallable Aws::BedrockRuntime::BedrockRuntimeClient::ApplyGuardrailCallable ( const ApplyGuardrailRequestT &  request) const
inline

A Callable wrapper for ApplyGuardrail that returns a future to the operation so that it can be executed in parallel to other requests.

Definition at line 96 of file BedrockRuntimeClient.h.

◆ Converse()

virtual Model::ConverseOutcome Aws::BedrockRuntime::BedrockRuntimeClient::Converse ( const Model::ConverseRequest request) const
virtual

Sends messages to the specified Amazon Bedrock model. Converse provides a consistent interface that works with all models that support messages. This allows you to write code once and use it with different models. If a model has unique inference parameters, you can also pass those unique parameters to the model.

Amazon Bedrock doesn't store any text, images, or documents that you provide as content. The data is only used to generate the response.

You can submit a prompt by including it in the messages field, specifying the modelId of a foundation model or inference profile to run inference on it, and including any other fields that are relevant to your use case.

You can also submit a prompt from Prompt management by specifying the ARN of the prompt version and including a map of variables to values in the promptVariables field. You can append more messages to the prompt by using the messages field. If you use a prompt from Prompt management, you can't include the following fields in the request: additionalModelRequestFields, inferenceConfig, system, or toolConfig. Instead, these fields must be defined through Prompt management. For more information, see Use a prompt from Prompt management.

For information about the Converse API, see Use the Converse API in the Amazon Bedrock User Guide. To use a guardrail, see Use a guardrail with the Converse API in the Amazon Bedrock User Guide. To use a tool with a model, see Tool use (Function calling) in the Amazon Bedrock User Guide

For example code, see Converse API examples in the Amazon Bedrock User Guide.

This operation requires permission for the bedrock:InvokeModel action.

To deny all inference access to resources that you specify in the modelId field, you need to deny access to the bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream actions. Doing this also denies access to the resource through the base inference actions (InvokeModel and InvokeModelWithResponseStream). For more information see Deny access for inference on specific models.

For troubleshooting some of the common errors you might encounter when using the Converse API, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide

See Also:

AWS API Reference

◆ ConverseAsync()

template<typename ConverseRequestT = Model::ConverseRequest>
void Aws::BedrockRuntime::BedrockRuntimeClient::ConverseAsync ( const ConverseRequestT &  request,
const ConverseResponseReceivedHandler handler,
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
) const
inline

An Async wrapper for Converse that queues the request into a thread executor and triggers associated callback when operation has finished.

Definition at line 171 of file BedrockRuntimeClient.h.

◆ ConverseCallable()

template<typename ConverseRequestT = Model::ConverseRequest>
Model::ConverseOutcomeCallable Aws::BedrockRuntime::BedrockRuntimeClient::ConverseCallable ( const ConverseRequestT &  request) const
inline

A Callable wrapper for Converse that returns a future to the operation so that it can be executed in parallel to other requests.

Definition at line 162 of file BedrockRuntimeClient.h.

◆ ConverseStream()

virtual Model::ConverseStreamOutcome Aws::BedrockRuntime::BedrockRuntimeClient::ConverseStream ( Model::ConverseStreamRequest request) const
virtual

Sends messages to the specified Amazon Bedrock model and returns the response in a stream. ConverseStream provides a consistent API that works with all Amazon Bedrock models that support messages. This allows you to write code once and use it with different models. Should a model have unique inference parameters, you can also pass those unique parameters to the model.

To find out if a model supports streaming, call GetFoundationModel and check the responseStreamingSupported field in the response.

The CLI doesn't support streaming operations in Amazon Bedrock, including ConverseStream.

Amazon Bedrock doesn't store any text, images, or documents that you provide as content. The data is only used to generate the response.

You can submit a prompt by including it in the messages field, specifying the modelId of a foundation model or inference profile to run inference on it, and including any other fields that are relevant to your use case.

You can also submit a prompt from Prompt management by specifying the ARN of the prompt version and including a map of variables to values in the promptVariables field. You can append more messages to the prompt by using the messages field. If you use a prompt from Prompt management, you can't include the following fields in the request: additionalModelRequestFields, inferenceConfig, system, or toolConfig. Instead, these fields must be defined through Prompt management. For more information, see Use a prompt from Prompt management.

For information about the Converse API, see Use the Converse API in the Amazon Bedrock User Guide. To use a guardrail, see Use a guardrail with the Converse API in the Amazon Bedrock User Guide. To use a tool with a model, see Tool use (Function calling) in the Amazon Bedrock User Guide

For example code, see Conversation streaming example in the Amazon Bedrock User Guide.

This operation requires permission for the bedrock:InvokeModelWithResponseStream action.

To deny all inference access to resources that you specify in the modelId field, you need to deny access to the bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream actions. Doing this also denies access to the resource through the base inference actions (InvokeModel and InvokeModelWithResponseStream). For more information see Deny access for inference on specific models.

For troubleshooting some of the common errors you might encounter when using the ConverseStream API, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide

See Also:

AWS API Reference

◆ ConverseStreamAsync()

template<typename ConverseStreamRequestT = Model::ConverseStreamRequest>
void Aws::BedrockRuntime::BedrockRuntimeClient::ConverseStreamAsync ( ConverseStreamRequestT &  request,
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
) const
inline

An Async wrapper for ConverseStream that queues the request into a thread executor and triggers associated callback when operation has finished.

Definition at line 242 of file BedrockRuntimeClient.h.

◆ ConverseStreamCallable()

template<typename ConverseStreamRequestT = Model::ConverseStreamRequest>
Model::ConverseStreamOutcomeCallable Aws::BedrockRuntime::BedrockRuntimeClient::ConverseStreamCallable ( ConverseStreamRequestT &  request) const
inline

A Callable wrapper for ConverseStream that returns a future to the operation so that it can be executed in parallel to other requests.

Definition at line 233 of file BedrockRuntimeClient.h.

◆ CountTokens()

virtual Model::CountTokensOutcome Aws::BedrockRuntime::BedrockRuntimeClient::CountTokens ( const Model::CountTokensRequest request) const
virtual

Returns the token count for a given inference request. This operation helps you estimate token usage before sending requests to foundation models by returning the token count that would be used if the same input were sent to the model in an inference request.

Token counting is model-specific because different models use different tokenization strategies. The token count returned by this operation will match the token count that would be charged if the same input were sent to the model in an InvokeModel or Converse request.

You can use this operation to:

  • Estimate costs before sending inference requests.

  • Optimize prompts to fit within token limits.

  • Plan for token usage in your applications.

This operation accepts the same input formats as InvokeModel and Converse, allowing you to count tokens for both raw text inputs and structured conversation formats.

The following operations are related to CountTokens:

  • InvokeModel

    • Sends inference requests to foundation models

  • Converse

    • Sends conversation-based inference requests to foundation models

See Also:

AWS API Reference

◆ CountTokensAsync()

template<typename CountTokensRequestT = Model::CountTokensRequest>
void Aws::BedrockRuntime::BedrockRuntimeClient::CountTokensAsync ( const CountTokensRequestT &  request,
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
) const
inline

An Async wrapper for CountTokens that queues the request into a thread executor and triggers associated callback when operation has finished.

Definition at line 286 of file BedrockRuntimeClient.h.

◆ CountTokensCallable()

template<typename CountTokensRequestT = Model::CountTokensRequest>
Model::CountTokensOutcomeCallable Aws::BedrockRuntime::BedrockRuntimeClient::CountTokensCallable ( const CountTokensRequestT &  request) const
inline

A Callable wrapper for CountTokens that returns a future to the operation so that it can be executed in parallel to other requests.

Definition at line 277 of file BedrockRuntimeClient.h.

◆ GetAllocationTag()

static const char * Aws::BedrockRuntime::BedrockRuntimeClient::GetAllocationTag ( )
static

◆ GetAsyncInvoke()

virtual Model::GetAsyncInvokeOutcome Aws::BedrockRuntime::BedrockRuntimeClient::GetAsyncInvoke ( const Model::GetAsyncInvokeRequest request) const
virtual

Retrieve information about an asynchronous invocation.

See Also:

AWS API Reference

◆ GetAsyncInvokeAsync()

template<typename GetAsyncInvokeRequestT = Model::GetAsyncInvokeRequest>
void Aws::BedrockRuntime::BedrockRuntimeClient::GetAsyncInvokeAsync ( const GetAsyncInvokeRequestT &  request,
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
) const
inline

An Async wrapper for GetAsyncInvoke that queues the request into a thread executor and triggers associated callback when operation has finished.

Definition at line 312 of file BedrockRuntimeClient.h.

◆ GetAsyncInvokeCallable()

template<typename GetAsyncInvokeRequestT = Model::GetAsyncInvokeRequest>
Model::GetAsyncInvokeOutcomeCallable Aws::BedrockRuntime::BedrockRuntimeClient::GetAsyncInvokeCallable ( const GetAsyncInvokeRequestT &  request) const
inline

A Callable wrapper for GetAsyncInvoke that returns a future to the operation so that it can be executed in parallel to other requests.

Definition at line 303 of file BedrockRuntimeClient.h.

◆ GetServiceName()

static const char * Aws::BedrockRuntime::BedrockRuntimeClient::GetServiceName ( )
static

◆ InvokeModel()

virtual Model::InvokeModelOutcome Aws::BedrockRuntime::BedrockRuntimeClient::InvokeModel ( const Model::InvokeModelRequest request) const
virtual

Invokes the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body. You use model inference to generate text, images, and embeddings.

For example code, see Invoke model code examples in the Amazon Bedrock User Guide.

This operation requires permission for the bedrock:InvokeModel action.

To deny all inference access to resources that you specify in the modelId field, you need to deny access to the bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream actions. Doing this also denies access to the resource through the Converse API actions (Converse and ConverseStream). For more information see Deny access for inference on specific models.

For troubleshooting some of the common errors you might encounter when using the InvokeModel API, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide

See Also:

AWS API Reference

◆ InvokeModelAsync()

template<typename InvokeModelRequestT = Model::InvokeModelRequest>
void Aws::BedrockRuntime::BedrockRuntimeClient::InvokeModelAsync ( const InvokeModelRequestT &  request,
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
) const
inline

An Async wrapper for InvokeModel that queues the request into a thread executor and triggers associated callback when operation has finished.

Definition at line 357 of file BedrockRuntimeClient.h.

◆ InvokeModelCallable()

template<typename InvokeModelRequestT = Model::InvokeModelRequest>
Model::InvokeModelOutcomeCallable Aws::BedrockRuntime::BedrockRuntimeClient::InvokeModelCallable ( const InvokeModelRequestT &  request) const
inline

A Callable wrapper for InvokeModel that returns a future to the operation so that it can be executed in parallel to other requests.

Definition at line 348 of file BedrockRuntimeClient.h.

◆ InvokeModelWithBidirectionalStreamAsync()

virtual void Aws::BedrockRuntime::BedrockRuntimeClient::InvokeModelWithBidirectionalStreamAsync ( Model::InvokeModelWithBidirectionalStreamRequest request,
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  handlerContext = nullptr 
) const
virtual

Invoke the specified Amazon Bedrock model to run inference using the bidirectional stream. The response is returned in a stream that remains open for 8 minutes. A single session can contain multiple prompts and responses from the model. The prompts to the model are provided as audio files and the model's responses are spoken back to the user and transcribed.

It is possible for users to interrupt the model's response with a new prompt, which will halt the response speech. The model will retain contextual awareness of the conversation while pivoting to respond to the new prompt.

See Also:

AWS API Reference

Queues the request into a thread executor. The streamReadyHandler is triggered when the stream is ready to be written to. The handler is triggered when the request is finished.

◆ InvokeModelWithResponseStream()

virtual Model::InvokeModelWithResponseStreamOutcome Aws::BedrockRuntime::BedrockRuntimeClient::InvokeModelWithResponseStream ( Model::InvokeModelWithResponseStreamRequest request) const
virtual

Invoke the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body. The response is returned in a stream.

To see if a model supports streaming, call GetFoundationModel and check the responseStreamingSupported field in the response.

The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeModelWithResponseStream.

For example code, see Invoke model with streaming code example in the Amazon Bedrock User Guide.

This operation requires permissions to perform the bedrock:InvokeModelWithResponseStream action.

To deny all inference access to resources that you specify in the modelId field, you need to deny access to the bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream actions. Doing this also denies access to the resource through the Converse API actions (Converse and ConverseStream). For more information see Deny access for inference on specific models.

For troubleshooting some of the common errors you might encounter when using the InvokeModelWithResponseStream API, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide

See Also:

AWS API Reference

◆ InvokeModelWithResponseStreamAsync()

template<typename InvokeModelWithResponseStreamRequestT = Model::InvokeModelWithResponseStreamRequest>
void Aws::BedrockRuntime::BedrockRuntimeClient::InvokeModelWithResponseStreamAsync ( InvokeModelWithResponseStreamRequestT &  request,
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
) const
inline

An Async wrapper for InvokeModelWithResponseStream that queues the request into a thread executor and triggers associated callback when operation has finished.

Definition at line 427 of file BedrockRuntimeClient.h.

◆ InvokeModelWithResponseStreamCallable()

template<typename InvokeModelWithResponseStreamRequestT = Model::InvokeModelWithResponseStreamRequest>
Model::InvokeModelWithResponseStreamOutcomeCallable Aws::BedrockRuntime::BedrockRuntimeClient::InvokeModelWithResponseStreamCallable ( InvokeModelWithResponseStreamRequestT &  request) const
inline

A Callable wrapper for InvokeModelWithResponseStream that returns a future to the operation so that it can be executed in parallel to other requests.

Definition at line 418 of file BedrockRuntimeClient.h.

◆ ListAsyncInvokes()

virtual Model::ListAsyncInvokesOutcome Aws::BedrockRuntime::BedrockRuntimeClient::ListAsyncInvokes ( const Model::ListAsyncInvokesRequest request = {}) const
virtual

Lists asynchronous invocations.

See Also:

AWS API Reference

◆ ListAsyncInvokesAsync()

template<typename ListAsyncInvokesRequestT = Model::ListAsyncInvokesRequest>
void Aws::BedrockRuntime::BedrockRuntimeClient::ListAsyncInvokesAsync ( const ListAsyncInvokesResponseReceivedHandler handler,
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr,
const ListAsyncInvokesRequestT &  request = {} 
) const
inline

An Async wrapper for ListAsyncInvokes that queues the request into a thread executor and triggers associated callback when operation has finished.

Definition at line 452 of file BedrockRuntimeClient.h.

◆ ListAsyncInvokesCallable()

template<typename ListAsyncInvokesRequestT = Model::ListAsyncInvokesRequest>
Model::ListAsyncInvokesOutcomeCallable Aws::BedrockRuntime::BedrockRuntimeClient::ListAsyncInvokesCallable ( const ListAsyncInvokesRequestT &  request = {}) const
inline

A Callable wrapper for ListAsyncInvokes that returns a future to the operation so that it can be executed in parallel to other requests.

Definition at line 443 of file BedrockRuntimeClient.h.

◆ OverrideEndpoint()

void Aws::BedrockRuntime::BedrockRuntimeClient::OverrideEndpoint ( const Aws::String endpoint)

◆ StartAsyncInvoke()

virtual Model::StartAsyncInvokeOutcome Aws::BedrockRuntime::BedrockRuntimeClient::StartAsyncInvoke ( const Model::StartAsyncInvokeRequest request) const
virtual

Starts an asynchronous invocation.

This operation requires permission for the bedrock:InvokeModel action.

To deny all inference access to resources that you specify in the modelId field, you need to deny access to the bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream actions. Doing this also denies access to the resource through the Converse API actions (Converse and ConverseStream). For more information see Deny access for inference on specific models.

See Also:

AWS API Reference

◆ StartAsyncInvokeAsync()

template<typename StartAsyncInvokeRequestT = Model::StartAsyncInvokeRequest>
void Aws::BedrockRuntime::BedrockRuntimeClient::StartAsyncInvokeAsync ( const StartAsyncInvokeRequestT &  request,
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
) const
inline

An Async wrapper for StartAsyncInvoke that queues the request into a thread executor and triggers associated callback when operation has finished.

Definition at line 489 of file BedrockRuntimeClient.h.

◆ StartAsyncInvokeCallable()

template<typename StartAsyncInvokeRequestT = Model::StartAsyncInvokeRequest>
Model::StartAsyncInvokeOutcomeCallable Aws::BedrockRuntime::BedrockRuntimeClient::StartAsyncInvokeCallable ( const StartAsyncInvokeRequestT &  request) const
inline

A Callable wrapper for StartAsyncInvoke that returns a future to the operation so that it can be executed in parallel to other requests.

Definition at line 480 of file BedrockRuntimeClient.h.

Friends And Related Symbol Documentation

◆ Aws::Client::ClientWithAsyncTemplateMethods< BedrockRuntimeClient >

Definition at line 496 of file BedrockRuntimeClient.h.


The documentation for this class was generated from the following file: