core icon indicating copy to clipboard operation
core copied to clipboard

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

Open ihoffmann-dot opened this issue 7 months ago • 3 comments

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

  • PR: https://github.com/dotCMS/core/pull/35242
  • Epic: https://github.com/dotCMS/core/issues/33970

ihoffmann-dot avatar Apr 15 '26 18:04 ihoffmann-dot

QA Failed

I was able to create an index but after testing on the dotAI portlet chat. I got only 500 responses and this:

Image

zJaaal avatar Jun 23 '26 20:06 zJaaal

QA Passed

https://github.com/user-attachments/assets/013952ea-abd1-49af-a83e-6593a775a647

zJaaal avatar Jun 25 '26 19:06 zJaaal