ADR-037: AWS Bedrock and S3 Vectors Integration

Status

Accepted

Context

The CLI currently supports multiple LLM providers via Quarkus LangChain4j:

For vector storage, we use PGVector (PostgreSQL with pgvector extension).

Users have requested AWS integration for:

  1. AWS Bedrock - Managed LLM service with access to Claude, Titan, Llama, and other models
  2. Amazon S3 Vectors - New cost-effective vector storage (up to 90% savings vs traditional vector DBs)

Decision

AWS Bedrock Integration (Implemented)

Add quarkus-langchain4j-bedrock extension to support AWS Bedrock as an LLM provider:

Supported Models:

Configuration Pattern:

# Provider selection
quarkus.langchain4j.chat-model.provider=bedrock
quarkus.langchain4j.embedding-model.provider=bedrock

# Bedrock configuration
quarkus.langchain4j.bedrock.region=${AWS_REGION:us-east-1}
quarkus.langchain4j.bedrock.chat-model.model-id=anthropic.claude-3-sonnet-20240229-v1:0
quarkus.langchain4j.bedrock.embedding-model.model-id=amazon.titan-embed-text-v2:0
quarkus.langchain4j.bedrock.timeout=120s

# AWS credentials (use default credential chain)
# Environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
# Or: ~/.aws/credentials profile, IAM role, etc.

Benefits:

Amazon S3 Vectors (Not Yet Implemented)

Status: Deferred pending LangChain4j support

Amazon S3 Vectors (GA July 2025) provides native vector storage in S3:

Current Limitation: LangChain4j (Java) does not have native S3 Vectors support. Only Python LangChain has AmazonS3Vectors integration via langchain_aws.vectorstores.s3_vectors.

Options Considered:

  1. Custom EmbeddingStore implementation - High effort, maintenance burden
  2. Wait for LangChain4j support - Preferred, community-driven
  3. Use Amazon OpenSearch Serverless - Supported via existing LangChain4j OpenSearch module

Recommendation: Continue using PGVector for now. Monitor LangChain4j for S3 Vectors support. Consider OpenSearch Serverless for AWS-native deployments requiring managed vector search.

Implementation

Dependencies Added

<!-- AWS Bedrock LLM/Embedding support -->
<dependency>
    <groupId>io.quarkiverse.langchain4j</groupId>
    <artifactId>quarkus-langchain4j-bedrock</artifactId>
    <version>${quarkus-langchain4j.version}</version>
</dependency>

Configuration Properties

New properties in application.properties:

# ==================== AWS Bedrock Configuration ====================

# Bedrock model configuration
quarkus.langchain4j.bedrock.region=${AWS_REGION:us-east-1}
quarkus.langchain4j.bedrock.timeout=120s

# Bedrock chat model (Claude 3 Sonnet via Bedrock)
quarkus.langchain4j.bedrock.chat-model.model-id=anthropic.claude-3-sonnet-20240229-v1:0
quarkus.langchain4j.bedrock.chat-model.max-tokens=4096
quarkus.langchain4j.bedrock.chat-model.log-requests=false
quarkus.langchain4j.bedrock.chat-model.log-responses=false

# Bedrock embedding model (Amazon Titan)
quarkus.langchain4j.bedrock.embedding-model.model-id=amazon.titan-embed-text-v2:0

Usage

To use Bedrock instead of Ollama:

# Set provider to bedrock
export LANGCHAIN4J_CHAT_MODEL_PROVIDER=bedrock
export LANGCHAIN4J_EMBEDDING_MODEL_PROVIDER=bedrock

# AWS credentials (one of these methods)
export AWS_ACCESS_KEY_ID=your-key
export AWS_SECRET_ACCESS_KEY=your-secret
export AWS_REGION=us-east-1

# Or use ~/.aws/credentials profile
export AWS_PROFILE=your-profile

# Run CLI
java -jar idempiere-hub-runner.jar ask "What is iDempiere?"

Consequences

Positive

Negative

Neutral

References

Path: /docs/developers/architecture/idempiere-hub/037-aws-bedrock-s3-vectors