forked from langchain-ai/langchainjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use a more reasonable syntaz highlight theme (the default one does not highlight keywords like import and await) * Small update to Install instructions * Add yarn/npm install instructions for any place with a npm install command * Update contributing doc * Lint * Add some more cross links and add an index doc for document loaders * Add guide on which vector store to pick * Separate install from getting started * Lint * Lint
- Loading branch information
Showing
20 changed files
with
195 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Setup and Installation | ||
|
||
## Installation | ||
|
||
To get started, install LangChain with the following command: | ||
|
||
```bash npm2yarn | ||
npm install -S langchain | ||
``` | ||
|
||
We currently support LangChain on Node.js 16, 18, and 19. Go [here](https://github.com/hwchase17/langchainjs/discussions/152) to vote on the next environment we should support. | ||
|
||
### Node.js 16 | ||
|
||
If you are running this on Node.js 16, either: | ||
|
||
- run your application with `NODE_OPTIONS='--experimental-fetch' node ...`, or | ||
- install `node-fetch` and follow the instructions [here](https://github.com/node-fetch/node-fetch#providing-global-access) | ||
|
||
If you are running this on Node.js 18 or 19, you do not need to do anything. | ||
|
||
### TypeScript | ||
|
||
If you are using TypeScript we suggest updating your `tsconfig.json` to include the following: | ||
|
||
```json | ||
{ | ||
"compilerOptions": { | ||
... | ||
"target": "ES2020", // or higher | ||
"module": "nodenext", | ||
} | ||
} | ||
``` | ||
|
||
## Loading the library | ||
|
||
### ESM in Node.js | ||
|
||
LangChain is an ESM library currently targeting Node.js environments. To use it, you will need to use the `import` syntax, inside a project with `type: module` in its `package.json`. | ||
|
||
```typescript | ||
import { OpenAI } from "langchain"; | ||
``` | ||
|
||
### CommonJS in Node.js | ||
|
||
If your project is using CommonJS, you can use LangChain only with the dynamic `import()` syntax. | ||
|
||
```typescript | ||
const { OpenAI } = await import("langchain"); | ||
``` | ||
|
||
If you're using TypeScript in a CommonJS project, you'll need to add the following to your `tsconfig.json`: | ||
|
||
```json | ||
{ | ||
"compilerOptions": { | ||
... | ||
"moduleResolution": "node16", | ||
} | ||
} | ||
``` | ||
|
||
### Other environments | ||
|
||
LangChain currently supports only Node.js-based environments. This includes Vercel Serverless functions (but not Edge functions), as well as other serverless environments, like AWS Lambda and Google Cloud Functions. | ||
|
||
We currently do not support running LangChain in the browser. We are listening to the community on additional environments that we should support. Go [here](https://github.com/hwchase17/langchainjs/discussions/152) to vote and discuss the next environments we should support. | ||
|
||
Please see [Deployment](./deployment.md) for more information on deploying LangChain applications. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
sidebar_label: Overview | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Document Loaders | ||
|
||
Document loaders make it easy to create [Documents](../indexes/document.md) from a variety of sources. These documents can then be loaded onto [Vector Stores](../indexes/vector_stores/) to load documents from a source. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
# Vectorstores | ||
|
||
A vectorstore is a particular type of database optimized for storing documents, embeddings, and then allowing for fetching of the most relevant documents for a particular query. | ||
|
||
## Which one to pick? | ||
|
||
Here's a quick guide to help you pick the right vector store for your use case: | ||
|
||
- If you're after something that can just run inside your application, in-memory, without any other servers to stand up, then go for [HNSWLib](./hnswlib.md) | ||
- If you come from Python and you were looking for something similar to FAISS, pick [HNSWLib](./hnswlib.md) | ||
- If you're looking for an open-source full-featured vector database that you can run locally in a docker container, then go for [Chroma](./chroma.md) | ||
- If you're using Supabase already then look at the [Supabase](./supabase.mdx) vector store to use the same Postgres database for your embeddings too | ||
- If you're looking for a production-ready vector store you don't have to worry about hosting yourself, then go for [Pinecone](./pinecone.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.