Vector Storage with LangChain VDMS
Posted: Nov 21, 2024.
VDMS (Visual Data Management System) is a powerful storage solution from Intel Labs designed to efficiently handle and search visual data and vector embeddings at scale. This guide will show you how to use VDMS as a vector store in LangChain.
What is VDMS?
VDMS is a storage system optimized for working with embeddings and visual data. It provides:
- Fast k-nearest neighbor (KNN) similarity search
- Support for multiple distance metrics (L2 and inner product)
- Various indexing engines (Faiss, TileDB, Flinng)
- Ability to store and search text, image and video embeddings
- Rich metadata filtering capabilities
The system has a client-server architecture, with a Python client that connects to a VDMS server.
Reference
Key methods for working with VDMS in LangChain:
Method | Description |
---|---|
from_documents() | Create a new VDMS vectorstore from documents |
from_texts() | Create a new VDMS vectorstore from raw texts |
similarity_search() | Find similar documents using KNN search |
similarity_search_with_score() | Find similar documents and return scores |
add_documents() | Add new documents to existing collection |
delete() | Delete documents by ID or metadata |
update_document() | Update an existing document |
How to use VDMS
Setting up VDMS
First, you'll need to run a VDMS server. The easiest way is using Docker:
Then install the Python client:
Basic Usage
Here's how to create and query a VDMS vectorstore:
Advanced Features
Different Indexing Engines
VDMS supports multiple indexing engines:
Metadata Filtering
You can filter search results based on metadata:
Document Management
Update and delete operations:
MMR Search
Use Maximal Marginal Relevance for diverse results:
Using as a Retriever
VDMS can be used as a retriever in LangChain chains:
VDMS provides a robust and scalable solution for vector storage and similarity search in LangChain applications. Its support for multiple indexing engines and distance metrics allows you to optimize for your specific use case, while rich metadata filtering enables complex search scenarios.
An alternative to LangSmith
Open-source LangChain monitoring, prompt management, and magic. Get started in 2 minutes.
LangChain DocsJoin 10,000+ subscribers
Every 2 weeks, latest model releases and industry news.
An alternative to LangSmith
Open-source LangChain monitoring, prompt management, and magic. Get started in 2 minutes.