Interface BedrockAgentRuntimeClient
-
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
@Generated("software.amazon.awssdk:codegen") @ThreadSafe public interface BedrockAgentRuntimeClient extends AwsClient
Service client for accessing Agents for Amazon Bedrock Runtime. This can be created using the staticbuilder()method.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
-
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 DeleteAgentMemoryResponse deleteAgentMemory(DeleteAgentMemoryRequest deleteAgentMemoryRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
Deletes memory from the specified memory identifier.
- Parameters:
deleteAgentMemoryRequest-- Returns:
- Result of the DeleteAgentMemory operation returned by the service.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
deleteAgentMemory
default DeleteAgentMemoryResponse deleteAgentMemory(Consumer<DeleteAgentMemoryRequest.Builder> deleteAgentMemoryRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
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:
- Result of the DeleteAgentMemory operation returned by the service.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
generateQuery
default GenerateQueryResponse generateQuery(GenerateQueryRequest generateQueryRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
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:
- Result of the GenerateQuery operation returned by the service.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
generateQuery
default GenerateQueryResponse generateQuery(Consumer<GenerateQueryRequest.Builder> generateQueryRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
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:
- Result of the GenerateQuery operation returned by the service.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
getAgentMemory
default GetAgentMemoryResponse getAgentMemory(GetAgentMemoryRequest getAgentMemoryRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
Gets the sessions stored in the memory of the agent.
- Parameters:
getAgentMemoryRequest-- Returns:
- Result of the GetAgentMemory operation returned by the service.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
getAgentMemory
default GetAgentMemoryResponse getAgentMemory(Consumer<GetAgentMemoryRequest.Builder> getAgentMemoryRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
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:
- Result of the GetAgentMemory operation returned by the service.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
getAgentMemoryPaginator
default GetAgentMemoryIterable getAgentMemoryPaginator(GetAgentMemoryRequest getAgentMemoryRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
This is a variant of
getAgentMemory(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.bedrockagentruntime.paginators.GetAgentMemoryIterable responses = client.getAgentMemoryPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.bedrockagentruntime.paginators.GetAgentMemoryIterable responses = client .getAgentMemoryPaginator(request); for (software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.bedrockagentruntime.paginators.GetAgentMemoryIterable responses = client.getAgentMemoryPaginator(request); responses.iterator().forEachRemaining(....);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 iterable that can be used to iterate through all the response pages.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
getAgentMemoryPaginator
default GetAgentMemoryIterable getAgentMemoryPaginator(Consumer<GetAgentMemoryRequest.Builder> getAgentMemoryRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
This is a variant of
getAgentMemory(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.bedrockagentruntime.paginators.GetAgentMemoryIterable responses = client.getAgentMemoryPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.bedrockagentruntime.paginators.GetAgentMemoryIterable responses = client .getAgentMemoryPaginator(request); for (software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.bedrockagentruntime.paginators.GetAgentMemoryIterable responses = client.getAgentMemoryPaginator(request); responses.iterator().forEachRemaining(....);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 iterable that can be used to iterate through all the response pages.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
rerank
default RerankResponse rerank(RerankRequest rerankRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
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:
- Result of the Rerank operation returned by the service.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
rerank
default RerankResponse rerank(Consumer<RerankRequest.Builder> rerankRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
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:
- Result of the Rerank operation returned by the service.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
rerankPaginator
default RerankIterable rerankPaginator(RerankRequest rerankRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
This is a variant of
rerank(software.amazon.awssdk.services.bedrockagentruntime.model.RerankRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.bedrockagentruntime.paginators.RerankIterable responses = client.rerankPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.bedrockagentruntime.paginators.RerankIterable responses = client.rerankPaginator(request); for (software.amazon.awssdk.services.bedrockagentruntime.model.RerankResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.bedrockagentruntime.paginators.RerankIterable responses = client.rerankPaginator(request); responses.iterator().forEachRemaining(....);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 iterable that can be used to iterate through all the response pages.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
rerankPaginator
default RerankIterable rerankPaginator(Consumer<RerankRequest.Builder> rerankRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
This is a variant of
rerank(software.amazon.awssdk.services.bedrockagentruntime.model.RerankRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.bedrockagentruntime.paginators.RerankIterable responses = client.rerankPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.bedrockagentruntime.paginators.RerankIterable responses = client.rerankPaginator(request); for (software.amazon.awssdk.services.bedrockagentruntime.model.RerankResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.bedrockagentruntime.paginators.RerankIterable responses = client.rerankPaginator(request); responses.iterator().forEachRemaining(....);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 iterable that can be used to iterate through all the response pages.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
retrieve
default RetrieveResponse retrieve(RetrieveRequest retrieveRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
Queries a knowledge base and retrieves information from it.
- Parameters:
retrieveRequest-- Returns:
- Result of the Retrieve operation returned by the service.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
retrieve
default RetrieveResponse retrieve(Consumer<RetrieveRequest.Builder> retrieveRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
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:
- Result of the Retrieve operation returned by the service.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
retrievePaginator
default RetrieveIterable retrievePaginator(RetrieveRequest retrieveRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
This is a variant of
retrieve(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.bedrockagentruntime.paginators.RetrieveIterable responses = client.retrievePaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.bedrockagentruntime.paginators.RetrieveIterable responses = client.retrievePaginator(request); for (software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.bedrockagentruntime.paginators.RetrieveIterable responses = client.retrievePaginator(request); responses.iterator().forEachRemaining(....);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 iterable that can be used to iterate through all the response pages.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
retrievePaginator
default RetrieveIterable retrievePaginator(Consumer<RetrieveRequest.Builder> retrieveRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
This is a variant of
retrieve(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveRequest)operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will internally handle making service calls for you.When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response pages by making service calls until there are no pages left or your iteration stops. If there are errors in your request, you will see the failures only after you start iterating through the iterable.
The following are few ways to iterate through the response pages:
1) Using a Stream
2) Using For loopsoftware.amazon.awssdk.services.bedrockagentruntime.paginators.RetrieveIterable responses = client.retrievePaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.bedrockagentruntime.paginators.RetrieveIterable responses = client.retrievePaginator(request); for (software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.bedrockagentruntime.paginators.RetrieveIterable responses = client.retrievePaginator(request); responses.iterator().forEachRemaining(....);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 iterable that can be used to iterate through all the response pages.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
retrieveAndGenerate
default RetrieveAndGenerateResponse retrieveAndGenerate(RetrieveAndGenerateRequest retrieveAndGenerateRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
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:
- Result of the RetrieveAndGenerate operation returned by the service.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
retrieveAndGenerate
default RetrieveAndGenerateResponse retrieveAndGenerate(Consumer<RetrieveAndGenerateRequest.Builder> retrieveAndGenerateRequest) throws ConflictException, ResourceNotFoundException, ValidationException, InternalServerException, DependencyFailedException, BadGatewayException, ThrottlingException, AccessDeniedException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockAgentRuntimeException
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:
- Result of the RetrieveAndGenerate operation returned by the service.
- Throws:
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.AwsServiceException- See Also:
- AWS API Documentation
-
create
static BedrockAgentRuntimeClient create()
Create aBedrockAgentRuntimeClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.
-
builder
static BedrockAgentRuntimeClientBuilder builder()
Create a builder that can be used to configure and create aBedrockAgentRuntimeClient.
-
serviceMetadata
static ServiceMetadata serviceMetadata()
-
serviceClientConfiguration
default BedrockAgentRuntimeServiceClientConfiguration serviceClientConfiguration()
- Specified by:
serviceClientConfigurationin interfaceAwsClient- Specified by:
serviceClientConfigurationin interfaceSdkClient
-
-