Files
langchain4j--langchain4j/README.md
T
wehub-resource-sync 6dd36e490d
snapshot_release / snapshot_release (push) Has been cancelled
Split Package Detection / check-split-packages (push) Has been cancelled
docs: make Chinese README the default
2026-07-13 10:47:00 +00:00

92 lines
5.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- WEHUB_ZH_README -->
> [!NOTE]
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
> [English](./README.en.md) · [原始项目](https://github.com/langchain4j/langchain4j) · [上游 README](https://github.com/langchain4j/langchain4j/blob/HEAD/README.md)
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
# LangChain4j:用于在 JVM 上构建 LLM 驱动应用的惯用、开源 Java 库
[![Build Status](https://img.shields.io/github/actions/workflow/status/langchain4j/langchain4j/main.yaml?branch=main&style=for-the-badge&label=CI%20BUILD&logo=github)](https://github.com/langchain4j/langchain4j/actions/workflows/main.yaml)
[![Nightly Build](https://img.shields.io/github/actions/workflow/status/langchain4j/langchain4j/nightly_jdk17.yaml?branch=main&style=for-the-badge&label=NIGHTLY%20BUILD&logo=github)](https://github.com/langchain4j/langchain4j/actions/workflows/nightly_jdk17.yaml)
[![CODACY](https://img.shields.io/badge/Codacy-Dashboard-blue?style=for-the-badge&logo=codacy)](https://app.codacy.com/gh/langchain4j/langchain4j/dashboard)
[![Discord](https://img.shields.io/discord/1156626270772269217?logo=discord&style=for-the-badge)](https://discord.gg/JzTFvyjG6R)
[![BlueSky](https://img.shields.io/badge/@langchain4j-follow-blue?logo=bluesky&style=for-the-badge)](https://bsky.app/profile/langchain4j.dev)
[![X](https://img.shields.io/badge/@langchain4j-follow-blue?logo=x&style=for-the-badge)](https://x.com/langchain4j)
[![Maven Version](https://img.shields.io/maven-central/v/dev.langchain4j/langchain4j?logo=apachemaven&style=for-the-badge)](https://search.maven.org/#search|gav|1|g:"dev.langchain4j"%20AND%20a:"langchain4j")
## Introduction
欢迎!
LangChain4j 的目标是让 LLM 集成到 Java 应用中变得更简单。
实现方式如下:
1. **统一 API**
LLM 提供商(如 OpenAI 或 Google Vertex AI)和嵌入(向量)存储(如 Pinecone 或 Milvus
各自使用专有 API。LangChain4j 提供统一 API,避免为每个服务单独学习和实现其 API。
若要尝试不同的 LLM 或嵌入存储,你可以轻松切换,而无需重写代码。
LangChain4j 目前支持 [20+ 主流 LLM 提供商](https://docs.langchain4j.dev/integrations/language-models/)
以及 [30+ 嵌入存储](https://docs.langchain4j.dev/integrations/embedding-stores/).
2. **全面的工具箱:**
自 2023 年初以来,社区已构建了大量 LLM 驱动应用,
并总结出常见的抽象、模式与技术。LangChain4j 将这些沉淀为可落地的代码。
我们的工具箱涵盖从底层提示词模板、对话记忆管理、函数调用(function calling
到 Agents、RAG 等高层模式。
针对每种抽象,我们都提供接口,以及基于常见技术的多种开箱即用实现。
无论你是在构建聊天机器人,还是开发从数据摄取到检索的完整 RAG 流水线,
LangChain4j 都能提供丰富选择。
3. **丰富的示例:**
这些[示例](https://github.com/langchain4j/langchain4j-examples) 展示了如何开始创建各类 LLM 驱动应用,
既能提供灵感,也能让你快速上手。
LangChain4j 于 2023 年初 ChatGPT 热潮中开始开发。
我们注意到,相比众多的 Python 与 JavaScript LLM 库和框架,Java 生态缺少对应方案,
而我们需要补上这一空白!
**尽管名字相似,LangChain4j 并非 LangChainPython)的 Java 移植版——它是为 Java 而生,而非从其他语言移植而来。**
它是一款惯用的 Java 库,从设计之初就围绕 Java 惯例构建:
类型安全、POJO、注解、接口、依赖注入、流式 API(fluent APIs),以及与 Quarkus、Spring Boot、Helidon、Micronaut 的一等集成。
其 API、内部实现与发布周期均独立于 Python 版 LangChain 项目。
我们持续关注社区动态,力求快速纳入新技术与集成,
确保你始终跟上最新进展。
该库仍在积极开发中。虽然部分功能仍在完善,
但核心能力已就绪,你现在就可以开始构建 LLM 驱动应用!
## Documentation
文档见[此处](https://docs.langchain4j.dev).
文档聊天机器人(实验性)见[此处](https://chat.langchain4j.dev/).
## Getting Started
入门指南见[此处](https://docs.langchain4j.dev/get-started).
## Code Examples
LangChain4j 用法示例请参见 [langchain4j-examples](https://github.com/langchain4j/langchain4j-examples) 仓库:
- [纯 Java 示例](https://github.com/langchain4j/langchain4j-examples/tree/main/other-examples/src/main/java)
- [Quarkus 示例](https://github.com/quarkiverse/quarkus-langchain4j/tree/main/samples)(使用 [quarkus-langchain4j](https://github.com/quarkiverse/quarkus-langchain4j) 依赖)
- [Spring Boot 示例](https://github.com/langchain4j/langchain4j-examples/tree/main/spring-boot-example/src/main/java/dev/langchain4j/example)
- [Helidon 示例](https://github.com/helidon-io/helidon-examples/tree/helidon-4.x/examples/integrations/langchain4j)(使用 [io.helidon.integrations.langchain4j](https://mvnrepository.com/artifact/io.helidon.integrations.langchain4j) 依赖)
- [Micronaut 示例](https://github.com/micronaut-projects/micronaut-langchain4j/tree/0.3.x/doc-examples/example-openai-java)(使用 [micronaut-langchain4j](https://micronaut-projects.github.io/micronaut-langchain4j/latest/guide/) 依赖)
## Useful Materials
实用资料见[此处](https://docs.langchain4j.dev/useful-materials).
## Get Help
如需帮助,请使用 [Discord](https://discord.gg/JzTFvyjG6R) 或 [GitHub discussions](https://github.com/langchain4j/langchain4j/discussions)
## Request Features
请通过[提交 issue](https://github.com/langchain4j/langchain4j/issues/new/choose). 告知我们你需要的功能。
## Contribute
贡献指南见[此处](https://github.com/langchain4j/langchain4j/blob/main/CONTRIBUTING.md).