Skip to main content

Overview

A vector store stores embedded data and performs similarity search.

Interface

LangChain provides a unified interface for vector stores, allowing you to:
  • addDocuments - Add documents to the store.
  • delete - Remove stored documents by ID.
  • similaritySearch - Query for semantically similar documents.
This abstraction lets you switch between different implementations without altering your application logic.

Initialization

Most vectorstores in LangChain accept an embedding model as an argument when initializing the vector store.

Adding documents

You can add documents to the vector store by using the addDocuments function.

Deleting documents

You can delete documents from the vector store by using the delete function.
Issue a semantic query using similaritySearch, which returns the closest embedded documents:
Many vector stores support parameters like:
  • k — number of results to return
  • filter — conditional filtering based on metadata

Similarity metrics & indexing

Embedding similarity may be computed using:
  • Cosine similarity
  • Euclidean distance
  • Dot product
Efficient search often employs indexing methods such as HNSW (Hierarchical Navigable Small World), though specifics depend on the vector store.

Metadata filtering

Filtering by metadata (e.g., source, date) can refine search results:

Top integrations

Select embedding model:
Install dependencies:
Add environment variables:
Instantiate the model:
Install dependencies
Add environment variables:
Instantiate the model:
Install dependencies:
Add environment variables:
Instantiate the model:
Install dependencies:
Add environment variables:
Instantiate the model:
Install dependencies:
Add environment variables:
Instantiate the model:
Install dependencies:
Add environment variables:
Instantiate the model:
Install dependencies:
Add environment variables:
Instantiate the model:
Install dependencies:
Instantiate the model:
Select vector store:
LangChain.js integrates with a variety of vector stores. You can check out a full list below:

All vector stores

AnalyticDB

Astra DB

Azion EdgeSQL

Azure AI Search

Azure DocumentDB

Azure Cosmos DB for NoSQL

Cassandra

Chroma

ClickHouse

CloseVector

Cloudflare Vectorize

Convex

Couchbase Query

Couchbase Search

Elasticsearch

Faiss

Google Cloud SQL for PostgreSQL

Google Vertex AI Matching Engine

SAP HANA Cloud Vector Engine

HNSWLib

LanceDB

libSQL

MariaDB

In-memory

Milvus

Momento Vector Index (MVI)

MongoDB Atlas

MyScale

Neo4j Vector Index

Neon Postgres

Oracle AI Database

OpenSearch

PGVector

Pinecone

Prisma

Qdrant

Redis

Rockset

SingleStore

Supabase

Tigris

turbopuffer

TypeORM

Typesense

Upstash Vector

USearch

Vectara

Vercel Postgres

Voy

Weaviate

Xata

Zep Open Source

Zep Cloud