How langchain4j/langchain4j-examples works
Project type and purpose
• This is a Maven “multi-module” examples repository for LangChain4j.
• At the root you have an aggregator POM (pom.xml) and dozens of child modules (e.g., spring-boot-example, azure-open-ai-examples, rag-examples, customer-support-agent-example, etc.).
• Each module is a self-contained demo showing how to integrate LLMs, RAG, tools, memory, streaming, vector stores and/or frameworks (Spring Boot, Quarkus, Helidon, Jakarta EE, Wildfly, JavaFX, CLI, etc.) with the LangChain4j library.
File structure
• Top-level aggregator POM references all the example modules.
• Each module has its own pom.xml, src/main/java, src/main/resources, and often src/test.
• Some modules are pure Java CLIs (e.g., tutorials, other-examples, open-ai-examples), others are full-fledged microservices or web apps (e.g., spring-boot-example, customer-support-agent-example, Helidon/Quarkus/Wildfly examples).
• Provider-specific demos (azure-*, open-ai-examples, vertex-ai-gemini-examples, mistral-ai-examples, etc.)
• Vector store demos (redis-example, chroma-example, pinecone-example, etc.)
• Framework demos (spring-boot-example, quarkus-example, helidon-examples, jakartaee-microprofile-example, wildfly-example)
• Core LLM/RAG/memory/tutorial demos (tutorials, rag-examples, other-examples, customer-support-agent-example).
Extract insights from the README
• It points to tutorials, other-examples, rag-examples, and the customer-support-agent-example as good starting points.
A. Root-level multi-module structure
– LLM provider demos
– Vector store demos
– Framework demos
– Core feature demos (RAG, tutorials, multi-tool agent)
B. Drill-down into a representative module (e.g., customer-support-agent-example)
• Components:
1. Client (e.g., HTTP REST or CLI)
2. Spring Boot Application
3. REST Controller (CustomerSupportAgentController)
4. Agent orchestration class (CustomerSupportAgent)
5. Tool adapters (BookingTools)
6. Domain service (BookingService, Customer model)
7. LangChain4j Core (Chains, Prompts, Memory)
8. External LLM API (Azure OpenAI, OpenAI, etc.)
• Data stores: in-memory or optionally an external DB/vector store for RAG (if present).
– Client → Controller (HTTP request)
– Controller → Agent orchestration → Chain steps → LLM API
– Agent calls Tool adapters → Domain service → Data store
– Chain returns text/stream → Controller → Client
C. Show common architectural patterns
• Microservice-style modules: illustrate the web framework, DI container, REST interface.
• CLI-style modules: illustrate simple Java main() invoking LangChain4j chains and printing to console.
• RAG pattern: show document loader → vector store → retriever → chain → LLM.
• Memory pattern: show in-memory or persistent memory store.
• Tooling pattern: show function-calling interfaces with JSON schemas.
D. Technologies & libraries
• Maven (multi-module)
• Java 17+
• LangChain4j core (chains, prompts, memory, tools)
• HTTP clients (OkHttp, WebClient)
• Frameworks: Spring Boot, Quarkus, Helidon MP/SE, Jakarta EE, Wildfly, JavaFX
• Vector stores: Redis, Milvus, Pinecone, Qdrant, Chroma, Couchbase, Infinispan, Neo4j, ElasticSearch, OpenSearch, PgVector, Vespa, Weaviate
• LLM providers: OpenAI, Azure OpenAI, Anthropic, Bedrock, Google Gemini, Ollama, Mistral, OVH.ai, Vertex AI, Voyage.ai
Detail without over-splitting
• Essential layers: project structure, frameworks, chain orchestration, tools, memory, storage, external provider interactions.
• Avoid drawing every single example; focus on grouping modules and fully detailing 1–2 representative flows.