Interface BedrockRuntimeClient
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
builder() method.
Describes the API operations for running inference using Amazon Bedrock models.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValue for looking up the service's metadata from theServiceMetadataProvider.static final String -
Method Summary
Modifier and TypeMethodDescriptiondefault 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 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.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
-
applyGuardrail
default ApplyGuardrailResponse applyGuardrail(ApplyGuardrailRequest applyGuardrailRequest) throws AccessDeniedException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockRuntimeException The action to apply a guardrail.
- Parameters:
applyGuardrailRequest-- Returns:
- Result of the ApplyGuardrail operation returned by the service.
- See Also:
-
applyGuardrail
default ApplyGuardrailResponse applyGuardrail(Consumer<ApplyGuardrailRequest.Builder> applyGuardrailRequest) throws AccessDeniedException, ResourceNotFoundException, ThrottlingException, InternalServerException, ValidationException, ServiceQuotaExceededException, AwsServiceException, SdkClientException, BedrockRuntimeException The action to apply a guardrail.
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.
- See Also:
-
converse
default ConverseResponse converse(ConverseRequest converseRequest) throws AccessDeniedException, ResourceNotFoundException, ThrottlingException, 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.
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.- Parameters:
converseRequest-- Returns:
- Result of the Converse operation returned by the service.
- See Also:
-
converse
default ConverseResponse converse(Consumer<ConverseRequest.Builder> converseRequest) throws AccessDeniedException, ResourceNotFoundException, ThrottlingException, 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.
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.
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.
- See Also:
-
invokeModel
default InvokeModelResponse invokeModel(InvokeModelRequest invokeModelRequest) throws AccessDeniedException, ResourceNotFoundException, ThrottlingException, ModelTimeoutException, InternalServerException, ServiceUnavailableException, ValidationException, ModelNotReadyException, ServiceQuotaExceededException, 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.- Parameters:
invokeModelRequest-- Returns:
- Result of the InvokeModel operation returned by the service.
- See Also:
-
invokeModel
default InvokeModelResponse invokeModel(Consumer<InvokeModelRequest.Builder> invokeModelRequest) throws AccessDeniedException, ResourceNotFoundException, ThrottlingException, ModelTimeoutException, InternalServerException, ServiceUnavailableException, ValidationException, ModelNotReadyException, ServiceQuotaExceededException, 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.
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.
- See Also:
-
create
Create aBedrockRuntimeClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider. -
builder
Create a builder that can be used to configure and create aBedrockRuntimeClient. -
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
-