LangChain ApertureDB Vector Store - Store and Search Embeddings
Posted: Nov 17, 2024.
ApertureDB is a versatile database designed for storing and managing multi-modal data like text, images, videos, and embeddings along with their metadata. In this guide, we'll explore how to use ApertureDB as a vector store in LangChain for storing and searching document embeddings.
What is ApertureDB Vector Store?
The ApertureDB vector store implementation in LangChain allows you to:
- Store document embeddings in ApertureDB descriptor sets
- Perform similarity searches on stored embeddings
- Support multiple vector stores within a single ApertureDB instance
- Configure different engines and metrics for similarity search
- Handle metadata alongside embeddings
The implementation provides both synchronous and asynchronous APIs for all operations.
Reference
Here are the key methods provided by the ApertureDB vector store:
Method | Description |
---|---|
from_texts() | Create a new vector store from text strings and embeddings |
from_documents() | Create a vector store from Document objects |
add_texts() | Add new texts to an existing vector store |
add_documents() | Add new documents to an existing vector store |
similarity_search() | Find similar documents based on a text query |
similarity_search_with_score() | Find similar documents and return relevance scores |
max_marginal_relevance_search() | Search with diversity optimization |
delete() | Remove documents from the store |
list_vectorstores() | List all vector stores in the database |
How to Use ApertureDB Vector Store
Setting Up the Vector Store
First, initialize ApertureDB with your embeddings model:
Adding Documents
You can add documents in several ways:
Performing Similarity Search
Find similar documents using different search methods:
Managing Vector Stores
ApertureDB allows you to manage multiple vector stores:
Using as a Retriever
The vector store can be used as a retriever in LangChain chains:
Async Operations
Most operations have async equivalents for better performance in async applications:
ApertureDB vector store provides a robust solution for storing and searching document embeddings, with support for multiple search strategies and easy integration into LangChain applications.
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.