Interface BedrockAgentRuntimeClient
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
builder() method.
Contains APIs related to model invocation and querying of knowledge bases.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValue for looking up the service's metadata from theServiceMetadataProvider.static final String -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a builder that can be used to configure and create aBedrockAgentRuntimeClient.static BedrockAgentRuntimeClientcreate()Create aBedrockAgentRuntimeClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.default DeleteAgentMemoryResponsedeleteAgentMemory(Consumer<DeleteAgentMemoryRequest.Builder> deleteAgentMemoryRequest) Deletes memory from the specified memory identifier.default DeleteAgentMemoryResponsedeleteAgentMemory(DeleteAgentMemoryRequest deleteAgentMemoryRequest) Deletes memory from the specified memory identifier.default GetAgentMemoryResponsegetAgentMemory(Consumer<GetAgentMemoryRequest.Builder> getAgentMemoryRequest) Gets the sessions stored in the memory of the agent.default GetAgentMemoryResponsegetAgentMemory(GetAgentMemoryRequest getAgentMemoryRequest) Gets the sessions stored in the memory of the agent.default GetAgentMemoryIterablegetAgentMemoryPaginator(Consumer<GetAgentMemoryRequest.Builder> getAgentMemoryRequest) This is a variant ofgetAgentMemory(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryRequest)operation.default GetAgentMemoryIterablegetAgentMemoryPaginator(GetAgentMemoryRequest getAgentMemoryRequest) This is a variant ofgetAgentMemory(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryRequest)operation.default RetrieveResponseretrieve(Consumer<RetrieveRequest.Builder> retrieveRequest) Queries a knowledge base and retrieves information from it.default RetrieveResponseretrieve(RetrieveRequest retrieveRequest) Queries a knowledge base and retrieves information from it.default RetrieveAndGenerateResponseretrieveAndGenerate(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 RetrieveAndGenerateResponseretrieveAndGenerate(RetrieveAndGenerateRequest retrieveAndGenerateRequest) Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile.default RetrieveIterableretrievePaginator(Consumer<RetrieveRequest.Builder> retrieveRequest) This is a variant ofretrieve(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveRequest)operation.default RetrieveIterableretrievePaginator(RetrieveRequest retrieveRequest) This is a variant ofretrieve(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveRequest)operation.The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfigurationstatic ServiceMetadataMethods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
closeMethods inherited from interface software.amazon.awssdk.core.SdkClient
serviceName
-
Field Details
-
SERVICE_NAME
- See Also:
-
SERVICE_METADATA_ID
Value for looking up the service's metadata from theServiceMetadataProvider.- See Also:
-
-
Method Details
-
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.
- See Also:
-
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.
- See Also:
-
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.
- See Also:
-
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.
- See Also:
-
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.
- See Also:
-
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.
- See Also:
-
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.
- See Also:
-
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.
- See Also:
-
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.
- See Also:
-
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.
- See Also:
-
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.
- See Also:
-
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.
- See Also:
-
create
Create aBedrockAgentRuntimeClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider. -
builder
Create a builder that can be used to configure and create aBedrockAgentRuntimeClient. -
serviceMetadata
-
serviceClientConfiguration
Description copied from interface:SdkClientThe SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration- Specified by:
serviceClientConfigurationin interfaceAwsClient- Specified by:
serviceClientConfigurationin interfaceSdkClient- Returns:
- SdkServiceClientConfiguration
-