feat(dotAI): Dot AI LangChain4J - Amazon Bedrock#35242
feat(dotAI): Dot AI LangChain4J - Amazon Bedrock#35242ihoffmann-dot wants to merge 10 commits intodot-ai-langchain-azure-openaifrom
Conversation
❌ Issue Linking RequiredThis PR could not be linked to an issue. All PRs must be linked to an issue for tracking purposes. How to fix this:Option 1: Add keyword to PR body (Recommended - auto-removes this comment)
Why is this required?Issue linking ensures proper tracking, documentation, and helps maintain project history. It connects your code changes to the problem they solve.--- This comment was automatically generated by the issue linking workflow |
|
Claude finished @ihoffmann-dot's task in 1m 41s —— View job PR Review
Issues1. Resource leak — AWS clients are never closed (
2. Silent fallback on partial credentials ( if (config.accessKeyId() != null && config.secretAccessKey() != null) {If a user sets 3. Streaming model silently drops temperature and maxTokens (
4. Redundant BedrockChatModel.builder()
.modelId(config.model())
.region(Region.of(config.region())) // ← redundant
.client(bedrockClient(config)); // ← client already has the regionWhen an explicit 5. No validation of Any string is accepted. Cohere's API will reject invalid values at inference time with an opaque error. The two supported values ( 6. Growing Adding Bedrock required adding a fourth positional The dependency and BOM wiring ( |
|
Claude finished @ihoffmann-dot's task in 54s —— View job I'll analyze this and get back to you. |
…a BedrockStreamingChatModel
Summary
Adds AWS Bedrock as a supported provider. 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.
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)LangChain4jModelFactoryTestConfiguration
{ "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" } }Notes
accessKeyId/secretAccessKeyare omitted, credentials resolve viaDefaultCredentialsProvider(IAM role, environment, ~/.aws/credentials).cohere. →BedrockCohereEmbeddingModel; all others →BedrockTitanEmbeddingModel.embeddingInputTypeis Cohere-only. Usesearch_documentwhen indexing content,search_querywhen embedding a search query. Titan silently ignores this field.UnsupportedOperationException.Related Issue
This PR fixes #35183
EPIC: dotAI Multi-Provider Support #33970