Interface BedrockRuntimeClient
-
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
@Generated("software.amazon.awssdk:codegen") @ThreadSafe public interface BedrockRuntimeClient extends AwsClient
Service client for accessing Amazon Bedrock Runtime. This can be created using the staticbuilder()method.Describes the API operations for running inference using Amazon Bedrock models.
-
-
Field Summary
Fields Modifier and Type Field Description static StringSERVICE_METADATA_IDValue for looking up the service's metadata from theServiceMetadataProvider.static StringSERVICE_NAME
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default ApplyGuardrailResponseapplyGuardrail(Consumer<ApplyGuardrailRequest.Builder> applyGuardrailRequest)The action to apply a guardrail.default ApplyGuardrailResponseapplyGuardrail(ApplyGuardrailRequest applyGuardrailRequest)The action to apply a guardrail.static BedrockRuntimeClientBuilderbuilder()Create a builder that can be used to configure and create aBedrockRuntimeClient.default ConverseResponseconverse(Consumer<ConverseRequest.Builder> converseRequest)Sends messages to the specified Amazon Bedrock model.default ConverseResponseconverse(ConverseRequest converseRequest)Sends messages to the specified Amazon Bedrock model.static BedrockRuntimeClientcreate()Create aBedrockRuntimeClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.default GetAsyncInvokeResponsegetAsyncInvoke(Consumer<GetAsyncInvokeRequest.Builder> getAsyncInvokeRequest)Retrieve information about an asynchronous invocation.default GetAsyncInvokeResponsegetAsyncInvoke(GetAsyncInvokeRequest getAsyncInvokeRequest)Retrieve information about an asynchronous invocation.default InvokeModelResponseinvokeModel(Consumer<InvokeModelRequest.Builder> invokeModelRequest)Invokes the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body.default InvokeModelResponseinvokeModel(InvokeModelRequest invokeModelRequest)Invokes the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body.default ListAsyncInvokesResponselistAsyncInvokes(Consumer<ListAsyncInvokesRequest.Builder> listAsyncInvokesRequest)Lists asynchronous invocations.default ListAsyncInvokesResponselistAsyncInvokes(ListAsyncInvokesRequest listAsyncInvokesRequest)Lists asynchronous invocations.default ListAsyncInvokesIterablelistAsyncInvokesPaginator(Consumer<ListAsyncInvokesRequest.Builder> listAsyncInvokesRequest)This is a variant oflistAsyncInvokes(software.amazon.awssdk.services.bedrockruntime.model.ListAsyncInvokesRequest)operation.default ListAsyncInvokesIterablelistAsyncInvokesPaginator(ListAsyncInvokesRequest listAsyncInvokesRequest)This is a variant oflistAsyncInvokes(software.amazon.awssdk.services.bedrockruntime.model.ListAsyncInvokesRequest)operation.default BedrockRuntimeServiceClientConfigurationserviceClientConfiguration()static ServiceMetadataserviceMetadata()default StartAsyncInvokeResponsestartAsyncInvoke(Consumer<StartAsyncInvokeRequest.Builder> startAsyncInvokeRequest)Starts an asynchronous invocation.default StartAsyncInvokeResponsestartAsyncInvoke(StartAsyncInvokeRequest startAsyncInvokeRequest)Starts an asynchronous invocation.-
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
-
applyGuardrail
default ApplyGuardrailResponse applyGuardrail(ApplyGuardrailRequest applyGuardrailRequest) throws AccessDeniedException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockRuntimeException
The action to apply a guardrail.
For troubleshooting some of the common errors you might encounter when using the
ApplyGuardrailAPI, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide- Parameters:
applyGuardrailRequest-- Returns:
- Result of the ApplyGuardrail operation returned by the service.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideResourceNotFoundException- The specified resource ARN was not found. For troubleshooting this error, see ResourceNotFound in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideInternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideServiceQuotaExceededException- Your request exceeds the service quota for your account. You can view your quotas at Viewing service quotas. You can 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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
applyGuardrail
default ApplyGuardrailResponse applyGuardrail(Consumer<ApplyGuardrailRequest.Builder> applyGuardrailRequest) throws AccessDeniedException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockRuntimeException
The action to apply a guardrail.
For troubleshooting some of the common errors you might encounter when using the
ApplyGuardrailAPI, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide
This is a convenience which creates an instance of the
ApplyGuardrailRequest.Builderavoiding the need to create one manually viaApplyGuardrailRequest.builder()- Parameters:
applyGuardrailRequest- AConsumerthat will call methods onApplyGuardrailRequest.Builderto create a request.- Returns:
- Result of the ApplyGuardrail operation returned by the service.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideResourceNotFoundException- The specified resource ARN was not found. For troubleshooting this error, see ResourceNotFound in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideInternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideServiceQuotaExceededException- Your request exceeds the service quota for your account. You can view your quotas at Viewing service quotas. You can 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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
converse
default ConverseResponse converse(ConverseRequest converseRequest) throws AccessDeniedException, ThrottlingException, ResourceNotFoundException, ModelTimeoutException, InternalServerException, ServiceUnavailableException, ValidationException, ModelNotReadyException, ModelErrorException, AwsServiceException, SdkClientException, BedrockRuntimeException
Sends messages to the specified Amazon Bedrock model.
Converseprovides a consistent interface that works with all models that support messages. This allows you to write code once and use it with different models. If a model has unique inference parameters, you can also pass those unique parameters to the model.Amazon Bedrock doesn't store any text, images, or documents that you provide as content. The data is only used to generate the response.
You can submit a prompt by including it in the
messagesfield, specifying themodelIdof a foundation model or inference profile to run inference on it, and including any other fields that are relevant to your use case.You can also submit a prompt from Prompt management by specifying the ARN of the prompt version and including a map of variables to values in the
promptVariablesfield. You can append more messages to the prompt by using themessagesfield. If you use a prompt from Prompt management, you can't include the following fields in the request:additionalModelRequestFields,inferenceConfig,system, ortoolConfig. Instead, these fields must be defined through Prompt management. For more information, see Use a prompt from Prompt management.For information about the Converse API, see Use the Converse API in the Amazon Bedrock User Guide. To use a guardrail, see Use a guardrail with the Converse API in the Amazon Bedrock User Guide. To use a tool with a model, see Tool use (Function calling) in the Amazon Bedrock User Guide
For example code, see Converse API examples in the Amazon Bedrock User Guide.
This operation requires permission for the
bedrock:InvokeModelaction.To deny all inference access to resources that you specify in the modelId field, you need to deny access to the
bedrock:InvokeModelandbedrock:InvokeModelWithResponseStreamactions. Doing this also denies access to the resource through the base inference actions (InvokeModel and InvokeModelWithResponseStream). For more information see Deny access for inference on specific models.For troubleshooting some of the common errors you might encounter when using the
ConverseAPI, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide- Parameters:
converseRequest-- Returns:
- Result of the Converse operation returned by the service.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideResourceNotFoundException- The specified resource ARN was not found. For troubleshooting this error, see ResourceNotFound in the Amazon Bedrock User GuideModelTimeoutException- The request took too long to process. Processing time exceeded the model timeout length.InternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideServiceUnavailableException- The service isn't currently available. For troubleshooting this error, see ServiceUnavailable in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideModelNotReadyException- The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see Retry behavior in the AWS SDKs and Tools reference guide.ModelErrorException- The request failed due to an error while processing the model.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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
converse
default ConverseResponse converse(Consumer<ConverseRequest.Builder> converseRequest) throws AccessDeniedException, ThrottlingException, ResourceNotFoundException, ModelTimeoutException, InternalServerException, ServiceUnavailableException, ValidationException, ModelNotReadyException, ModelErrorException, AwsServiceException, SdkClientException, BedrockRuntimeException
Sends messages to the specified Amazon Bedrock model.
Converseprovides a consistent interface that works with all models that support messages. This allows you to write code once and use it with different models. If a model has unique inference parameters, you can also pass those unique parameters to the model.Amazon Bedrock doesn't store any text, images, or documents that you provide as content. The data is only used to generate the response.
You can submit a prompt by including it in the
messagesfield, specifying themodelIdof a foundation model or inference profile to run inference on it, and including any other fields that are relevant to your use case.You can also submit a prompt from Prompt management by specifying the ARN of the prompt version and including a map of variables to values in the
promptVariablesfield. You can append more messages to the prompt by using themessagesfield. If you use a prompt from Prompt management, you can't include the following fields in the request:additionalModelRequestFields,inferenceConfig,system, ortoolConfig. Instead, these fields must be defined through Prompt management. For more information, see Use a prompt from Prompt management.For information about the Converse API, see Use the Converse API in the Amazon Bedrock User Guide. To use a guardrail, see Use a guardrail with the Converse API in the Amazon Bedrock User Guide. To use a tool with a model, see Tool use (Function calling) in the Amazon Bedrock User Guide
For example code, see Converse API examples in the Amazon Bedrock User Guide.
This operation requires permission for the
bedrock:InvokeModelaction.To deny all inference access to resources that you specify in the modelId field, you need to deny access to the
bedrock:InvokeModelandbedrock:InvokeModelWithResponseStreamactions. Doing this also denies access to the resource through the base inference actions (InvokeModel and InvokeModelWithResponseStream). For more information see Deny access for inference on specific models.For troubleshooting some of the common errors you might encounter when using the
ConverseAPI, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide
This is a convenience which creates an instance of the
ConverseRequest.Builderavoiding the need to create one manually viaConverseRequest.builder()- Parameters:
converseRequest- AConsumerthat will call methods onConverseRequest.Builderto create a request.- Returns:
- Result of the Converse operation returned by the service.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideResourceNotFoundException- The specified resource ARN was not found. For troubleshooting this error, see ResourceNotFound in the Amazon Bedrock User GuideModelTimeoutException- The request took too long to process. Processing time exceeded the model timeout length.InternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideServiceUnavailableException- The service isn't currently available. For troubleshooting this error, see ServiceUnavailable in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideModelNotReadyException- The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see Retry behavior in the AWS SDKs and Tools reference guide.ModelErrorException- The request failed due to an error while processing the model.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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
getAsyncInvoke
default GetAsyncInvokeResponse getAsyncInvoke(GetAsyncInvokeRequest getAsyncInvokeRequest) throws AccessDeniedException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, BedrockRuntimeException
Retrieve information about an asynchronous invocation.
- Parameters:
getAsyncInvokeRequest-- Returns:
- Result of the GetAsyncInvoke operation returned by the service.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideInternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideSdkException- 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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
getAsyncInvoke
default GetAsyncInvokeResponse getAsyncInvoke(Consumer<GetAsyncInvokeRequest.Builder> getAsyncInvokeRequest) throws AccessDeniedException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, BedrockRuntimeException
Retrieve information about an asynchronous invocation.
This is a convenience which creates an instance of the
GetAsyncInvokeRequest.Builderavoiding the need to create one manually viaGetAsyncInvokeRequest.builder()- Parameters:
getAsyncInvokeRequest- AConsumerthat will call methods onGetAsyncInvokeRequest.Builderto create a request.- Returns:
- Result of the GetAsyncInvoke operation returned by the service.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideInternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideSdkException- 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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
invokeModel
default InvokeModelResponse invokeModel(InvokeModelRequest invokeModelRequest) throws AccessDeniedException, ResourceNotFoundException, ThrottlingException, ModelTimeoutException, InternalServerException, ServiceUnavailableException, ValidationException, ServiceQuotaExceededException, ModelNotReadyException, ModelErrorException, AwsServiceException, SdkClientException, BedrockRuntimeException
Invokes the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body. You use model inference to generate text, images, and embeddings.
For example code, see Invoke model code examples in the Amazon Bedrock User Guide.
This operation requires permission for the
bedrock:InvokeModelaction.To deny all inference access to resources that you specify in the modelId field, you need to deny access to the
bedrock:InvokeModelandbedrock:InvokeModelWithResponseStreamactions. Doing this also denies access to the resource through the Converse API actions (Converse and ConverseStream). For more information see Deny access for inference on specific models.For troubleshooting some of the common errors you might encounter when using the
InvokeModelAPI, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide- Parameters:
invokeModelRequest-- Returns:
- Result of the InvokeModel operation returned by the service.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideResourceNotFoundException- The specified resource ARN was not found. For troubleshooting this error, see ResourceNotFound in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideModelTimeoutException- The request took too long to process. Processing time exceeded the model timeout length.InternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideServiceUnavailableException- The service isn't currently available. For troubleshooting this error, see ServiceUnavailable in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideServiceQuotaExceededException- Your request exceeds the service quota for your account. You can view your quotas at Viewing service quotas. You can resubmit your request later.ModelNotReadyException- The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see Retry behavior in the AWS SDKs and Tools reference guide.ModelErrorException- The request failed due to an error while processing the model.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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
invokeModel
default InvokeModelResponse invokeModel(Consumer<InvokeModelRequest.Builder> invokeModelRequest) throws AccessDeniedException, ResourceNotFoundException, ThrottlingException, ModelTimeoutException, InternalServerException, ServiceUnavailableException, ValidationException, ServiceQuotaExceededException, ModelNotReadyException, ModelErrorException, AwsServiceException, SdkClientException, BedrockRuntimeException
Invokes the specified Amazon Bedrock model to run inference using the prompt and inference parameters provided in the request body. You use model inference to generate text, images, and embeddings.
For example code, see Invoke model code examples in the Amazon Bedrock User Guide.
This operation requires permission for the
bedrock:InvokeModelaction.To deny all inference access to resources that you specify in the modelId field, you need to deny access to the
bedrock:InvokeModelandbedrock:InvokeModelWithResponseStreamactions. Doing this also denies access to the resource through the Converse API actions (Converse and ConverseStream). For more information see Deny access for inference on specific models.For troubleshooting some of the common errors you might encounter when using the
InvokeModelAPI, see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide
This is a convenience which creates an instance of the
InvokeModelRequest.Builderavoiding the need to create one manually viaInvokeModelRequest.builder()- Parameters:
invokeModelRequest- AConsumerthat will call methods onInvokeModelRequest.Builderto create a request.- Returns:
- Result of the InvokeModel operation returned by the service.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideResourceNotFoundException- The specified resource ARN was not found. For troubleshooting this error, see ResourceNotFound in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideModelTimeoutException- The request took too long to process. Processing time exceeded the model timeout length.InternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideServiceUnavailableException- The service isn't currently available. For troubleshooting this error, see ServiceUnavailable in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideServiceQuotaExceededException- Your request exceeds the service quota for your account. You can view your quotas at Viewing service quotas. You can resubmit your request later.ModelNotReadyException- The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see Retry behavior in the AWS SDKs and Tools reference guide.ModelErrorException- The request failed due to an error while processing the model.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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listAsyncInvokes
default ListAsyncInvokesResponse listAsyncInvokes(ListAsyncInvokesRequest listAsyncInvokesRequest) throws AccessDeniedException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, BedrockRuntimeException
Lists asynchronous invocations.
- Parameters:
listAsyncInvokesRequest-- Returns:
- Result of the ListAsyncInvokes operation returned by the service.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideInternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideSdkException- 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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listAsyncInvokes
default ListAsyncInvokesResponse listAsyncInvokes(Consumer<ListAsyncInvokesRequest.Builder> listAsyncInvokesRequest) throws AccessDeniedException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, BedrockRuntimeException
Lists asynchronous invocations.
This is a convenience which creates an instance of the
ListAsyncInvokesRequest.Builderavoiding the need to create one manually viaListAsyncInvokesRequest.builder()- Parameters:
listAsyncInvokesRequest- AConsumerthat will call methods onListAsyncInvokesRequest.Builderto create a request.- Returns:
- Result of the ListAsyncInvokes operation returned by the service.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideInternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideSdkException- 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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listAsyncInvokesPaginator
default ListAsyncInvokesIterable listAsyncInvokesPaginator(ListAsyncInvokesRequest listAsyncInvokesRequest) throws AccessDeniedException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, BedrockRuntimeException
This is a variant of
listAsyncInvokes(software.amazon.awssdk.services.bedrockruntime.model.ListAsyncInvokesRequest)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.bedrockruntime.paginators.ListAsyncInvokesIterable responses = client.listAsyncInvokesPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.bedrockruntime.paginators.ListAsyncInvokesIterable responses = client .listAsyncInvokesPaginator(request); for (software.amazon.awssdk.services.bedrockruntime.model.ListAsyncInvokesResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.bedrockruntime.paginators.ListAsyncInvokesIterable responses = client.listAsyncInvokesPaginator(request); responses.iterator().forEachRemaining(....);Please notice that the configuration of maxResults 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
listAsyncInvokes(software.amazon.awssdk.services.bedrockruntime.model.ListAsyncInvokesRequest)operation.- Parameters:
listAsyncInvokesRequest-- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideInternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideSdkException- 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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
listAsyncInvokesPaginator
default ListAsyncInvokesIterable listAsyncInvokesPaginator(Consumer<ListAsyncInvokesRequest.Builder> listAsyncInvokesRequest) throws AccessDeniedException, ThrottlingException, InternalServerException, ValidationException, AwsServiceException, SdkClientException, BedrockRuntimeException
This is a variant of
listAsyncInvokes(software.amazon.awssdk.services.bedrockruntime.model.ListAsyncInvokesRequest)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.bedrockruntime.paginators.ListAsyncInvokesIterable responses = client.listAsyncInvokesPaginator(request); responses.stream().forEach(....);{ @code software.amazon.awssdk.services.bedrockruntime.paginators.ListAsyncInvokesIterable responses = client .listAsyncInvokesPaginator(request); for (software.amazon.awssdk.services.bedrockruntime.model.ListAsyncInvokesResponse response : responses) { // do something; } }3) Use iterator directlysoftware.amazon.awssdk.services.bedrockruntime.paginators.ListAsyncInvokesIterable responses = client.listAsyncInvokesPaginator(request); responses.iterator().forEachRemaining(....);Please notice that the configuration of maxResults 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
listAsyncInvokes(software.amazon.awssdk.services.bedrockruntime.model.ListAsyncInvokesRequest)operation.
This is a convenience which creates an instance of the
ListAsyncInvokesRequest.Builderavoiding the need to create one manually viaListAsyncInvokesRequest.builder()- Parameters:
listAsyncInvokesRequest- AConsumerthat will call methods onListAsyncInvokesRequest.Builderto create a request.- Returns:
- A custom iterable that can be used to iterate through all the response pages.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideInternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideSdkException- 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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
startAsyncInvoke
default StartAsyncInvokeResponse startAsyncInvoke(StartAsyncInvokeRequest startAsyncInvokeRequest) throws AccessDeniedException, ThrottlingException, ResourceNotFoundException, InternalServerException, ServiceUnavailableException, ValidationException, ServiceQuotaExceededException, ConflictException, AwsServiceException, SdkClientException, BedrockRuntimeException
Starts an asynchronous invocation.
This operation requires permission for the
bedrock:InvokeModelaction.To deny all inference access to resources that you specify in the modelId field, you need to deny access to the
bedrock:InvokeModelandbedrock:InvokeModelWithResponseStreamactions. Doing this also denies access to the resource through the Converse API actions (Converse and ConverseStream). For more information see Deny access for inference on specific models.- Parameters:
startAsyncInvokeRequest-- Returns:
- Result of the StartAsyncInvoke operation returned by the service.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideResourceNotFoundException- The specified resource ARN was not found. For troubleshooting this error, see ResourceNotFound in the Amazon Bedrock User GuideInternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideServiceUnavailableException- The service isn't currently available. For troubleshooting this error, see ServiceUnavailable in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideServiceQuotaExceededException- Your request exceeds the service quota for your account. You can view your quotas at Viewing service quotas. You can resubmit your request later.ConflictException- Error occurred because of a conflict while performing an operation.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.BedrockRuntimeException- Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.AwsServiceException- See Also:
- AWS API Documentation
-
startAsyncInvoke
default StartAsyncInvokeResponse startAsyncInvoke(Consumer<StartAsyncInvokeRequest.Builder> startAsyncInvokeRequest) throws AccessDeniedException, ThrottlingException, ResourceNotFoundException, InternalServerException, ServiceUnavailableException, ValidationException, ServiceQuotaExceededException, ConflictException, AwsServiceException, SdkClientException, BedrockRuntimeException
Starts an asynchronous invocation.
This operation requires permission for the
bedrock:InvokeModelaction.To deny all inference access to resources that you specify in the modelId field, you need to deny access to the
bedrock:InvokeModelandbedrock:InvokeModelWithResponseStreamactions. Doing this also denies access to the resource through the Converse API actions (Converse and ConverseStream). For more information see Deny access for inference on specific models.
This is a convenience which creates an instance of the
StartAsyncInvokeRequest.Builderavoiding the need to create one manually viaStartAsyncInvokeRequest.builder()- Parameters:
startAsyncInvokeRequest- AConsumerthat will call methods onStartAsyncInvokeRequest.Builderto create a request.- Returns:
- Result of the StartAsyncInvoke operation returned by the service.
- Throws:
AccessDeniedException- The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User GuideThrottlingException- Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User GuideResourceNotFoundException- The specified resource ARN was not found. For troubleshooting this error, see ResourceNotFound in the Amazon Bedrock User GuideInternalServerException- An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User GuideServiceUnavailableException- The service isn't currently available. For troubleshooting this error, see ServiceUnavailable in the Amazon Bedrock User GuideValidationException- The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User GuideServiceQuotaExceededException- Your request exceeds the service quota for your account. You can view your quotas at Viewing service quotas. You can resubmit your request later.ConflictException- Error occurred because of a conflict while performing an operation.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.BedrockRuntimeException- 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 BedrockRuntimeClient create()
Create aBedrockRuntimeClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.
-
builder
static BedrockRuntimeClientBuilder builder()
Create a builder that can be used to configure and create aBedrockRuntimeClient.
-
serviceMetadata
static ServiceMetadata serviceMetadata()
-
serviceClientConfiguration
default BedrockRuntimeServiceClientConfiguration serviceClientConfiguration()
- Specified by:
serviceClientConfigurationin interfaceAwsClient- Specified by:
serviceClientConfigurationin interfaceSdkClient
-
-