langchain4j-rag-implementation-patternslisted
Install: claude install-skill giuseppe-trisciuoglio/developer-kit
# LangChain4j RAG Implementation Patterns
## Overview
Implements RAG systems with LangChain4j: document ingestion pipelines, embedding stores, and vector search for chat-with-documents and knowledge-enhanced AI applications.
## When to Use This Skill
- Building chat-with-documents systems or document Q&A over PDFs, text files, or web pages
- Creating AI assistants with access to company knowledge bases or external sources
- Implementing semantic search or hybrid search over document repositories
- Building domain-specific AI with curated knowledge and source attribution
## Instructions
### Initialize RAG Project
Create a new Spring Boot project with required dependencies:
**pom.xml**:
```xml
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-spring-boot-starter</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-open-ai</artifactId>
<version>1.8.0</version>
</dependency>
```
### Setup Document Ingestion
Configure document loading and processing with validation:
**Validation Checkpoint**: After ingestion, verify embedding count matches segment count and test retrieval with a sample query.
```java
@Configuration
public class RAGConfiguration {
@Bean
public EmbeddingModel embeddingModel() {
return OpenAiEmbeddingModel.builder()
.apiKey(System.getenv("OPENAI_API_KEY"))
.modelName("text-embedding-3-small")