[FEATURE] dotAI: LangChain4J integration — Phase 2 (AWS Bedrock)
Problem Statement
dotCMS's LangChain4J integration (Phase 1) supports only standalone OpenAI. Enterprise customers using AWS infrastructure need to route AI workloads through AWS Bedrock, which provides managed access to multiple model families (Anthropic Claude, Amazon Titan, Cohere, Meta) under AWS's data privacy and compliance guarantees. There is currently no way to configure dotAI to use Bedrock without code changes.
Solution
Add AWS Bedrock as a supported provider in LangChain4jModelFactory. Supports both explicit credentials (accessKeyId, secretAccessKey) and IAM role via DefaultCredentialsProvider. Implements chat and embeddings; image generation is not available through LangChain4J for Bedrock and throws UnsupportedOperationException. A single integration covers all Bedrock-proxied model families via the Converse API.
{
"chat": {
"provider": "bedrock",
"region": "us-east-1",
"accessKeyId": "...",
"secretAccessKey": "...",
"model": "anthropic.claude-3-5-sonnet-20241022-v2:0",
"maxTokens": 16384,
"temperature": 1.0
},
"embeddings": {
"provider": "bedrock",
"region": "us-east-1",
"accessKeyId": "...",
"secretAccessKey": "...",
"model": "amazon.titan-embed-text-v2:0"
}
}
Acceptance Criteria
- [ ] Chat completions work end-to-end using
provider: "bedrock"inproviderConfig. - [ ] Explicit credentials (
accessKeyId,secretAccessKey) and IAM role (credentials omitted, resolved viaDefaultCredentialsProvider) both authenticate successfully. - [ ] Embedding model dispatches correctly: model IDs prefixed with
cohere.useBedrockCohereEmbeddingModel; all others useBedrockTitanEmbeddingModel. - [ ]
embeddingInputTypefield is supported for Cohere embeddings (search_document/search_query); ignored for Titan. - [ ] Attempting image generation with
provider: "bedrock"throws a clearUnsupportedOperationException. - [ ] Unit tests cover the Bedrock builder paths in
LangChain4jModelFactoryTest.
dotCMS Version
main
Links
- PR: https://github.com/dotCMS/core/pull/35242
- Epic: https://github.com/dotCMS/core/issues/33970
PRs linked to this issue
- docs(dotAI): document Bedrock model ID forms, credentials, and error mapping by @sfreudenthaler
- feat(dotAI): Dot AI LangChain4J - Amazon Bedrock by @ihoffmann-dot
- fix(dotAI): apply timeout and maxRetries to Bedrock runtime clients by @sfreudenthaler
- fix(dotAI): handle integer values in embedding JSON response by @ihoffmann-dot
- test(dotAI): add BedrockModelProviderStrategy unit tests by @sfreudenthaler
QA Failed
I was able to create an index but after testing on the dotAI portlet chat. I got only 500 responses and this:
QA Passed
https://github.com/user-attachments/assets/013952ea-abd1-49af-a83e-6593a775a647