langchain4j /langchain4j

LangChain4j is an idiomatic, open-source Java library for building LLM-powered applications on the JVM. It offers a unified API over popular LLM providers and vector stores, and makes implementing tool calling (including MCP support), agents and RAG easy. It integrates seamlessly with enterprise Java frameworks like Quarkus and Spring Boot.

★ 13,454⑂ 2,716👁 119⑃ 4,054● 2,814▤ 102
JavaApache-2.0Created 2023-06-20docs.langchain4j.dev
下载:1.24.1 and 1.24.1-beta341.24.1 ↓1.24.12026-11-27
+3
日增长
+27
周增长
13,454
stars
2,716
forks
119
watchers
4,054
prs
2,814
issues
102
releases

README

LangChain4j: idiomatic, open-source Java library for building LLM-powered applications on the JVM











 Introduction

Welcome!

The goal of LangChain4j is to simplify integrating LLMs into Java applications.

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
   and 30+ 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 showcase how to begin creating various LLM-powered applications,
   providing inspiration and enabling you to start building quickly.

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!

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.

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!


 Documentation
Documentation can be found here.

The documentation chatbot (experimental) can be found here.


 Getting Started
Getting started guide can be found here.


 Code Examples
Please see examples of how LangChain4j can be used in langchain4j-examples repo:
- Examples in plain Java
- Examples with Quarkus (uses quarkus-langchain4j dependency)
- Example with Spring Boot
- Examples with Helidon (uses io.helidon.integrations.langchain4j dependency)
- Examples

Top issues

Discussions

Latest release

1.24.1 and 1.24.1-beta34 1.24.1 2026-11-27
What's Changed
 Avoid deep regex recursion on long inputs in the prompt injection guardrail and the Azure ACA sessions tool (backport of 7245 to 1.24.x) by @dliubarskyi
 Pass media URLs to the provider instead of downloading them (backport of 7267 to 1.24.x) by @dliubarskyi
 Limit the text extracted by the Apache Tika and PDFBox document parsers (backport of 7271 to 1.24.x) by @dliubarskyi
 Apache PDFBox document parser: a page with more characters than maxCharacters fails early (backport of 7300 to 1.24.x) by @dliubarskyi
 Limit the size, nesting and parse time of SQL metadata filters (b

Snapshot: 2026-11-28T10:06:57Z · Data license Apache-2.0 · JSON