Skip to content

feat(dotAI): Dot AI LangChain4J - Anthropic#36138

Open
ihoffmann-dot wants to merge 6 commits into
mainfrom
dot-ai-langchain-anthropic
Open

feat(dotAI): Dot AI LangChain4J - Anthropic#36138
ihoffmann-dot wants to merge 6 commits into
mainfrom
dot-ai-langchain-anthropic

Conversation

@ihoffmann-dot

Copy link
Copy Markdown
Member

Summary

Adds Anthropic as a supported provider, talking directly to the Anthropic Messages
API with an API key — distinct from accessing Claude models through AWS Bedrock,
which requires AWS infrastructure and IAM credentials.

  • Add langchain4j-anthropic dependency (version via langchain4j BOM)
  • Add AnthropicModelProviderStrategy registered in LangChain4jModelFactory.STRATEGIES
  • Chat + streaming chat via AnthropicChatModel / AnthropicStreamingChatModel
  • Embeddings and image throw UnsupportedOperationException (Anthropic has no such APIs)
  • endpoint config field overrides the default base URL (proxies/gateways)
  • Add 8 unit tests in LangChain4jModelFactoryTest

Configuration

{
  "chat": {
    "provider": "anthropic",
    "model": "claude-sonnet-4-6",
    "apiKey": "sk-ant-...",
    "maxTokens": 4096,
    "temperature": 0.7
  }
}

Notes

  • Model IDs use the Anthropic form: claude-sonnet-4-6, claude-opus-4-8, claude-haiku-4-5.
  • maxRetries is not supported by the streaming chat model and is ignored with a warning (same behavior as the OpenAI provider).

Related Issue

This PR fixes #36135
EPIC: dotAI Multi-Provider Support #33970

@claude

claude Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Claude finished @ihoffmann-dot's task in 3m 5s —— View job


I'll analyze this and get back to you.

Comment thread dotCMS/pom.xml
@@ -535,6 +535,11 @@
<groupId>dev.langchain4j</groupId>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 [Critical] Dependency added to wrong POM file

The langchain4j-anthropic dependency is added directly to dotCMS/pom.xml (lines 535-540) instead of bom/application/pom.xml. This violates dotCMS's convention where dependency versions should be managed via the BOM (Bill of Materials) in bom/application/pom.xml for centralized version control. Evidence: grep of bom/application/pom.xml shows other langchain4j dependencies (like langchain4j and langchain4j-openai) are declared there with versions inherited from the BOM, while this new dependency bypasses that system.

@dotCMS dotCMS deleted a comment from github-actions Bot Jul 1, 2026
@dotCMS dotCMS deleted a comment from github-actions Bot Jul 1, 2026
@dotCMS dotCMS deleted a comment from github-actions Bot Jul 1, 2026
@dotCMS dotCMS deleted a comment from github-actions Bot Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🤖 dotBot Review (Bedrock)

Reviewed 5 file(s); 3 candidate(s) → 1 confirmed, 0 uncertain (unverified, kept for review).

Confirmed findings

  • 🟡 Medium dotCMS/src/test/java/com/dotcms/ai/client/langchain4j/LangChain4jModelFactoryTest.java:567 — Test sets maxRetries for Anthropic non-streaming model which may not support retries
    The test configures maxRetries=2 (LangChain4jModelFactoryTest.java:567) but AnthropicModelProviderStrategy's buildChatModel shows no retry configuration. LangChain4j's AnthropicChatModel.Builder lacks maxRetries() method in its API (verified via source), making this test parameter ineffective. This creates a false sense of retry capability testing and could mask actual error handling gaps.

us.deepseek.r1-v1:0 · Run: #28609333946 · tokens: in: 25286 · out: 6507 · total: 31793 · calls: 10 · est. ~$0.069

@ihoffmann-dot ihoffmann-dot marked this pull request as ready for review July 2, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

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

1 participant