Description
Add AWS Bedrock as a supported provider in the dotAI LangChain4J integration layer. Bedrock is a managed platform that proxies multiple model families (Anthropic, Amazon Titan, Cohere, Meta, etc.) via a unified Converse API — a single integration covers all of them.
This builds on the LangChain4J abstraction established in #35183 (Phase 1 — OpenAI).
Implementation outline:
- Add
langchain4j-bedrock dependency
- Add
bedrock case to LangChain4jModelFactory switch
- Implement
buildBedrockChatModel using BedrockRuntimeClient with explicit or IAM role credentials
- Implement
buildBedrockEmbeddingModel with automatic Titan/Cohere dispatch by model ID prefix
- Add
embeddingInputType field to ProviderConfig (Cohere-specific; default: search_document)
buildBedrockImageModel throws UnsupportedOperationException (no LangChain4J support)
Acceptance Criteria
Additional Context
Sample configuration:
{
"chat": {
"provider": "bedrock",
"region": "us-east-1",
"model": "anthropic.claude-3-5-sonnet-20241022-v2:0",
"maxTokens": 16384
},
"embeddings": {
"provider": "bedrock",
"region": "us-east-1",
"model": "amazon.titan-embed-text-v2:0"
}
}
Description
Add AWS Bedrock as a supported provider in the dotAI LangChain4J integration layer. Bedrock is a managed platform that proxies multiple model families (Anthropic, Amazon Titan, Cohere, Meta, etc.) via a unified Converse API — a single integration covers all of them.
This builds on the LangChain4J abstraction established in #35183 (Phase 1 — OpenAI).
Implementation outline:
langchain4j-bedrockdependencybedrockcase toLangChain4jModelFactoryswitchbuildBedrockChatModelusingBedrockRuntimeClientwith explicit or IAM role credentialsbuildBedrockEmbeddingModelwith automatic Titan/Cohere dispatch by model ID prefixembeddingInputTypefield toProviderConfig(Cohere-specific; default:search_document)buildBedrockImageModelthrowsUnsupportedOperationException(no LangChain4J support)Acceptance Criteria
bedrockis selectable as a provider inproviderConfigfor chat and embeddings sectionsaccessKeyId/secretAccessKeyare omitted, credentials resolve viaDefaultCredentialsProvider(IAM role, environment,~/.aws/credentials)cohere.*model IDs toBedrockCohereEmbeddingModeland all others toBedrockTitanEmbeddingModelembeddingInputTypeis honored for Cohere; silently ignored for TitanUnsupportedOperationExceptionwith a clear messageLangChain4jModelFactoryTestAdditional Context
Sample configuration:
{ "chat": { "provider": "bedrock", "region": "us-east-1", "model": "anthropic.claude-3-5-sonnet-20241022-v2:0", "maxTokens": 16384 }, "embeddings": { "provider": "bedrock", "region": "us-east-1", "model": "amazon.titan-embed-text-v2:0" } }