You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+9-54Lines changed: 9 additions & 54 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ We aim to keep the same core APIs between the Python and JS versions of LangChai
21
21
22
22
### Want to add a specific integration?
23
23
24
-
LangChain supports several different types of integrations with third-party providers and frameworks, including LLM providers (e.g. [OpenAI](https://github.com/langchain-ai/langchainjs/blob/main/libs/providers/langchain-openai/src/chat_models.ts)), vector stores (e.g. [FAISS](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community/src/vectorstores/faiss.ts), document loaders (e.g. [Apify](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community/src/document_loaders/web/apify_dataset.ts)) persistent message history stores (e.g. [Redis](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-redis/src/caches.ts)), and more.
24
+
LangChain supports several different types of integrations with third-party providers and frameworks, including LLM providers (e.g. [OpenAI](https://github.com/langchain-ai/langchainjs/blob/main/libs/providers/langchain-openai/src/chat_models.ts)), vector stores (e.g. [FAISS](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community/src/vectorstores/faiss.ts), document loaders (e.g. [Apify](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community/src/document_loaders/web/apify_dataset.ts)) persistent message history stores (e.g. [Redis](https://github.com/langchain-ai/langchainjs/blob/main/libs/providers/langchain-redis/src/caches.ts)), and more.
25
25
26
26
We welcome such contributions, but ask that you read our dedicated [integration contribution guide](https://github.com/langchain-ai/langchainjs/blob/main/.github/contributing/INTEGRATIONS.md) for specific details and patterns to consider before opening a pull request.
27
27
@@ -31,23 +31,6 @@ You can also check out the [guides on extending LangChain.js](https://js.langcha
31
31
32
32
Integrations should generally reside in the `libs/langchain-community` workspace and be imported as `@langchain/community/module/name`. More in-depth integrations or suites of integrations may also reside in separate packages that depend on and extend `@langchain/core`. See [`@langchain/google-genai`](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-google-genai) for an example.
33
33
34
-
To make creating packages like this easier, we offer the [`create-langchain-integration`](https://github.com/langchain-ai/langchainjs/blob/main/libs/create-langchain-integration/) utility that will automatically scaffold a repo with support for both ESM + CJS entrypoints. You can run it like this:
35
-
36
-
```bash
37
-
npx create-langchain-integration
38
-
```
39
-
40
-
After creating the new integration package, you should add it to the [`unit-tests-integrations.yml`](./.github/workflows/unit-tests-integrations.yml) GitHub action workflow so that it is tested in CI. To do this,simply update the `env` section of the `prepare-matrix` job with your package name inside the `PACKAGES` variable:
41
-
42
-
```yaml
43
-
prepare-matrix:
44
-
needs: get-changed-files
45
-
runs-on: ubuntu-latest
46
-
env:
47
-
PACKAGES: "anthropic,cloudflare,<your-package>"
48
-
...
49
-
```
50
-
51
34
### Want to add a feature that's already in Python?
52
35
53
36
If you're interested in contributing a feature that's already in the [LangChain Python repo](https://github.com/langchain-ai/langchain) and you'd like some help getting started, you can try pasting code snippets and classes into the [LangChain Python to JS translator](https://langchain-translator.vercel.app/).
@@ -90,34 +73,9 @@ good code into the codebase.
90
73
As of now, LangChain has an ad hoc release process: releases are cut with high frequency by
91
74
a developer and published to [npm](https://www.npmjs.com/package/langchain).
92
75
93
-
LangChain follows the [semver](https://semver.org/) versioning standard. However, as pre-1.0 software,
94
-
even patch releases may contain [non-backwards-compatible changes](https://semver.org/#spec-item-4).
95
-
96
76
If your contribution has made its way into a release, we will want to give you credit on Twitter (only if you want though)!
97
77
If you have a Twitter account you would like us to mention, please let us know in the PR or in another manner.
98
78
99
-
#### Integration releases
100
-
101
-
The release script can be executed only while on a fresh `main` branch, with no un-committed changes, from the package root. If working from a fork of the repository, make sure to sync the forked `main` branch with the upstream `main` branch first.
102
-
103
-
You can invoke the script by calling `pnpm release`. If new dependencies have been added to the integration package, install them first (i.e. run `pnpm install`, then `pnpm release`).
104
-
105
-
There are three parameters which can be passed to this script, one required and two optional.
106
-
107
-
-**Required**: `<workspace name>`. eg: `@langchain/core` The name of the package to release. Can be found in the `name` value of the package's `package.json`
108
-
-**Optional**: `--bump-deps` eg `--bump-deps` Will find all packages in the repo which depend on this workspace and checkout a new branch, update the dep version, run pnpm install, commit & push to new branch. Generally, this is not necessary.
109
-
-**Optional**: `--tag <tag>` eg `--tag beta` Add a tag to the NPM release. Useful if you want to push a release candidate.
110
-
111
-
This script automatically bumps the package version, creates a new release branch with the changes, pushes the branch to GitHub, uses `release-it` to automatically release to NPM, and more depending on the flags passed.
112
-
113
-
Halfway through this script, you'll be prompted to enter an NPM OTP (typically from an authenticator app). This value is not stored anywhere and is only used to authenticate the NPM release.
114
-
115
-
> **Note** Unless releasing `langchain`, `no` should be answered to all prompts following `Publish @langchain/<package> to npm?`. Then, the change should be manually committed with the following commit message: `<package>[patch]: Release <new version>`. E.g.: `groq[patch]: Release 0.0.1`.
116
-
117
-
Docker must be running if releasing one of `langchain`, `@langchain/core` or `@langchain/community`. These packages run LangChain's export tests, which run inside docker containers.
118
-
119
-
Full example: `pnpm release @langchain/core`.
120
-
121
79
### π οΈ Tooling
122
80
123
81
This project uses the following tools, which are worth getting familiar
@@ -126,10 +84,7 @@ with if you plan to contribute:
-**[eslint](https://eslint.org/)** - enforcing standard lint rules
128
86
-**[prettier](https://prettier.io/)** - enforcing standard code formatting
129
-
-**[jest](https://jestjs.io/)** - testing code
130
-
-**[TypeDoc](https://typedoc.org/)** - reference doc generation from
131
-
comments
132
-
-**[Docusaurus](https://docusaurus.io/)** - static site generation for documentation
87
+
-**[vitest](https://vitest.dev/)** - testing code
133
88
134
89
## π Quick Start
135
90
@@ -144,10 +99,10 @@ Next, try running the following common tasks:
144
99
## β Common Tasks
145
100
146
101
Our goal is to make it as easy as possible for you to contribute to this project.
147
-
All of the below commands should be run from within a workspace directory (e.g. `langchain`, `libs/langchain-community`) unless otherwise noted.
102
+
All of the below commands should be run from within a workspace directory (e.g. `libs/langchain`, `libs/langchain-community`) unless otherwise noted.
148
103
149
104
```bash
150
-
cd langchain
105
+
cdlibs/langchain
151
106
```
152
107
153
108
Or, if you are working on a community integration:
@@ -166,7 +121,7 @@ To get started, you will need to install the dependencies for the project. To do
166
121
pnpm install
167
122
```
168
123
169
-
Then, you will need to switch directories into `langchain-core` and build core by running:
124
+
Then, you will need to switch directories into `libs/langchain-core` and build core by running:
170
125
171
126
```bash
172
127
cd libs/langchain-core
@@ -229,8 +184,8 @@ This is useful for developing individual features.
229
184
If you add support for a new external API, please add a new integration test.
230
185
Integration tests should be called `*.int.test.ts`.
231
186
232
-
Note that most integration tests require credentials or other setup. You will likely need to set up a `langchain/.env` or `libs/langchain-community/.env` file
233
-
like the example [here](https://github.com/langchain-ai/langchainjs/blob/main/langchain/.env.example).
187
+
Note that most integration tests require credentials or other setup. You will likely need to set up a `libs/langchain/.env` or `libs/langchain-community/.env` file
188
+
like the example [here](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain/.env.example).
234
189
235
190
We generally recommend only running integration tests with `pnpm test:single`, but if you want to run all integration tests, run:
236
191
@@ -257,7 +212,7 @@ import { OpenAI } from "langchain/llms/openai";
257
212
We call these subpaths "entrypoints". In general, you should create a new entrypoint if you are adding a new integration with a 3rd party library. If you're adding self-contained functionality without any external dependencies, you can add it to an existing entrypoint.
258
213
259
214
In order to declare a new entrypoint that users can import from, you
260
-
should edit the `langchain/langchain.config.js` or `libs/langchain-community/langchain.config.js` file. To add an
215
+
should edit the `libs/langchain/langchain.config.js` or `libs/langchain-community/langchain.config.js` file. To add an
261
216
entrypoint `tools` that imports from `tools/index.ts` you'd add
262
217
the following to the `entrypoints` key inside the `config` variable:
263
218
@@ -270,7 +225,7 @@ entrypoints: {
270
225
// ...
271
226
```
272
227
273
-
If you're adding a new integration which requires installing a third party dependency, you must add the entrypoint to the `requiresOptionalDependency` array, also located inside `langchain/langchain.config.js` or `libs/langchain-community/langchain.config.js`.
228
+
If you're adding a new integration which requires installing a third party dependency, you must add the entrypoint to the `requiresOptionalDependency` array, also located inside `libs/langchain/langchain.config.js` or `libs/langchain-community/langchain.config.js`.
[](https://opensource.org/licenses/MIT)[](https://twitter.com/langchainai)[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/langchain-ai/langchainjs)
6
-
[<imgsrc="https://github.com/codespaces/badge.svg"title="Open in Github Codespace"width="150"height="20">](https://codespaces.new/langchain-ai/langchainjs)
5
+
LangChain is a framework for building LLM-powered applications. It helps you chain together interoperable components and third-party integrations to simplify AI application development β all while future-proofing decisions as the underlying technology evolves.
7
6
8
-
Looking for the Python version? Check out [LangChain](https://github.com/langchain-ai/langchain).
7
+
**Documentation**: To learn more about LangChain, check out [the docs](https://docs.langchain.com/oss/javascript/langchain/overview).
8
+
9
+
If you're looking for more advanced customization or agent orchestration, check out [LangGraph.js](https://langchain-ai.github.io/langgraphjs/). our framework for building agents and controllable workflows.
10
+
11
+
> [!NOTE]
12
+
> Looking for the Python version? Check out [LangChain](https://github.com/langchain-ai/langchain).
9
13
10
14
To help you ship LangChain apps to production faster, check out [LangSmith](https://smith.langchain.com).
11
15
[LangSmith](https://smith.langchain.com) is a unified developer platform for building, testing, and monitoring LLM applications.
@@ -16,83 +20,37 @@ You can use npm, pnpm, or yarn to install LangChain.js
16
20
17
21
`npm install -S langchain` or `pnpm install langchain` or `yarn add langchain`
18
22
19
-
## π Supported Environments
20
-
21
-
LangChain is written in TypeScript and can be used in:
22
-
23
-
- Node.js (ESM and CommonJS) - 20.x, 22.x, 24.x
24
-
- Cloudflare Workers
25
-
- Vercel / Next.js (Browser, Serverless and Edge functions)
26
-
- Supabase Edge Functions
27
-
- Browser
28
-
- Deno
29
-
30
-
## π€ What is LangChain?
31
-
32
-
**LangChain** is a framework for developing applications powered by language models. It enables applications that:
33
-
34
-
-**Are context-aware**: connect a language model to sources of context (prompt instructions, few shot examples, content to ground its response in, etc.)
35
-
-**Reason**: rely on a language model to reason (about how to answer based on provided context, what actions to take, etc.)
36
-
37
-
This framework consists of several parts.
38
-
39
-
-**Open-source libraries**: Build your applications using LangChain's open-source [building blocks](https://js.langchain.com/docs/concepts/lcel), [components](https://js.langchain.com/docs/concepts), and [third-party integrations](https://js.langchain.com/docs/integrations/platforms/).
40
-
Use [LangGraph.js](https://js.langchain.com/docs/concepts/#langgraphjs) to build stateful agents with first-class streaming and human-in-the-loop support.
41
-
-**Productionization**: Use [LangSmith](https://docs.smith.langchain.com/) to inspect, monitor and evaluate your chains, so that you can continuously optimize and deploy with confidence.
42
-
-**Deployment**: Turn your LangGraph applications into production-ready APIs and Assistants with [LangGraph Cloud](https://docs.langchain.com/langgraph-platform/deployment-quickstart).
43
-
44
-
The LangChain libraries themselves are made up of several different packages.
45
-
46
-
-**[`@langchain/core`](https://github.com/langchain-ai/langchainjs/blob/main/langchain-core)**: Base abstractions.
47
-
-**[`@langchain/community`](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community)**: Third party integrations.
48
-
-**[`langchain`](https://github.com/langchain-ai/langchainjs/blob/main/langchain)**: Chains, agents, and retrieval strategies that make up an application's cognitive architecture.
49
-
-**[LangGraph.js](https://langchain-ai.github.io/langgraphjs/)**: 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.
23
+
## π Why use LangChain?
50
24
51
-
Integrations may also be split into their own compatible packages.
25
+
LangChain helps developers build applications powered by LLMs through a standard interface for agents, models, embeddings, vector stores, and more.
52
26
53
-
This library aims to assist in the development of those types of applications. Common examples of these applications include:
27
+
Use LangChain for:
54
28
55
-
**βQuestion Answering over specific documents**
29
+
-**Real-time data augmentation**. Easily connect LLMs to diverse data sources and external/internal systems, drawing from LangChainβs vast library of integrations with model providers, tools, vector stores, retrievers, and more.
30
+
-**Model interoperability**. Swap models in and out as your engineering team experiments to find the best choice for your applicationβs needs. As the industry frontier evolves, adapt quickly β LangChainβs abstractions keep you moving without losing momentum.
-[LangSmith](https://www.langchain.com/langsmith) - Unified developer platform for building, testing, and monitoring LLM applications. With LangSmith, you can debug poor-performing LLM app runs, evaluate agent trajectories, gain visibility in production, and deploy agents with confidence.
35
+
-[LangGraph](https://docs.langchain.com/oss/javascript/langgraph/overview) - Build agents that can reliably handle complex tasks with LangGraph, our low-level agent orchestration framework. LangGraph offers customizable architecture, long-term memory, and human-in-the-loop workflows β and is trusted in production by companies like LinkedIn, Uber, Klarna, and GitLab.
The main value props of the LangChain libraries are:
68
-
69
-
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
70
-
2.**Off-the-shelf chains**: built-in assemblages of components for accomplishing higher-level tasks
71
-
72
-
Off-the-shelf chains make it easy to get started. Components make it easy to customize existing chains and build new ones.
73
-
74
-
Components fall into the following **modules**:
75
-
76
-
**π Model I/O:**
77
-
78
-
This includes prompt management, prompt optimization, a generic interface for all LLMs, and common utilities for working with LLMs.
79
-
80
-
**π Retrieval:**
81
-
82
-
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.
37
+
## π Supported Environments
83
38
84
-
**π€ Agents:**
39
+
LangChain.js is written in TypeScript and can be used in:
85
40
86
-
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](https://js.langchain.com/docs/concepts/#agents), along with [LangGraph.js](https://github.com/langchain-ai/langgraphjs/) for building custom agents.
41
+
- Node.js (ESM and CommonJS) - 18.x, 19.x, 20.x, 22.x
42
+
- Cloudflare Workers
43
+
- Vercel / Next.js (Browser, Serverless and Edge functions)
44
+
- Supabase Edge Functions
45
+
- Browser
46
+
- Deno
87
47
88
48
## π Additional Resources
89
49
90
-
-[Getting started](https://js.langchain.com/docs/introduction): installation, setting up the environment, simple examples
91
-
- Overview of the [interfaces](https://js.langchain.com/docs/how_to/lcel_cheatsheet/), [modules](https://js.langchain.com/docs/concepts) and [integrations](https://js.langchain.com/docs/integrations/platforms/)
-[Getting started](https://docs.langchain.com/oss/javascript/langchain/overview): Installation, setting up the environment, simple examples
51
+
-[Learn](https://docs.langchain.com/oss/javascript/langchain/learn): Learn about the core concepts of LangChain.
52
+
-[LangChain Forum](https://forum.langchain.com): Connect with the community and share all of your technical questions, ideas, and feedback.
53
+
-[Chat LangChain](https://chat.langchain.com): Ask questions & chat with our documentaiton.
96
54
97
55
## π Contributing
98
56
@@ -101,7 +59,3 @@ As an open-source project in a rapidly developing field, we are extremely open t
101
59
For detailed information on how to contribute, see [here](https://github.com/langchain-ai/langchainjs/blob/main/CONTRIBUTING.md).
102
60
103
61
Please report any security issues or concerns following our [security guidelines](https://github.com/langchain-ai/langchainjs/blob/main/SECURITY.md).
104
-
105
-
## ποΈ Relationship with Python LangChain
106
-
107
-
This is built to integrate as seamlessly as possible with the [LangChain Python package](https://github.com/langchain-ai/langchain). Specifically, this means all objects (prompts, LLMs, chains, etc) are designed in a way where they can be serialized and shared between languages.
0 commit comments