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:
Install dependencies:
Add environment variables:
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

Azure DocumentDB

Azure Cosmos DB for NoSQL

Cloudflare Vectorize

Google Cloud SQL for PostgreSQL

In-memory

Milvus

MongoDB Atlas

Oracle AI Database

Pinecone

Qdrant

Redis

Weaviate

Neo4j Vector Index

PGVector

Turbopuffer

YDB