# langchain4j-examples **Repository Path**: code-record/langchain4j-examples ## Basic Information - **Project Name**: langchain4j-examples - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-25 - **Last Updated**: 2026-01-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # [LangChain4j](https://github.com/langchain4j/langchain4j) Examples This repository provides several examples using the LangChain4j library. More examples from the community can be found [here](https://github.com/langchain4j/langchain4j-community-examples). A good place to start includes: - [Tutorials](https://github.com/langchain4j/langchain4j-examples/tree/main/tutorials/src/main/java) - [More examples](https://github.com/langchain4j/langchain4j-examples/tree/main/other-examples/src/main/java) - [Examples of using advanced RAG techniques](https://github.com/langchain4j/langchain4j-examples/tree/main/rag-examples/src/main/java) - [Example of an agent with memory, tools and RAG](https://github.com/langchain4j/langchain4j-examples/blob/5a19b723661530cf64846a256e2b01b060e7fb0b/customer-support-agent-example/src/main/java/dev/langchain4j/example/CustomerSupportAgentApplication.java#L39) If you have any issues or feature requests, please submit them [here](https://github.com/langchain4j/langchain4j/issues/new/choose). ## LangChain4j Examples 项目讲解 这是一个 **LangChain4j** 库的示例项目,版本为 `1.10.0-beta18`。LangChain4j 是一个用于构建 AI 应用的 Java 库,类似于 Python 的 LangChain。 ### 项目概述 这个项目是一个 **Maven 多模块项目**(`packaging=pom`),包含了 40+ 个子模块,展示了 LangChain4j 的各种使用场景和集成方式。 ### 主要模块分类 #### 1. **AI 模型集成示例** - `open-ai-examples` - OpenAI 模型使用示例 - `anthropic-examples` - Anthropic Claude 模型示例 - `azure-open-ai-examples` - Azure OpenAI 服务示例 - `bedrock-examples` - AWS Bedrock 示例 - `mistral-ai-examples` - Mistral AI 模型示例 - `vertex-ai-gemini-examples` - Google Vertex AI Gemini 示例 - `ollama-examples` - 本地 Ollama 模型示例 - `jlama-examples` - JLlama 本地模型示例 - `watsonx-ai-examples` - IBM Watsonx AI 示例 #### 2. **向量数据库集成示例** - `chroma-example` - Chroma 向量数据库 - `elasticsearch-example` - Elasticsearch 向量搜索 - `opensearch-example` - OpenSearch 集成 - `pinecone-example` - Pinecone 向量数据库 - `qdrant-example` - Qdrant 向量数据库 - `weaviate-example` - Weaviate 向量数据库 - `redis-example` - Redis 向量存储 - `milvus-example` - Milvus 向量数据库 - `pgvector-example` - PostgreSQL pgvector 扩展 - `neo4j-example` - Neo4j 图数据库 - `couchbase-example` - Couchbase 集成 - `infinispan-example` - Infinispan 缓存 - `vespa-example` - Vespa 搜索引擎 - `jvector-example` - JVector 向量搜索 - `yugabytedb-example` - YugabyteDB 集成 - `google-alloydb-example` - Google AlloyDB 集成 #### 3. **框架集成示例** - `spring-boot-example` - Spring Boot 集成 - `quarkus-example` - Quarkus 框架集成 - `javafx-example` - JavaFX 桌面应用 - `jakartaee-microprofile-example` - Jakarta EE MicroProfile - `helidon-examples` - Oracle Helidon 框架 - `wildfly-example` - WildFly 应用服务器 - `payara-micro-example` - Payara Micro 服务器 #### 4. **高级功能示例** - `agentic-tutorial` - **Agent 教程**(非常重要) - 基础 Agent - 顺序工作流 - 循环工作流 - 并行工作流 - 条件工作流 - 组合工作流 - 监督编排 - 非 AI Agent - 人机协作 - `rag-examples` - RAG(检索增强生成)技术示例 - `customer-support-agent-example` - 客户支持 Agent 示例 - `azure-open-ai-customer-support-agent-example` - Azure 版本的客户支持 Agent #### 5. **其他示例** - `tutorials` - **基础教程**(推荐从这里开始) - HelloWorld 示例 - 模型参数配置 - 图像模型 - 提示词模板 - 流式输出 - 记忆管理 - 少样本学习 - AI 服务 - 工具调用 - 文档对话 - `other-examples` - 其他各种示例 - `mcp-example` / `mcp-github-example` - MCP (Model Context Protocol) 示例 - `github-models-examples` - GitHub Models API 示例 - `voyage-ai-examples` - Voyage AI 嵌入模型 - `ovh-ai-examples` - OVH AI 服务 - `native-java-gemini-function-calling-example` - 原生 Java Gemini 函数调用 - `gpullama3.java-example` - GPU Llama3 示例 ### 学习路径建议 1. **入门**:从 [`tutorials`](d:\Code\study\langchain4j-dir\langchain4j-examples\tutorials\src\main\java) 模块开始,按顺序学习基础概念 2. **进阶**:学习 [`agentic-tutorial`](d:\Code\study\langchain4j-dir\langchain4j-examples\agentic-tutorial\src\main\java) 中的 Agent 工作流 3. **实战**:参考 [`customer-support-agent-example`](d:\Code\study\langchain4j-dir\langchain4j-examples\customer-support-agent-example) 构建完整应用 4. **集成**:根据需求选择对应的 AI 模型和向量数据库集成 ### 项目特点 - **模块化设计**:每个示例都是独立的模块,便于学习和测试 - **覆盖广泛**:支持主流的 AI 模型、向量数据库和 Java 框架 - **实用性强**:包含真实的业务场景示例(如客户支持 Agent) - **文档完善**:每个模块都有 README 和代码注释 这个项目是学习 LangChain4j 的最佳资源,适合从入门到进阶的各个阶段。