AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

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.

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.

Note:

This is an asynchronous operation using the standard naming convention for .NET 4.5 or higher. For .NET 3.5 the operation is implemented as a pair of methods using the standard naming convention of BeginConverse and EndConverse.

Namespace: Amazon.BedrockRuntime
Assembly: AWSSDK.BedrockRuntime.dll
Version: 3.x.y.z

Syntax

C#
public abstract Task<ConverseResponse> ConverseAsync(
         ConverseRequest request,
         CancellationToken cancellationToken
)

Parameters

request
Type: Amazon.BedrockRuntime.Model.ConverseRequest

Container for the necessary parameters to execute the Converse service method.

cancellationToken
Type: System.Threading.CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Return Value


The response from the Converse service method, as returned by BedrockRuntime.

Exceptions

ExceptionCondition
AccessDeniedException The request is denied because of missing access permissions.
InternalServerException An internal server error occurred. Retry your request.
ModelErrorException The request failed due to an error while processing the model.
ModelNotReadyException The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see Retry behavior in the AWS SDKs and Tools reference guide.
ModelTimeoutException The request took too long to process. Processing time exceeded the model timeout length.
ResourceNotFoundException The specified resource ARN was not found. Check the ARN and try your request again.
ServiceUnavailableException The service isn't currently available. Try again later.
ThrottlingException Your request was throttled because of service-wide limitations. Resubmit your request later or in a different region. You can also purchase Provisioned Throughput to increase the rate or number of tokens you can process.
ValidationException Input validation failed. Check your request parameters and retry the request.

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer

See Also