langchainjs: 用语言模型构建模块化AI应用

2025年10月01日 17:25:51
28170
AI代理 AI模型 问答机器人 AI语言模型
langchainjs langchain-ai/langchainjs

帮助你用大型语言模型(如 GPT)构建模块化智能应用。 想做 AI 代理?做会读 PDF 的问答机器人?轻松搞定。 简直是生成式 AI 的乐高积木。

项目大小 681.71 KB
涉及语言 TypeScript 88.30% Jupyter Notebook 5.19% HTML 3.65% JavaScript 2.50% Shell 0.16% MDX 0.12% CSS 0.07% Python 0.01%
许可协议 LICENSE
仓库同步说明
  • • 同步需要仓库写入权限以创建目标仓库
  • • 使用平台账号授权登录后将同步到您平台下的个人仓库

🦜️🔗 LangChain.js

⚡ Building applications with LLMs through composability ⚡

npm License: MIT ![Twitter](https://img.shields.io/twitter/url/https/twitter.com/langchainai.svg?style=social&label=Follow @LangChainAI) ![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev Containers&message=Open&color=blue&logo=visualstudiocode)

Looking for the Python version? Check out LangChain.

To help you ship LangChain apps to production faster, check out LangSmith.
LangSmith is a unified developer platform for building, testing, and monitoring LLM applications.

⚡️ Quick Install

You can use npm, yarn, or pnpm to install LangChain.js

npm install -S langchain or yarn add langchain or pnpm add langchain

🌐 Supported Environments

LangChain is written in TypeScript and can be used in:

  • Node.js (ESM and CommonJS) - 18.x, 19.x, 20.x, 22.x
  • Cloudflare Workers
  • Vercel / Next.js (Browser, Serverless and Edge functions)
  • Supabase Edge Functions
  • Browser
  • Deno

🤔 What is LangChain?

LangChain is a framework for developing applications powered by language models. It enables applications that:

  • Are context-aware: connect a language model to sources of context (prompt instructions, few shot examples, content to ground its response in, etc.)
  • Reason: rely on a language model to reason (about how to answer based on provided context, what actions to take, etc.)

This framework consists of several parts.

  • Open-source libraries: Build your applications using LangChain’s open-source building blocks, components, and third-party integrations.
    Use LangGraph.js to build stateful agents with first-class streaming and human-in-the-loop support.
  • Productionization: Use LangSmith to inspect, monitor and evaluate your chains, so that you can continuously optimize and deploy with confidence.
  • Deployment: Turn your LangGraph applications into production-ready APIs and Assistants with LangGraph Cloud.

The LangChain libraries themselves are made up of several different packages.

  • @langchain/core: Base abstractions.
  • @langchain/community: Third party integrations.
  • langchain: Chains, agents, and retrieval strategies that make up an application’s cognitive architecture.
  • LangGraph.js: LangGraph powers production-grade agents, trusted by Linkedin, Uber, Klarna, GitLab, and many more. Build robust and stateful multi-actor applications with LLMs by modeling steps as edges and nodes in a graph. Integrates smoothly with LangChain, but can be used without it.

Integrations may also be split into their own compatible packages.

This library aims to assist in the development of those types of applications. Common examples of these applications include:

❓Question Answering over specific documents

💬 Chatbots

🚀 How does LangChain help?

The main value props of the LangChain libraries are:

  1. Components: composable tools and integrations for working with language models. Components are modular and easy-to-use, whether you are using the rest of the LangChain framework or not
  2. Off-the-shelf chains: built-in assemblages of components for accomplishing higher-level tasks

Off-the-shelf chains make it easy to get started. Components make it easy to customize existing chains and build new ones.

Components fall into the following modules:

📃 Model I/O:

This includes prompt management, prompt optimization, a generic interface for all LLMs, and common utilities for working with LLMs.

📚 Retrieval:

Data Augmented Generation involves specific types of chains that first interact with an external data source to fetch data for use in the generation step. Examples include summarization of long pieces of text and question/answering over specific data sources.

🤖 Agents:

Agents allow an LLM autonomy over how a task is accomplished. Agents make decisions about which Actions to take, then take that Action, observe the result, and repeat until the task is complete. LangChain provides a standard interface for agents, along with LangGraph.js for building custom agents.

📖 Additional Resources

💁 Contributing

As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.

For detailed information on how to contribute, see here.

Please report any security issues or concerns following our security guidelines.

🖇️ Relationship with Python LangChain

This is built to integrate as seamlessly as possible with the LangChain Python package. Specifically, this means all objects (prompts, LLMs, chains, etc) are designed in a way where they can be serialized and shared between languages.


                

                

免责声明 © 2026 - 虚宝阁

本站部分源码来源于网络,版权归属原开发者,用户仅获得使用权。依据《计算机软件保护条例》第十六条,禁止:

  • 逆向工程破解技术保护措施
  • 未经许可的分发行为
  • 去除源码中的原始版权标识

※ 本站源码仅用于学习和研究,禁止用于商业用途。如有侵权, 请及时联系我们进行处理。

侵权举报请提供: 侵权页面URL | 权属证明模板

响应时效:收到完整材料后48小时内处理

相关推荐

Claudable:基于 Next.js 框架的网站生成器

Claudable:基于 Next.js 框架的网站生成器

把你用自然语言描述的应用想法,直接变成可以运行的网站代码。Claudable 背后依赖强大的 AI 编程助手,主要是 Claude Code,也支持 Cursor CLI 来理解你的需求并生成代码。你不需要懂复杂的 API 设置、数据库配置或者部署流程:用简单的语言告诉 Claudable 你想要什么应用。

2525 2025-09-15
fastapi: Python web api 框架

fastapi: Python web api 框架

一个基于 Python 3.6+ 版本的异步 WEB 应用框架,使用 Python 类型注解构建 web API 。主要特点有: 高性能:与 Node JS 和 Go 相当。 编码快:将开发功能的速度提高 2~3 倍。 Bug少:减少大约 40% 的由开发人员导致的错误。 直观:强大的编辑器支持,可智能感知和补全代码。 简单:易于学习和使用,减少文档阅读时间。 简短:尽量减少代码重复。 健壮:获得可用于生产的代码,具有自动交互文档。 基于标准:基于 OpenAPI 和 JSON Schema 。

90539 2025-09-16
ant-design-vue-pro

ant-design-vue-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design Vue like a Pro! (vue2)

10932 2025-09-20
n8n: AI自动化工作流工具

n8n: AI自动化工作流工具

基于节点的自动化工作流工具,能帮助用户轻松创建和管理复杂的自动化流程,无需编写大量代码。并且内置了AI能力,支持 400+ 应用和服务!

146989 2025-09-26
simple-git Node.js 中简单易用的Git操作神器

simple-git Node.js 中简单易用的Git操作神器

Simple-Git 是一个基于 Node.js 的库,它为开发者提供了一种简单而直观的方式来执行 Git 命令。通过使用 Simple-Git,你可以在 Node.js 应用程序中轻松地执行诸如提交、推送、拉取等操作,而无需手动执行 Git 命令行。

3734 2025-09-13
refine: 企业级React后台框架

refine: 企业级React后台框架

这是一个专为构建 CRUD(增删改查)应用设计的 Web 框架,只需一行命令即可生成项目骨架,内置登录、列表、详情、编辑页面等功能。业务逻辑与 UI、路由完全解耦,可灵活集成 Ant Design、Material-UI 等设计系统,适用于快速开发管理后台、仪表盘、内部工具和 B2B 应用。

32865 2025-09-13
TensorFlow.js: javascript界的机器学习大神

TensorFlow.js: javascript界的机器学习大神

TensorFlow.js 把机器学习能力带进了 JavaScript。训练模型、运行推理,甚至搞实时 AI Web 或移动端、Node 后端。谷歌用,创业公司用,爱好者用,用过都说好。

18976 2025-10-01

仓库下载

gitee

GitHub 下载代理

文件信息

文件名
文件大小
文件类型
代理耗时