Overview
A vector store stores embedded data and performs similarity search.Interface
LangChain provides a unified interface for vector stores, allowing you to:add_documents
- Add documents to the store.delete
- Remove stored documents by ID.similarity_search
- Query for semantically similar documents.
Initialization
To initialize a vector store, provide it with an embedding model:Adding documents
AddDocument
objects (holding page_content
and optional metadata) like so:
Deleting documents
Delete by specifying IDs:Similarity search
Issue a semantic query usingsimilarity_search
, which returns the closest embedded documents:
k
— number of results to returnfilter
— conditional filtering based on metadata
Similarity metrics & indexing
Embedding similarity may be computed using:- Cosine similarity
- Euclidean distance
- Dot product
Metadata filtering
Filtering by metadata (e.g., source, date) can refine search results:Top integrations
Select embedding model:Vectorstore | Delete by ID | Filtering | Search by Vector | Search with score | Async | Passes Standard Tests | Multi Tenancy | IDs in add Documents |
---|---|---|---|---|---|---|---|---|
AstraDBVectorStore | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
Chroma | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Clickhouse | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | ✅ |
CouchbaseSearchVectorStore | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
DatabricksVectorSearch | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
ElasticsearchStore | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
FAISS | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
InMemoryVectorStore | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ✅ |
Milvus | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
MongoDBAtlasVectorSearch | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
openGauss | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ |
PGVector | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
PGVectorStore | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
PineconeVectorStore | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ |
QdrantVectorStore | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
Redis | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
Weaviate | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
SQLServer | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ |
ZeusDB | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |