AWS SDK for C++AWS SDK for C++ Version 1.11.645 |
#include <BedrockRuntimeClient.h>
Describes the API operations for running inference using Amazon Bedrock models.
Definition at line 22 of file BedrockRuntimeClient.h.
Definition at line 25 of file BedrockRuntimeClient.h.
Definition at line 29 of file BedrockRuntimeClient.h.
Definition at line 30 of file BedrockRuntimeClient.h.
Aws::BedrockRuntime::BedrockRuntimeClientConfiguration()
,
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.
nullptr
,
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.
nullptr
,
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
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.
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.
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
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
nullptr
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.
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.
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
nullptr
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.
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.
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
nullptr
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.
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.
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
:
nullptr
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.
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.
nullptr
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.
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.
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
nullptr
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.
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.
nullptr
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.
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.
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
nullptr
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.
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.
{}
)
const
nullptr
,
{}
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.
{}
)
const
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.
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.
nullptr
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.
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.
Definition at line 496 of file BedrockRuntimeClient.h.