Vector stores
A vector store stores embedded data and performs similarity search.
Pick your embedding model:
- OpenAI
- Azure
- AWS
- VertexAI
- MistralAI
- Cohere
Install dependencies
- npm
- yarn
- pnpm
npm i @langchain/openai
yarn add @langchain/openai
pnpm add @langchain/openai
OPENAI_API_KEY=your-api-key
import { OpenAIEmbeddings } from "@langchain/openai";
const embeddings = new OpenAIEmbeddings({
model: "text-embedding-3-large"
});
Install dependencies
- npm
- yarn
- pnpm
npm i @langchain/openai
yarn add @langchain/openai
pnpm add @langchain/openai
AZURE_OPENAI_API_INSTANCE_NAME=<YOUR_INSTANCE_NAME>
AZURE_OPENAI_API_KEY=<YOUR_KEY>
AZURE_OPENAI_API_VERSION="2024-02-01"
import { AzureOpenAIEmbeddings } from "@langchain/openai";
const embeddings = new AzureOpenAIEmbeddings({
azureOpenAIApiEmbeddingsDeploymentName: "text-embedding-ada-002"
});
Install dependencies
- npm
- yarn
- pnpm
npm i @langchain/aws
yarn add @langchain/aws
pnpm add @langchain/aws
BEDROCK_AWS_REGION=your-region
import { BedrockEmbeddings } from "@langchain/aws";
const embeddings = new BedrockEmbeddings({
model: "amazon.titan-embed-text-v1"
});
Install dependencies
- npm
- yarn
- pnpm
npm i @langchain/google-vertexai
yarn add @langchain/google-vertexai
pnpm add @langchain/google-vertexai
GOOGLE_APPLICATION_CREDENTIALS=credentials.json
import { VertexAIEmbeddings } from "@langchain/google-vertexai";
const embeddings = new VertexAIEmbeddings({
model: "text-embedding-004"
});
Install dependencies
- npm
- yarn
- pnpm
npm i @langchain/mistralai
yarn add @langchain/mistralai
pnpm add @langchain/mistralai
MISTRAL_API_KEY=your-api-key
import { MistralAIEmbeddings } from "@langchain/mistralai";
const embeddings = new MistralAIEmbeddings({
model: "mistral-embed"
});
Install dependencies
- npm
- yarn
- pnpm
npm i @langchain/cohere
yarn add @langchain/cohere
pnpm add @langchain/cohere
COHERE_API_KEY=your-api-key
import { CohereEmbeddings } from "@langchain/cohere";
const embeddings = new CohereEmbeddings({
model: "embed-english-v3.0"
});
Pick your vector store:
- Memory
- Chroma
- FAISS
- MongoDB
- PGVector
- Pinecone
- Qdrant
Install dependencies
- npm
- yarn
- pnpm
npm i langchain
yarn add langchain
pnpm add langchain
import { MemoryVectorStore } from "langchain/vectorstores/memory";
const vectorStore = new MemoryVectorStore(embeddings);
Install dependencies
- npm
- yarn
- pnpm
npm i @langchain/community
yarn add @langchain/community
pnpm add @langchain/community
import { Chroma } from "@langchain/community/vectorstores/chroma";
const vectorStore = new Chroma(embeddings, {
collectionName: "a-test-collection",
});
Install dependencies
- npm
- yarn
- pnpm
npm i @langchain/community
yarn add @langchain/community
pnpm add @langchain/community
import { FaissStore } from "@langchain/community/vectorstores/faiss";
const vectorStore = new FaissStore(embeddings, {});
Install dependencies
- npm
- yarn
- pnpm
npm i @langchain/mongodb
yarn add @langchain/mongodb
pnpm add @langchain/mongodb
import { MongoDBAtlasVectorSearch } from "@langchain/mongodb"
import { MongoClient } from "mongodb";
const client = new MongoClient(process.env.MONGODB_ATLAS_URI || "");
const collection = client
.db(process.env.MONGODB_ATLAS_DB_NAME)
.collection(process.env.MONGODB_ATLAS_COLLECTION_NAME);
const vectorStore = new MongoDBAtlasVectorSearch(embeddings, {
collection: collection,
indexName: "vector_index",
textKey: "text",
embeddingKey: "embedding",
});
Install dependencies
- npm
- yarn
- pnpm
npm i @langchain/community
yarn add @langchain/community
pnpm add @langchain/community
import PGVectorStore from "@langchain/community/vectorstores/pgvector";
const vectorStore = await PGVectorStore.initialize(embeddings, {})
Install dependencies
- npm
- yarn
- pnpm
npm i @langchain/pinecone
yarn add @langchain/pinecone
pnpm add @langchain/pinecone
import { PineconeStore } from "@langchain/pinecone";
import { Pinecone as PineconeClient } from "@pinecone-database/pinecone";
const pinecone = new PineconeClient();
const vectorStore = new PineconeStore(embeddings, {
pineconeIndex,
maxConcurrency: 5,
});
Install dependencies
- npm
- yarn
- pnpm
npm i @langchain/qdrant
yarn add @langchain/qdrant
pnpm add @langchain/qdrant
import { QdrantVectorStore } from "@langchain/qdrant";
const vectorStore = await QdrantVectorStore.fromExistingCollection(embeddings, {
url: process.env.QDRANT_URL,
collectionName: "langchainjs-testing",
});
LangChain.js integrates with a variety of vector stores. You can check out a full list below:
Name | Description |
---|---|
AnalyticDB | AnalyticDB for PostgreSQL is a massively parallel processing (MPP) da... |
Astra DB | Only available on Node.js. |
Azure AI Search | Azure AI Search (formerly known as Azure Search and Azure Cognitive S... |
Azure Cosmos DB for MongoDB vCore | Azure Cosmos DB for MongoDB vCore makes it easy to create a database ... |
Azure Cosmos DB for NoSQL | Azure Cosmos DB for NoSQL provides support for querying items with fl... |
Cassandra | Only available on Node.js. |
Chroma | Chroma is a AI-native |
ClickHouse | Only available on Node.js. |
CloseVector | available on both browser and Node.js |
Cloudflare Vectorize | If you're deploying your project in a Cloudflare worker, you can use ... |
Convex | LangChain.js supports Convex as a vector store, and supports the stan... |
Couchbase | Couchbase is an award-winning distributed NoSQL cloud database that d... |
Elasticsearch | Elasticsearch is a |
Faiss | Faiss is a library for |
Google Vertex AI Matching Engine | Only available on Node.js. |
SAP HANA Cloud Vector Engine | SAP HANA Cloud Vector Engine is a vector store fully integrated into ... |
HNSWLib | HNSWLib is an in-memory vector store that can be saved to a file. It |
LanceDB | LanceDB is an embedded vector database for AI applications. It is ope... |
libSQL | Turso is a SQLite-compatible database built on libSQL, the Open Contr... |
In-memory | LangChain offers is an in-memory, ephemeral vectorstore that stores |
Milvus | Milvus is a vector database built for embeddings similarity search an... |
Momento Vector Index (MVI) | MVI: the most productive, easiest to use, serverless vector index for... |
MongoDB Atlas | This guide provides a quick overview for getting started with MongoDB |
MyScale | Only available on Node.js. |
Neo4j Vector Index | Neo4j is an open-source graph database with integrated support for ve... |
Neon Postgres | Neon is a fully managed serverless PostgreSQL database. It separates ... |
OpenSearch | Only available on Node.js. |
PGVector | To enable vector search in generic PostgreSQL databases, LangChain.js |
Pinecone | Pinecone is a vector database that helps |
Prisma | For augmenting existing models in PostgreSQL database with vector sea... |
Qdrant | Qdrant is a vector similarity search engine. It |
Redis | Redis is a fast open source, in-memory data store. |
Rockset | Rockset is a real-time analyitics SQL database that runs in the cloud. |
SingleStore | SingleStoreDB is a robust, high-performance distributed SQL database ... |
Supabase | Supabase is an open-source Firebase |
Tigris | Tigris makes it easy to build AI applications with vector embeddings. |
Turbopuffer | Setup |
TypeORM | To enable vector search in a generic PostgreSQL database, LangChain.j... |
Typesense | Vector store that utilizes the Typesense search engine. |
Upstash Vector | Upstash Vector is a REST based serverless vector |
USearch | Only available on Node.js. |
Vectara | Vectara is a platform for building GenAI applications. It provides an... |
Vercel Postgres | LangChain.js supports using the @vercel/postgres package to use gener... |
Voy | Voy is a WASM vector similarity search engine written in Rust. |
Weaviate | Weaviate is an open source vector database that |
Xata | Xata is a serverless data platform, based on PostgreSQL. It provides ... |
Zep Open Source | Zep is a long-term memory service for AI Assistant apps. |
Zep Cloud | Zep is a long-term memory service for AI Assistant apps. |