Easy RAG extension for Quarkus LangChain4j that dramatically simplifies implementing Retrieval Augmented Generation pipelines with automatic document ingestion and embedding store management
The Easy RAG extension architecture is designed to provide a seamless RAG experience with minimal configuration while maintaining flexibility for advanced use cases. The extension integrates deeply with Quarkus's CDI system and LangChain4j's RAG framework.
The document ingestion engine that handles the complete pipeline from raw documents to stored embeddings.
Responsibilities:
Configuration-Driven: All behavior controlled through EasyRagConfig properties:
The retrieval component that implements LangChain4j's RetrievalAugmentor interface to provide RAG capabilities to AI services.
Responsibilities:
Integration: Automatically used by @RegisterAiService annotated interfaces through LangChain4j's framework, requiring no explicit wiring by developers.
A simple CDI bean that provides programmatic control over ingestion timing.
Responsibilities:
ingest() method for manual triggeringUse Cases:
Configuration interface providing type-safe access to all Easy RAG settings.
Configuration Domains:
Injection: Available throughout the application via standard CDI injection, enabling runtime access to configuration values.
The extension leverages Quarkus's build-time CDI bean synthesis to automatically provide beans when not explicitly defined by the user:
InMemoryEmbeddingStore:
EmbeddingStore bean existsEasyRetrievalAugmentor:
RetrievalAugmentor bean existsThis pattern enables zero-configuration RAG while preserving full customization capabilities.
Automatic Bean Creation: The extension automatically creates and wires beans when not explicitly provided:
Bean Replacement: Provide your own bean to override automatic creation:
Ingestion Timing:
Controlled via ingestion-strategy configuration:
The extension seamlessly integrates with LangChain4j's RAG abstractions:
RetrievalAugmentor Integration:
RetrievalAugmentor interface@RegisterAiService processingEmbeddingModel Integration:
EmbeddingModel beanEmbeddingStore Integration:
EmbeddingStore implementation1. Application Startup / Manual Trigger
↓
2. EasyRagIngestor.ingest() called
↓
3. Load documents from configured path
↓
4. Parse documents with Apache Tika
↓
5. Split into segments (recursive text splitter)
↓
6. Generate embeddings (via EmbeddingModel)
↓
7. Store embeddings (via EmbeddingStore)
↓
8. (Optional) Serialize to file for reuse1. User sends message to AI Service
↓
2. LangChain4j framework calls EasyRetrievalAugmentor.augment()
↓
3. Generate query embedding (via EmbeddingModel)
↓
4. Search for similar segments (via EmbeddingStore)
↓
5. Filter results (max-results, min-score)
↓
6. Return AugmentationResult with relevant segments
↓
7. LangChain4j injects segments into prompt
↓
8. Augmented prompt sent to LLM
↓
9. LLM generates context-aware response1. Developer sets properties in application.properties
↓
2. Quarkus maps properties to EasyRagConfig interface
↓
3. EasyRagConfig injected into components
↓
4. Components read config at runtime
↓
5. Behavior adapts to configurationDevelopers can extend or customize the architecture at multiple points:
Provide custom document loaders or processors before ingestion:
@ApplicationScoped
public class CustomProcessor {
@Inject
EmbeddingModel embeddingModel;
@Inject
EmbeddingStore<TextSegment> embeddingStore;
public void ingestWithCustomLogic(List<Document> docs) {
// Custom processing
List<Document> processed = preprocess(docs);
// Standard ingestion
EmbeddingStoreIngestor.builder()
.embeddingModel(embeddingModel)
.embeddingStore(embeddingStore)
.build()
.ingest(processed);
}
}Replace EasyRetrievalAugmentor with custom implementation:
@ApplicationScoped
public class CustomAugmentor implements RetrievalAugmentor {
@Override
public AugmentationResult augment(AugmentationRequest request) {
// Custom retrieval logic
// Query transformation, reranking, filtering, etc.
}
}Add extension for persistent store to replace in-memory default:
<dependency>
<groupId>io.quarkiverse.langchain4j</groupId>
<artifactId>quarkus-langchain4j-redis</artifactId>
</dependency>Automatically detected and used without code changes.
This tight integration with both ecosystems ensures the extension works seamlessly with existing Quarkus and LangChain4j applications while following best practices from both communities.
Install with Tessl CLI
npx tessl i tessl/maven-io-quarkiverse-langchain4j--quarkus-langchain4j-easy-rag