Interface BedrockAgentRuntimeAsyncClient
-
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
@Generated("software.amazon.awssdk:codegen") @ThreadSafe public interface BedrockAgentRuntimeAsyncClient extends AwsClient
Service client for accessing Agents for Amazon Bedrock Runtime asynchronously. This can be created using the staticbuilder()method.The asynchronous client performs non-blocking I/O when configured with anySdkAsyncHttpClientsupported in the SDK. However, full non-blocking is not guaranteed as the async client may perform blocking calls in some cases such as credentials retrieval and endpoint discovery as part of the async API call.Contains APIs related to model invocation and querying of knowledge bases.
-
-
Field Summary
Fields Modifier and Type Field Description static StringSERVICE_METADATA_IDValue for looking up the service's metadata from theServiceMetadataProvider.static StringSERVICE_NAME
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description static BedrockAgentRuntimeAsyncClientBuilderbuilder()Create a builder that can be used to configure and create aBedrockAgentRuntimeAsyncClient.static BedrockAgentRuntimeAsyncClientcreate()Create aBedrockAgentRuntimeAsyncClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.default CompletableFuture<DeleteAgentMemoryResponse>deleteAgentMemory(Consumer<DeleteAgentMemoryRequest.Builder> deleteAgentMemoryRequest)Deletes memory from the specified memory identifier.default CompletableFuture<DeleteAgentMemoryResponse>deleteAgentMemory(DeleteAgentMemoryRequest deleteAgentMemoryRequest)Deletes memory from the specified memory identifier.default CompletableFuture<GenerateQueryResponse>generateQuery(Consumer<GenerateQueryRequest.Builder> generateQueryRequest)Generates an SQL query from a natural language query.default CompletableFuture<GenerateQueryResponse>generateQuery(GenerateQueryRequest generateQueryRequest)Generates an SQL query from a natural language query.default CompletableFuture<GetAgentMemoryResponse>getAgentMemory(Consumer<GetAgentMemoryRequest.Builder> getAgentMemoryRequest)Gets the sessions stored in the memory of the agent.default CompletableFuture<GetAgentMemoryResponse>getAgentMemory(GetAgentMemoryRequest getAgentMemoryRequest)Gets the sessions stored in the memory of the agent.default GetAgentMemoryPublishergetAgentMemoryPaginator(Consumer<GetAgentMemoryRequest.Builder> getAgentMemoryRequest)This is a variant ofgetAgentMemory(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryRequest)operation.default GetAgentMemoryPublishergetAgentMemoryPaginator(GetAgentMemoryRequest getAgentMemoryRequest)This is a variant ofgetAgentMemory(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryRequest)operation.default CompletableFuture<Void>invokeAgent(Consumer<InvokeAgentRequest.Builder> invokeAgentRequest, InvokeAgentResponseHandler asyncResponseHandler)default CompletableFuture<Void>invokeAgent(InvokeAgentRequest invokeAgentRequest, InvokeAgentResponseHandler asyncResponseHandler)default CompletableFuture<Void>invokeFlow(Consumer<InvokeFlowRequest.Builder> invokeFlowRequest, InvokeFlowResponseHandler asyncResponseHandler)Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream.default CompletableFuture<Void>invokeFlow(InvokeFlowRequest invokeFlowRequest, InvokeFlowResponseHandler asyncResponseHandler)Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream.default CompletableFuture<Void>invokeInlineAgent(Consumer<InvokeInlineAgentRequest.Builder> invokeInlineAgentRequest, InvokeInlineAgentResponseHandler asyncResponseHandler)Invokes an inline Amazon Bedrock agent using the configurations you provide with the request.default CompletableFuture<Void>invokeInlineAgent(InvokeInlineAgentRequest invokeInlineAgentRequest, InvokeInlineAgentResponseHandler asyncResponseHandler)Invokes an inline Amazon Bedrock agent using the configurations you provide with the request.default CompletableFuture<Void>optimizePrompt(Consumer<OptimizePromptRequest.Builder> optimizePromptRequest, OptimizePromptResponseHandler asyncResponseHandler)Optimizes a prompt for the task that you specify.default CompletableFuture<Void>optimizePrompt(OptimizePromptRequest optimizePromptRequest, OptimizePromptResponseHandler asyncResponseHandler)Optimizes a prompt for the task that you specify.default CompletableFuture<RerankResponse>rerank(Consumer<RerankRequest.Builder> rerankRequest)Reranks the relevance of sources based on queries.default CompletableFuture<RerankResponse>rerank(RerankRequest rerankRequest)Reranks the relevance of sources based on queries.default RerankPublisherrerankPaginator(Consumer<RerankRequest.Builder> rerankRequest)This is a variant ofrerank(software.amazon.awssdk.services.bedrockagentruntime.model.RerankRequest)operation.default RerankPublisherrerankPaginator(RerankRequest rerankRequest)This is a variant ofrerank(software.amazon.awssdk.services.bedrockagentruntime.model.RerankRequest)operation.default CompletableFuture<RetrieveResponse>retrieve(Consumer<RetrieveRequest.Builder> retrieveRequest)Queries a knowledge base and retrieves information from it.default CompletableFuture<RetrieveResponse>retrieve(RetrieveRequest retrieveRequest)Queries a knowledge base and retrieves information from it.default CompletableFuture<RetrieveAndGenerateResponse>retrieveAndGenerate(Consumer<RetrieveAndGenerateRequest.Builder> retrieveAndGenerateRequest)Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile.default CompletableFuture<RetrieveAndGenerateResponse>retrieveAndGenerate(RetrieveAndGenerateRequest retrieveAndGenerateRequest)Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile.default CompletableFuture<Void>retrieveAndGenerateStream(Consumer<RetrieveAndGenerateStreamRequest.Builder> retrieveAndGenerateStreamRequest, RetrieveAndGenerateStreamResponseHandler asyncResponseHandler)Queries a knowledge base and generates responses based on the retrieved results, with output in streaming format.default CompletableFuture<Void>retrieveAndGenerateStream(RetrieveAndGenerateStreamRequest retrieveAndGenerateStreamRequest, RetrieveAndGenerateStreamResponseHandler asyncResponseHandler)Queries a knowledge base and generates responses based on the retrieved results, with output in streaming format.default RetrievePublisherretrievePaginator(Consumer<RetrieveRequest.Builder> retrieveRequest)This is a variant ofretrieve(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveRequest)operation.default RetrievePublisherretrievePaginator(RetrieveRequest retrieveRequest)This is a variant ofretrieve(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveRequest)operation.default BedrockAgentRuntimeServiceClientConfigurationserviceClientConfiguration()-
Methods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
close
-
Methods inherited from interface software.amazon.awssdk.core.SdkClient
serviceName
-
-
-
-
Field Detail
-
SERVICE_NAME
static final String SERVICE_NAME
- See Also:
- Constant Field Values
-
SERVICE_METADATA_ID
static final String SERVICE_METADATA_ID
Value for looking up the service's metadata from theServiceMetadataProvider.- See Also:
- Constant Field Values
-
-
Method Detail
-
deleteAgentMemory
default CompletableFuture<DeleteAgentMemoryResponse> deleteAgentMemory(DeleteAgentMemoryRequest deleteAgentMemoryRequest)
Deletes memory from the specified memory identifier.
- Parameters:
deleteAgentMemoryRequest-- Returns:
- A Java Future containing the result of the DeleteAgentMemory operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
deleteAgentMemory
default CompletableFuture<DeleteAgentMemoryResponse> deleteAgentMemory(Consumer<DeleteAgentMemoryRequest.Builder> deleteAgentMemoryRequest)
Deletes memory from the specified memory identifier.
This is a convenience which creates an instance of the
DeleteAgentMemoryRequest.Builderavoiding the need to create one manually viaDeleteAgentMemoryRequest.builder()- Parameters:
deleteAgentMemoryRequest- AConsumerthat will call methods onDeleteAgentMemoryRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the DeleteAgentMemory operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
generateQuery
default CompletableFuture<GenerateQueryResponse> generateQuery(GenerateQueryRequest generateQueryRequest)
Generates an SQL query from a natural language query. For more information, see Generate a query for structured data in the Amazon Bedrock User Guide.
- Parameters:
generateQueryRequest-- Returns:
- A Java Future containing the result of the GenerateQuery operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
generateQuery
default CompletableFuture<GenerateQueryResponse> generateQuery(Consumer<GenerateQueryRequest.Builder> generateQueryRequest)
Generates an SQL query from a natural language query. For more information, see Generate a query for structured data in the Amazon Bedrock User Guide.
This is a convenience which creates an instance of the
GenerateQueryRequest.Builderavoiding the need to create one manually viaGenerateQueryRequest.builder()- Parameters:
generateQueryRequest- AConsumerthat will call methods onGenerateQueryRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the GenerateQuery operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
getAgentMemory
default CompletableFuture<GetAgentMemoryResponse> getAgentMemory(GetAgentMemoryRequest getAgentMemoryRequest)
Gets the sessions stored in the memory of the agent.
- Parameters:
getAgentMemoryRequest-- Returns:
- A Java Future containing the result of the GetAgentMemory operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
getAgentMemory
default CompletableFuture<GetAgentMemoryResponse> getAgentMemory(Consumer<GetAgentMemoryRequest.Builder> getAgentMemoryRequest)
Gets the sessions stored in the memory of the agent.
This is a convenience which creates an instance of the
GetAgentMemoryRequest.Builderavoiding the need to create one manually viaGetAgentMemoryRequest.builder()- Parameters:
getAgentMemoryRequest- AConsumerthat will call methods onGetAgentMemoryRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the GetAgentMemory operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
getAgentMemoryPaginator
default GetAgentMemoryPublisher getAgentMemoryPaginator(GetAgentMemoryRequest getAgentMemoryRequest)
This is a variant of
getAgentMemory(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryRequest)operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see
Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a newSubscriptioni.e., a new contract to stream data from the starting request.The following are few ways to use the response class:
1) Using the subscribe helper method
2) Using a custom subscribersoftware.amazon.awssdk.services.bedrockagentruntime.paginators.GetAgentMemoryPublisher publisher = client.getAgentMemoryPaginator(request); CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response }); future.get();
As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.software.amazon.awssdk.services.bedrockagentruntime.paginators.GetAgentMemoryPublisher publisher = client.getAgentMemoryPaginator(request); publisher.subscribe(new Subscriber<software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryResponse>() { public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... }; public void onNext(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryResponse response) { //... }; });Please notice that the configuration of maxItems won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
getAgentMemory(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryRequest)operation.- Parameters:
getAgentMemoryRequest-- Returns:
- A custom publisher that can be subscribed to request a stream of response pages.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
getAgentMemoryPaginator
default GetAgentMemoryPublisher getAgentMemoryPaginator(Consumer<GetAgentMemoryRequest.Builder> getAgentMemoryRequest)
This is a variant of
getAgentMemory(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryRequest)operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see
Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a newSubscriptioni.e., a new contract to stream data from the starting request.The following are few ways to use the response class:
1) Using the subscribe helper method
2) Using a custom subscribersoftware.amazon.awssdk.services.bedrockagentruntime.paginators.GetAgentMemoryPublisher publisher = client.getAgentMemoryPaginator(request); CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response }); future.get();
As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.software.amazon.awssdk.services.bedrockagentruntime.paginators.GetAgentMemoryPublisher publisher = client.getAgentMemoryPaginator(request); publisher.subscribe(new Subscriber<software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryResponse>() { public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... }; public void onNext(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryResponse response) { //... }; });Please notice that the configuration of maxItems won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
getAgentMemory(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryRequest)operation.
This is a convenience which creates an instance of the
GetAgentMemoryRequest.Builderavoiding the need to create one manually viaGetAgentMemoryRequest.builder()- Parameters:
getAgentMemoryRequest- AConsumerthat will call methods onGetAgentMemoryRequest.Builderto create a request.- Returns:
- A custom publisher that can be subscribed to request a stream of response pages.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
invokeAgent
default CompletableFuture<Void> invokeAgent(InvokeAgentRequest invokeAgentRequest, InvokeAgentResponseHandler asyncResponseHandler)
Sends a prompt for the agent to process and respond to. Note the following fields for the request:
-
To continue the same conversation with an agent, use the same
sessionIdvalue in the request. -
To activate trace enablement, turn
enableTracetotrue. Trace enablement helps you follow the agent's reasoning process that led it to the information it processed, the actions it took, and the final result it yielded. For more information, see Trace enablement. -
To stream agent responses, make sure that only orchestration prompt is enabled. Agent streaming is not supported for the following steps:
-
Pre-processing -
Post-processing -
Agent with 1 Knowledge base and
User Inputnot enabled
-
-
End a conversation by setting
endSessiontotrue. -
In the
sessionStateobject, you can include attributes for the session or prompt or, if you configured an action group to return control, results from invocation of the action group.
The response contains both chunk and trace attributes.
The final response is returned in the
bytesfield of thechunkobject. TheInvokeAgentreturns one chunk for the entire interaction.-
The
attributionobject contains citations for parts of the response. -
If you set
enableTracetotruein the request, you can trace the agent's steps and reasoning process that led it to the response. -
If the action predicted was configured to return control, the response returns parameters for the action, elicited from the user, in the
returnControlfield. -
Errors are also surfaced in the response.
- Parameters:
invokeAgentRequest-- Returns:
- A Java Future containing the result of the InvokeAgent operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- 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.
- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
-
invokeAgent
default CompletableFuture<Void> invokeAgent(Consumer<InvokeAgentRequest.Builder> invokeAgentRequest, InvokeAgentResponseHandler asyncResponseHandler)
Sends a prompt for the agent to process and respond to. Note the following fields for the request:
-
To continue the same conversation with an agent, use the same
sessionIdvalue in the request. -
To activate trace enablement, turn
enableTracetotrue. Trace enablement helps you follow the agent's reasoning process that led it to the information it processed, the actions it took, and the final result it yielded. For more information, see Trace enablement. -
To stream agent responses, make sure that only orchestration prompt is enabled. Agent streaming is not supported for the following steps:
-
Pre-processing -
Post-processing -
Agent with 1 Knowledge base and
User Inputnot enabled
-
-
End a conversation by setting
endSessiontotrue. -
In the
sessionStateobject, you can include attributes for the session or prompt or, if you configured an action group to return control, results from invocation of the action group.
The response contains both chunk and trace attributes.
The final response is returned in the
bytesfield of thechunkobject. TheInvokeAgentreturns one chunk for the entire interaction.-
The
attributionobject contains citations for parts of the response. -
If you set
enableTracetotruein the request, you can trace the agent's steps and reasoning process that led it to the response. -
If the action predicted was configured to return control, the response returns parameters for the action, elicited from the user, in the
returnControlfield. -
Errors are also surfaced in the response.
This is a convenience which creates an instance of the
InvokeAgentRequest.Builderavoiding the need to create one manually viaInvokeAgentRequest.builder()- Parameters:
invokeAgentRequest- AConsumerthat will call methods onInvokeAgentRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the InvokeAgent operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- 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.
- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
-
invokeFlow
default CompletableFuture<Void> invokeFlow(InvokeFlowRequest invokeFlowRequest, InvokeFlowResponseHandler asyncResponseHandler)
Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.
The CLI doesn't support streaming operations in Amazon Bedrock, including
InvokeFlow.- Parameters:
invokeFlowRequest-- Returns:
- A Java Future containing the result of the InvokeFlow operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
invokeFlow
default CompletableFuture<Void> invokeFlow(Consumer<InvokeFlowRequest.Builder> invokeFlowRequest, InvokeFlowResponseHandler asyncResponseHandler)
Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.
The CLI doesn't support streaming operations in Amazon Bedrock, including
InvokeFlow.
This is a convenience which creates an instance of the
InvokeFlowRequest.Builderavoiding the need to create one manually viaInvokeFlowRequest.builder()- Parameters:
invokeFlowRequest- AConsumerthat will call methods onInvokeFlowRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the InvokeFlow operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
invokeInlineAgent
default CompletableFuture<Void> invokeInlineAgent(InvokeInlineAgentRequest invokeInlineAgentRequest, InvokeInlineAgentResponseHandler asyncResponseHandler)
Invokes an inline Amazon Bedrock agent using the configurations you provide with the request.
-
Specify the following fields for security purposes.
-
(Optional)
customerEncryptionKeyArn– The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent. -
(Optional)
idleSessionTTLinSeconds– Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequentInvokeInlineAgentrequest begins a new session.
-
-
To override the default prompt behavior for agent orchestration and to use advanced prompts, include a
promptOverrideConfigurationobject. For more information, see Advanced prompts. -
The agent instructions will not be honored if your agent has only one knowledge base, uses default prompts, has no action group, and user input is disabled.
- Parameters:
invokeInlineAgentRequest-- Returns:
- A Java Future containing the result of the InvokeInlineAgent operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
-
invokeInlineAgent
default CompletableFuture<Void> invokeInlineAgent(Consumer<InvokeInlineAgentRequest.Builder> invokeInlineAgentRequest, InvokeInlineAgentResponseHandler asyncResponseHandler)
Invokes an inline Amazon Bedrock agent using the configurations you provide with the request.
-
Specify the following fields for security purposes.
-
(Optional)
customerEncryptionKeyArn– The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent. -
(Optional)
idleSessionTTLinSeconds– Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequentInvokeInlineAgentrequest begins a new session.
-
-
To override the default prompt behavior for agent orchestration and to use advanced prompts, include a
promptOverrideConfigurationobject. For more information, see Advanced prompts. -
The agent instructions will not be honored if your agent has only one knowledge base, uses default prompts, has no action group, and user input is disabled.
This is a convenience which creates an instance of the
InvokeInlineAgentRequest.Builderavoiding the need to create one manually viaInvokeInlineAgentRequest.builder()- Parameters:
invokeInlineAgentRequest- AConsumerthat will call methods onInvokeInlineAgentRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the InvokeInlineAgent operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
-
optimizePrompt
default CompletableFuture<Void> optimizePrompt(OptimizePromptRequest optimizePromptRequest, OptimizePromptResponseHandler asyncResponseHandler)
Optimizes a prompt for the task that you specify. For more information, see Optimize a prompt in the Amazon Bedrock User Guide.
- Parameters:
optimizePromptRequest-- Returns:
- A Java Future containing the result of the OptimizePrompt operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
optimizePrompt
default CompletableFuture<Void> optimizePrompt(Consumer<OptimizePromptRequest.Builder> optimizePromptRequest, OptimizePromptResponseHandler asyncResponseHandler)
Optimizes a prompt for the task that you specify. For more information, see Optimize a prompt in the Amazon Bedrock User Guide.
This is a convenience which creates an instance of the
OptimizePromptRequest.Builderavoiding the need to create one manually viaOptimizePromptRequest.builder()- Parameters:
optimizePromptRequest- AConsumerthat will call methods onOptimizePromptRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the OptimizePrompt operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
rerank
default CompletableFuture<RerankResponse> rerank(RerankRequest rerankRequest)
Reranks the relevance of sources based on queries. For more information, see Improve the relevance of query responses with a reranker model.
- Parameters:
rerankRequest-- Returns:
- A Java Future containing the result of the Rerank operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
rerank
default CompletableFuture<RerankResponse> rerank(Consumer<RerankRequest.Builder> rerankRequest)
Reranks the relevance of sources based on queries. For more information, see Improve the relevance of query responses with a reranker model.
This is a convenience which creates an instance of the
RerankRequest.Builderavoiding the need to create one manually viaRerankRequest.builder()- Parameters:
rerankRequest- AConsumerthat will call methods onRerankRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the Rerank operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
rerankPaginator
default RerankPublisher rerankPaginator(RerankRequest rerankRequest)
This is a variant of
rerank(software.amazon.awssdk.services.bedrockagentruntime.model.RerankRequest)operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see
Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a newSubscriptioni.e., a new contract to stream data from the starting request.The following are few ways to use the response class:
1) Using the subscribe helper method
2) Using a custom subscribersoftware.amazon.awssdk.services.bedrockagentruntime.paginators.RerankPublisher publisher = client.rerankPaginator(request); CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response }); future.get();
As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.software.amazon.awssdk.services.bedrockagentruntime.paginators.RerankPublisher publisher = client.rerankPaginator(request); publisher.subscribe(new Subscriber<software.amazon.awssdk.services.bedrockagentruntime.model.RerankResponse>() { public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... }; public void onNext(software.amazon.awssdk.services.bedrockagentruntime.model.RerankResponse response) { //... }; });Please notice that the configuration of null won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
rerank(software.amazon.awssdk.services.bedrockagentruntime.model.RerankRequest)operation.- Parameters:
rerankRequest-- Returns:
- A custom publisher that can be subscribed to request a stream of response pages.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
rerankPaginator
default RerankPublisher rerankPaginator(Consumer<RerankRequest.Builder> rerankRequest)
This is a variant of
rerank(software.amazon.awssdk.services.bedrockagentruntime.model.RerankRequest)operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see
Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a newSubscriptioni.e., a new contract to stream data from the starting request.The following are few ways to use the response class:
1) Using the subscribe helper method
2) Using a custom subscribersoftware.amazon.awssdk.services.bedrockagentruntime.paginators.RerankPublisher publisher = client.rerankPaginator(request); CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response }); future.get();
As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.software.amazon.awssdk.services.bedrockagentruntime.paginators.RerankPublisher publisher = client.rerankPaginator(request); publisher.subscribe(new Subscriber<software.amazon.awssdk.services.bedrockagentruntime.model.RerankResponse>() { public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... }; public void onNext(software.amazon.awssdk.services.bedrockagentruntime.model.RerankResponse response) { //... }; });Please notice that the configuration of null won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
rerank(software.amazon.awssdk.services.bedrockagentruntime.model.RerankRequest)operation.
This is a convenience which creates an instance of the
RerankRequest.Builderavoiding the need to create one manually viaRerankRequest.builder()- Parameters:
rerankRequest- AConsumerthat will call methods onRerankRequest.Builderto create a request.- Returns:
- A custom publisher that can be subscribed to request a stream of response pages.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
retrieve
default CompletableFuture<RetrieveResponse> retrieve(RetrieveRequest retrieveRequest)
Queries a knowledge base and retrieves information from it.
- Parameters:
retrieveRequest-- Returns:
- A Java Future containing the result of the Retrieve operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
retrieve
default CompletableFuture<RetrieveResponse> retrieve(Consumer<RetrieveRequest.Builder> retrieveRequest)
Queries a knowledge base and retrieves information from it.
This is a convenience which creates an instance of the
RetrieveRequest.Builderavoiding the need to create one manually viaRetrieveRequest.builder()- Parameters:
retrieveRequest- AConsumerthat will call methods onRetrieveRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the Retrieve operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
retrieveAndGenerate
default CompletableFuture<RetrieveAndGenerateResponse> retrieveAndGenerate(RetrieveAndGenerateRequest retrieveAndGenerateRequest)
Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile. The response only cites sources that are relevant to the query.
- Parameters:
retrieveAndGenerateRequest-- Returns:
- A Java Future containing the result of the RetrieveAndGenerate operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
retrieveAndGenerate
default CompletableFuture<RetrieveAndGenerateResponse> retrieveAndGenerate(Consumer<RetrieveAndGenerateRequest.Builder> retrieveAndGenerateRequest)
Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile. The response only cites sources that are relevant to the query.
This is a convenience which creates an instance of the
RetrieveAndGenerateRequest.Builderavoiding the need to create one manually viaRetrieveAndGenerateRequest.builder()- Parameters:
retrieveAndGenerateRequest- AConsumerthat will call methods onRetrieveAndGenerateRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the RetrieveAndGenerate operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
retrieveAndGenerateStream
default CompletableFuture<Void> retrieveAndGenerateStream(RetrieveAndGenerateStreamRequest retrieveAndGenerateStreamRequest, RetrieveAndGenerateStreamResponseHandler asyncResponseHandler)
Queries a knowledge base and generates responses based on the retrieved results, with output in streaming format.
The CLI doesn't support streaming operations in Amazon Bedrock, including
InvokeModelWithResponseStream.- Parameters:
retrieveAndGenerateStreamRequest-- Returns:
- A Java Future containing the result of the RetrieveAndGenerateStream operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
retrieveAndGenerateStream
default CompletableFuture<Void> retrieveAndGenerateStream(Consumer<RetrieveAndGenerateStreamRequest.Builder> retrieveAndGenerateStreamRequest, RetrieveAndGenerateStreamResponseHandler asyncResponseHandler)
Queries a knowledge base and generates responses based on the retrieved results, with output in streaming format.
The CLI doesn't support streaming operations in Amazon Bedrock, including
InvokeModelWithResponseStream.
This is a convenience which creates an instance of the
RetrieveAndGenerateStreamRequest.Builderavoiding the need to create one manually viaRetrieveAndGenerateStreamRequest.builder()- Parameters:
retrieveAndGenerateStreamRequest- AConsumerthat will call methods onRetrieveAndGenerateStreamRequest.Builderto create a request.- Returns:
- A Java Future containing the result of the RetrieveAndGenerateStream operation returned by the service.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
retrievePaginator
default RetrievePublisher retrievePaginator(RetrieveRequest retrieveRequest)
This is a variant of
retrieve(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveRequest)operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see
Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a newSubscriptioni.e., a new contract to stream data from the starting request.The following are few ways to use the response class:
1) Using the subscribe helper method
2) Using a custom subscribersoftware.amazon.awssdk.services.bedrockagentruntime.paginators.RetrievePublisher publisher = client.retrievePaginator(request); CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response }); future.get();
As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.software.amazon.awssdk.services.bedrockagentruntime.paginators.RetrievePublisher publisher = client.retrievePaginator(request); publisher.subscribe(new Subscriber<software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveResponse>() { public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... }; public void onNext(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveResponse response) { //... }; });Please notice that the configuration of null won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
retrieve(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveRequest)operation.- Parameters:
retrieveRequest-- Returns:
- A custom publisher that can be subscribed to request a stream of response pages.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
retrievePaginator
default RetrievePublisher retrievePaginator(Consumer<RetrieveRequest.Builder> retrieveRequest)
This is a variant of
retrieve(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveRequest)operation. The return type is a custom publisher that can be subscribed to request a stream of response pages. SDK will internally handle making service calls for you.When the operation is called, an instance of this class is returned. At this point, no service calls are made yet and so there is no guarantee that the request is valid. If there are errors in your request, you will see the failures only after you start streaming the data. The subscribe method should be called as a request to start streaming data. For more info, see
Publisher.subscribe(org.reactivestreams.Subscriber). Each call to the subscribe method will result in a newSubscriptioni.e., a new contract to stream data from the starting request.The following are few ways to use the response class:
1) Using the subscribe helper method
2) Using a custom subscribersoftware.amazon.awssdk.services.bedrockagentruntime.paginators.RetrievePublisher publisher = client.retrievePaginator(request); CompletableFuture<Void> future = publisher.subscribe(res -> { // Do something with the response }); future.get();
As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.software.amazon.awssdk.services.bedrockagentruntime.paginators.RetrievePublisher publisher = client.retrievePaginator(request); publisher.subscribe(new Subscriber<software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveResponse>() { public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... }; public void onNext(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveResponse response) { //... }; });Please notice that the configuration of null won't limit the number of results you get with the paginator. It only limits the number of results in each page.
Note: If you prefer to have control on service calls, use the
retrieve(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveRequest)operation.
This is a convenience which creates an instance of the
RetrieveRequest.Builderavoiding the need to create one manually viaRetrieveRequest.builder()- Parameters:
retrieveRequest- AConsumerthat will call methods onRetrieveRequest.Builderto create a request.- Returns:
- A custom publisher that can be subscribed to request a stream of response pages.
The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invokeThrowable.getCause()to retrieve the underlying exception.- ConflictException There was a conflict performing an operation. Resolve the conflict and retry your request.
- ResourceNotFoundException The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
- ValidationException Input validation failed. Check your request parameters and retry the request.
- InternalServerException An internal server error occurred. Retry your request.
- DependencyFailedException There was an issue with a dependency. Check the resource configurations and retry the request.
- BadGatewayException There was an issue with a dependency due to a server issue. Retry your request.
- ThrottlingException The number of requests exceeds the limit. Resubmit your request later.
- AccessDeniedException The request is denied because of missing access permissions. Check your permissions and retry your request.
- ServiceQuotaExceededException The number of requests exceeds the service quota. Resubmit your request later.
- SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
- SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
- BedrockAgentRuntimeException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
- See Also:
- AWS API Documentation
-
serviceClientConfiguration
default BedrockAgentRuntimeServiceClientConfiguration serviceClientConfiguration()
- Specified by:
serviceClientConfigurationin interfaceAwsClient- Specified by:
serviceClientConfigurationin interfaceSdkClient
-
create
static BedrockAgentRuntimeAsyncClient create()
Create aBedrockAgentRuntimeAsyncClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.
-
builder
static BedrockAgentRuntimeAsyncClientBuilder builder()
Create a builder that can be used to configure and create aBedrockAgentRuntimeAsyncClient.
-
-