Interface BedrockAgentRuntimeClient
- All Superinterfaces:
AutoCloseable
,AwsClient
,SdkAutoCloseable
,SdkClient
builder()
method.
Contains APIs related to model invocation and querying of knowledge bases.
-
Field Summary
Modifier 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 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.default RetrieveAndGenerateResponse
retrieveAndGenerate
(RetrieveAndGenerateRequest retrieveAndGenerateRequest) Queries a knowledge base and generates responses based on the retrieved results.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
-
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. 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. 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
-