@ThreadSafe @Generated(value="com.amazonaws:aws-java-sdk-code-generator") public class AmazonBedrockRuntimeAsyncClient extends AmazonBedrockRuntimeClient implements AmazonBedrockRuntimeAsync
AsyncHandler
can be used to receive
notification when an asynchronous operation completes.
Describes the API operations for running inference using Amazon Bedrock models.
LOGGING_AWS_REQUEST_METRIC
ENDPOINT_PREFIX
Modifier and Type | Method and Description |
---|---|
Future<ApplyGuardrailResult> |
applyGuardrailAsync(ApplyGuardrailRequest request)
The action to apply a guardrail.
|
Future<ApplyGuardrailResult> |
applyGuardrailAsync(ApplyGuardrailRequest request,
AsyncHandler<ApplyGuardrailRequest,ApplyGuardrailResult> asyncHandler)
The action to apply a guardrail.
|
static AmazonBedrockRuntimeAsyncClientBuilder |
asyncBuilder() |
Future<ConverseResult> |
converseAsync(ConverseRequest request)
Sends messages to the specified Amazon Bedrock model.
|
Future<ConverseResult> |
converseAsync(ConverseRequest request,
AsyncHandler<ConverseRequest,ConverseResult> asyncHandler)
Sends messages to the specified Amazon Bedrock model.
|
ExecutorService |
getExecutorService()
Returns the executor service used by this client to execute async requests.
|
Future<InvokeModelResult> |
invokeModelAsync(InvokeModelRequest request)
Invokes the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in
the request body.
|
Future<InvokeModelResult> |
invokeModelAsync(InvokeModelRequest request,
AsyncHandler<InvokeModelRequest,InvokeModelResult> asyncHandler)
Invokes the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in
the request body.
|
void |
shutdown()
Shuts down the client, releasing all managed resources.
|
applyGuardrail, builder, converse, getCachedResponseMetadata, invokeModel
addRequestHandler, addRequestHandler, configureRegion, getClientConfiguration, getEndpointPrefix, getMonitoringListeners, getRequestMetricsCollector, getServiceName, getSignerByURI, getSignerOverride, getSignerRegionOverride, getTimeOffset, makeImmutable, removeRequestHandler, removeRequestHandler, setEndpoint, setEndpoint, setRegion, setServiceNameIntern, setSignerRegionOverride, setTimeOffset, withEndpoint, withRegion, withRegion, withTimeOffset
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyGuardrail, converse, getCachedResponseMetadata, invokeModel
public static AmazonBedrockRuntimeAsyncClientBuilder asyncBuilder()
public ExecutorService getExecutorService()
public Future<ApplyGuardrailResult> applyGuardrailAsync(ApplyGuardrailRequest request)
AmazonBedrockRuntimeAsync
The action to apply a guardrail.
applyGuardrailAsync
in interface AmazonBedrockRuntimeAsync
public Future<ApplyGuardrailResult> applyGuardrailAsync(ApplyGuardrailRequest request, AsyncHandler<ApplyGuardrailRequest,ApplyGuardrailResult> asyncHandler)
AmazonBedrockRuntimeAsync
The action to apply a guardrail.
applyGuardrailAsync
in interface AmazonBedrockRuntimeAsync
asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
implementation of the callback methods in this interface to receive notification of successful or
unsuccessful completion of the operation.public Future<ConverseResult> converseAsync(ConverseRequest request)
AmazonBedrockRuntimeAsync
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.
converseAsync
in interface AmazonBedrockRuntimeAsync
public Future<ConverseResult> converseAsync(ConverseRequest request, AsyncHandler<ConverseRequest,ConverseResult> asyncHandler)
AmazonBedrockRuntimeAsync
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.
converseAsync
in interface AmazonBedrockRuntimeAsync
asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
implementation of the callback methods in this interface to receive notification of successful or
unsuccessful completion of the operation.public Future<InvokeModelResult> invokeModelAsync(InvokeModelRequest request)
AmazonBedrockRuntimeAsync
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.
invokeModelAsync
in interface AmazonBedrockRuntimeAsync
public Future<InvokeModelResult> invokeModelAsync(InvokeModelRequest request, AsyncHandler<InvokeModelRequest,InvokeModelResult> asyncHandler)
AmazonBedrockRuntimeAsync
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.
invokeModelAsync
in interface AmazonBedrockRuntimeAsync
asyncHandler
- Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
implementation of the callback methods in this interface to receive notification of successful or
unsuccessful completion of the operation.public void shutdown()
getExecutorService().shutdown()
followed by getExecutorService().awaitTermination()
prior to
calling this method.shutdown
in interface AmazonBedrockRuntime
shutdown
in class AmazonBedrockRuntimeClient