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 String
Value 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 BedrockAgentRuntimeClient
create()
Create aBedrockAgentRuntimeClient
with the region loaded from theDefaultAwsRegionProviderChain
and credentials loaded from theDefaultCredentialsProvider
.default DeleteAgentMemoryResponse
deleteAgentMemory
(Consumer<DeleteAgentMemoryRequest.Builder> deleteAgentMemoryRequest) Deletes memory from the specified memory identifier.default DeleteAgentMemoryResponse
deleteAgentMemory
(DeleteAgentMemoryRequest deleteAgentMemoryRequest) Deletes memory from the specified memory identifier.default GetAgentMemoryResponse
getAgentMemory
(Consumer<GetAgentMemoryRequest.Builder> getAgentMemoryRequest) Gets the sessions stored in the memory of the agent.default GetAgentMemoryResponse
getAgentMemory
(GetAgentMemoryRequest getAgentMemoryRequest) Gets the sessions stored in the memory of the agent.default GetAgentMemoryIterable
getAgentMemoryPaginator
(Consumer<GetAgentMemoryRequest.Builder> getAgentMemoryRequest) This is a variant ofgetAgentMemory(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryRequest)
operation.default GetAgentMemoryIterable
getAgentMemoryPaginator
(GetAgentMemoryRequest getAgentMemoryRequest) This is a variant ofgetAgentMemory(software.amazon.awssdk.services.bedrockagentruntime.model.GetAgentMemoryRequest)
operation.default RetrieveResponse
retrieve
(Consumer<RetrieveRequest.Builder> retrieveRequest) Queries a knowledge base and retrieves information from it.default RetrieveResponse
retrieve
(RetrieveRequest retrieveRequest) Queries a knowledge base and retrieves information from it.default 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 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 RetrieveIterable
retrievePaginator
(Consumer<RetrieveRequest.Builder> retrieveRequest) This is a variant ofretrieve(software.amazon.awssdk.services.bedrockagentruntime.model.RetrieveRequest)
operation.default RetrieveIterable
retrievePaginator
(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 ServiceMetadata
Methods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
close
Methods 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.Builder
avoiding the need to create one manually viaDeleteAgentMemoryRequest.builder()
- Parameters:
deleteAgentMemoryRequest
- AConsumer
that will call methods onDeleteAgentMemoryRequest.Builder
to 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.Builder
avoiding the need to create one manually viaGetAgentMemoryRequest.builder()
- Parameters:
getAgentMemoryRequest
- AConsumer
that will call methods onGetAgentMemoryRequest.Builder
to 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 Streamsoftware.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 Streamsoftware.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.Builder
avoiding the need to create one manually viaGetAgentMemoryRequest.builder()
- Parameters:
getAgentMemoryRequest
- AConsumer
that will call methods onGetAgentMemoryRequest.Builder
to 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.Builder
avoiding the need to create one manually viaRetrieveRequest.builder()
- Parameters:
retrieveRequest
- AConsumer
that will call methods onRetrieveRequest.Builder
to 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 Streamsoftware.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 Streamsoftware.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.Builder
avoiding the need to create one manually viaRetrieveRequest.builder()
- Parameters:
retrieveRequest
- AConsumer
that will call methods onRetrieveRequest.Builder
to 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.Builder
avoiding the need to create one manually viaRetrieveAndGenerateRequest.builder()
- Parameters:
retrieveAndGenerateRequest
- AConsumer
that will call methods onRetrieveAndGenerateRequest.Builder
to create a request.- Returns:
- Result of the RetrieveAndGenerate operation returned by the service.
- See Also:
-
create
Create aBedrockAgentRuntimeClient
with the region loaded from theDefaultAwsRegionProviderChain
and credentials loaded from theDefaultCredentialsProvider
. -
builder
Create a builder that can be used to configure and create aBedrockAgentRuntimeClient
. -
serviceMetadata
-
serviceClientConfiguration
Description copied from interface:SdkClient
The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration- Specified by:
serviceClientConfiguration
in interfaceAwsClient
- Specified by:
serviceClientConfiguration
in interfaceSdkClient
- Returns:
- SdkServiceClientConfiguration
-