diff --git a/README.md b/README.md index d38c72d..88af84a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -# LangChain4j: idiomatic, open-source Java library for building LLM-powered applications on the JVM + +> [!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) @@ -12,74 +18,74 @@ ## Introduction -Welcome! +欢迎! -The goal of LangChain4j is to simplify integrating LLMs into Java applications. +LangChain4j 的目标是让 LLM 集成到 Java 应用中变得更简单。 -Here's how: -1. **Unified APIs:** - LLM providers (like OpenAI or Google Vertex AI) and embedding (vector) stores (such as Pinecone or Milvus) - use proprietary APIs. LangChain4j offers a unified API to avoid the need for learning and implementing specific APIs for each of them. - To experiment with different LLMs or embedding stores, you can easily switch between them without the need to rewrite your code. - LangChain4j currently supports [20+ popular LLM providers](https://docs.langchain4j.dev/integrations/language-models/) - and [30+ embedding stores](https://docs.langchain4j.dev/integrations/embedding-stores/). -2. **Comprehensive Toolbox:** - Since early 2023, the community has been building numerous LLM-powered applications, - identifying common abstractions, patterns, and techniques. LangChain4j has refined these into practical code. - Our toolbox includes tools ranging from low-level prompt templating, chat memory management, and function calling - to high-level patterns like Agents and RAG. - For each abstraction, we provide an interface along with multiple ready-to-use implementations based on common techniques. - Whether you're building a chatbot or developing a RAG with a complete pipeline from data ingestion to retrieval, - LangChain4j offers a wide variety of options. -3. **Numerous Examples:** - These [examples](https://github.com/langchain4j/langchain4j-examples) showcase how to begin creating various LLM-powered applications, - providing inspiration and enabling you to start building quickly. +实现方式如下: +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 began development in early 2023 amid the ChatGPT hype. -We noticed a lack of Java counterparts to the numerous Python and JavaScript LLM libraries and frameworks, -and we had to fix that! +LangChain4j 于 2023 年初 ChatGPT 热潮中开始开发。 +我们注意到,相比众多的 Python 与 JavaScript LLM 库和框架,Java 生态缺少对应方案, +而我们需要补上这一空白! -**Despite the name, LangChain4j is not a Java port of LangChain (Python) — it is built for Java, not ported to it.** -It is an idiomatic Java library designed from the ground up around Java conventions: -type safety, POJOs, annotations, interfaces, dependency injection, fluent APIs, and first-class integrations with Quarkus, Spring Boot, Helidon, and Micronaut. -Its API, internals, and release cycle are independent of the Python LangChain project. +**尽管名字相似,LangChain4j 并非 LangChain(Python)的 Java 移植版——它是为 Java 而生,而非从其他语言移植而来。** +它是一款惯用的 Java 库,从设计之初就围绕 Java 惯例构建: +类型安全、POJO、注解、接口、依赖注入、流式 API(fluent APIs),以及与 Quarkus、Spring Boot、Helidon、Micronaut 的一等集成。 +其 API、内部实现与发布周期均独立于 Python 版 LangChain 项目。 -We actively monitor community developments, aiming to quickly incorporate new techniques and integrations, -ensuring you stay up-to-date. -The library is under active development. While some features are still being worked on, -the core functionality is in place, allowing you to start building LLM-powered apps now! +我们持续关注社区动态,力求快速纳入新技术与集成, +确保你始终跟上最新进展。 +该库仍在积极开发中。虽然部分功能仍在完善, +但核心能力已就绪,你现在就可以开始构建 LLM 驱动应用! ## Documentation -Documentation can be found [here](https://docs.langchain4j.dev). +文档见[此处](https://docs.langchain4j.dev). -The documentation chatbot (experimental) can be found [here](https://chat.langchain4j.dev/). +文档聊天机器人(实验性)见[此处](https://chat.langchain4j.dev/). ## Getting Started -Getting started guide can be found [here](https://docs.langchain4j.dev/get-started). +入门指南见[此处](https://docs.langchain4j.dev/get-started). ## Code Examples -Please see examples of how LangChain4j can be used in [langchain4j-examples](https://github.com/langchain4j/langchain4j-examples) repo: -- [Examples in plain Java](https://github.com/langchain4j/langchain4j-examples/tree/main/other-examples/src/main/java) -- [Examples with Quarkus](https://github.com/quarkiverse/quarkus-langchain4j/tree/main/samples) (uses [quarkus-langchain4j](https://github.com/quarkiverse/quarkus-langchain4j) dependency) -- [Example with Spring Boot](https://github.com/langchain4j/langchain4j-examples/tree/main/spring-boot-example/src/main/java/dev/langchain4j/example) -- [Examples with Helidon](https://github.com/helidon-io/helidon-examples/tree/helidon-4.x/examples/integrations/langchain4j) (uses [io.helidon.integrations.langchain4j](https://mvnrepository.com/artifact/io.helidon.integrations.langchain4j) dependency) -- [Examples with Micronaut](https://github.com/micronaut-projects/micronaut-langchain4j/tree/0.3.x/doc-examples/example-openai-java) (uses [micronaut-langchain4j](https://micronaut-projects.github.io/micronaut-langchain4j/latest/guide/) dependency) +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 -Useful materials can be found [here](https://docs.langchain4j.dev/useful-materials). +实用资料见[此处](https://docs.langchain4j.dev/useful-materials). ## Get Help -Please use [Discord](https://discord.gg/JzTFvyjG6R) or [GitHub discussions](https://github.com/langchain4j/langchain4j/discussions) -to get help. +如需帮助,请使用 [Discord](https://discord.gg/JzTFvyjG6R) 或 [GitHub discussions](https://github.com/langchain4j/langchain4j/discussions) +。 ## Request Features -Please let us know what features you need by [opening an issue](https://github.com/langchain4j/langchain4j/issues/new/choose). +请通过[提交 issue](https://github.com/langchain4j/langchain4j/issues/new/choose). 告知我们你需要的功能。 ## Contribute -Contribution guidelines can be found [here](https://github.com/langchain4j/langchain4j/blob/main/CONTRIBUTING.md). +贡献指南见[此处](https://github.com/langchain4j/langchain4j/blob/main/CONTRIBUTING.md).