Class BedrockBatchChatModel.Builder
java.lang.Object
dev.langchain4j.model.bedrock.BedrockBatchChatModel.Builder
- Enclosing class:
BedrockBatchChatModel
-
Method Summary
Modifier and TypeMethodDescriptionbedrockClient(software.amazon.awssdk.services.bedrock.BedrockClient bedrockClient) Sets theBedrockClientused for job control-plane calls.build()credentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider) Sets the credentials provider for the clients created when none are supplied.customHeaders(Supplier<Map<String, String>> customHeadersSupplier) Sets a supplier of headers added to every control-plane call.customHeaders(Map<String, String> customHeaders) Sets headers added to every control-plane call.defaultRequestParameters(ChatRequestParameters defaultRequestParameters) Sets common defaultChatRequestParameters; per-request parameters take precedence over these.inputS3Uri(String inputS3Uri) Sets the S3 URI under which the generated input file is uploaded.jobTimeout(Duration jobTimeout) Sets how long the job may run before its unprocessed records expire.logger(org.slf4j.Logger logger) logRequests(Boolean logRequests) Enables logging of the control-plane and S3 requests.logResponses(Boolean logResponses) Enables logging of the control-plane and S3 responses.maxRetries(Integer maxRetries) Sets the number of times to retry a control-plane or S3 call on transient errors.Sets the model that every request in the batch runs against.outputS3Uri(String outputS3Uri) Sets the S3 URI (for examples3://my-bucket/batch-output) where Bedrock writes the results.region(software.amazon.awssdk.regions.Region region) Sets the AWS region for the clients created when none are supplied.returnThinking(Boolean returnThinking) Controls whether the thinking of a model with reasoning enabled is returned inAiMessage.thinking().Sets the ARN of the service role Bedrock assumes to read the input and write the output in S3.s3Client(software.amazon.awssdk.services.s3.S3Client s3Client) Sets theS3Clientused to write inputs and read outputs.sendThinking(Boolean sendThinking) Controls whether the thinking of anAiMessagein the conversation is sent back to the model.Sets the timeout of each control-plane and S3 call.
-
Method Details
-
bedrockClient
public BedrockBatchChatModel.Builder bedrockClient(software.amazon.awssdk.services.bedrock.BedrockClient bedrockClient) Sets theBedrockClientused for job control-plane calls. If not set, one is created fromregion(Region)andcredentialsProvider(AwsCredentialsProvider). A client set here is not closed byBedrockBatchChatModel.close().- Returns:
this
-
s3Client
Sets theS3Clientused to write inputs and read outputs. If not set, one is created fromregion(Region)andcredentialsProvider(AwsCredentialsProvider). The bucket must be in the same region as the job. A client set here is not closed byBedrockBatchChatModel.close().- Returns:
this
-
region
Sets the AWS region for the clients created when none are supplied. Defaults tous-east-1.- Returns:
this
-
credentialsProvider
public BedrockBatchChatModel.Builder credentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider) Sets the credentials provider for the clients created when none are supplied. Defaults toDefaultCredentialsProvider. A provider set here is not closed byBedrockBatchChatModel.close().- Returns:
this
-
modelId
Sets the model that every request in the batch runs against. Defaults to the model name ofdefaultRequestParameters(ChatRequestParameters).- Returns:
this
-
roleArn
Sets the ARN of the service role Bedrock assumes to read the input and write the output in S3.- Returns:
this
-
outputS3Uri
Sets the S3 URI (for examples3://my-bucket/batch-output) where Bedrock writes the results.- Returns:
this
-
inputS3Uri
Sets the S3 URI under which the generated input file is uploaded. Defaults tooutputS3Uri(String).- Returns:
this
-
defaultRequestParameters
public BedrockBatchChatModel.Builder defaultRequestParameters(ChatRequestParameters defaultRequestParameters) Sets common defaultChatRequestParameters; per-request parameters take precedence over these.- Returns:
this
-
jobTimeout
Sets how long the job may run before its unprocessed records expire. Bedrock accepts whole hours between 24 and 168, so a value that is not a whole number of hours is rounded up, and a value outside that range is rejected. If not set, Bedrock applies its default.- Returns:
this
-
timeout
Sets the timeout of each control-plane and S3 call. If not set, the AWS SDK default applies. Ignored for a client passed tobedrockClient(BedrockClient)ors3Client(S3Client).- Returns:
this
-
maxRetries
Sets the number of times to retry a control-plane or S3 call on transient errors. Defaults to2.- Returns:
this
-
returnThinking
Controls whether the thinking of a model with reasoning enabled is returned inAiMessage.thinking(). Defaults tofalse.- Returns:
this
-
sendThinking
Controls whether the thinking of anAiMessagein the conversation is sent back to the model. Defaults totrue.- Returns:
this
-
customHeaders
Sets headers added to every control-plane call. Ignored for a client passed tobedrockClient(BedrockClient).- Returns:
this
-
customHeaders
public BedrockBatchChatModel.Builder customHeaders(Supplier<Map<String, String>> customHeadersSupplier) Sets a supplier of headers added to every control-plane call. Ignored for a client passed tobedrockClient(BedrockClient).- Returns:
this
-
logRequests
Enables logging of the control-plane and S3 requests. Defaults tofalse. Ignored for a client passed tobedrockClient(BedrockClient)ors3Client(S3Client).- Returns:
this
-
logResponses
Enables logging of the control-plane and S3 responses. Defaults tofalse. Ignored for a client passed tobedrockClient(BedrockClient)ors3Client(S3Client).- Returns:
this
-
logger
- Returns:
this
-
build
-