Skip to content

[FEATURE] dotAI: LangChain4J integration — Phase 2 (AWS Bedrock) #35334

@ihoffmann-dot

Description

@ihoffmann-dot

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" in providerConfig.
  • Explicit credentials (accessKeyId, secretAccessKey) and IAM role (credentials omitted, resolved via DefaultCredentialsProvider) both authenticate successfully.
  • Embedding model dispatches correctly: model IDs prefixed with cohere. use BedrockCohereEmbeddingModel; all others use BedrockTitanEmbeddingModel.
  • embeddingInputType field is supported for Cohere embeddings (search_document / search_query); ignored for Titan.
  • Attempting image generation with provider: "bedrock" throws a clear UnsupportedOperationException.
  • Unit tests cover the Bedrock builder paths in LangChain4jModelFactoryTest.

dotCMS Version

main

Links

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions