LambdaDB is a serverless AI database for building scalable RAG and agent applications.This notebook covers how to get started with the LambdaDB vector store in LangChain.
Setup
To access the LambdaDB vector store, you’ll need to create a LambdaDB account, get your project credentials, and install thelangchain-lambdadb integration package.
Credentials
LambdaDB uses project-based authentication with a project URL and API key:Installation
The LangChain LambdaDB integration lives in thelangchain-lambdadb package:
Instantiation
LambdaDBVectorStore works with existing collections. You must create the collection beforehand with proper vector and text indexes configured.Key parameters
client: LambdaDB client instance (required)collection_name: Name of an existing collection in LambdaDB (required)embedding: Embedding function to use (required)text_field: Name of the text field in documents (default: “text”)vector_field: Name of the vector field in documents (default: “vector”)validate_collection: Whether to validate that the collection exists and is active (default: True)default_consistent_read: Use consistent reads by default for immediate consistency, or eventual consistency for better performance (default: False)
Manage vector store
Add items
Documents have a maximum size of 50KB. The integration automatically batches documents into groups of up to 100 to stay within LambdaDB’s 6MB request limit.
Delete items
Get items by ID
Query vector store
Once your vector store has been created and the relevant documents have been added, you will most likely wish to query it during the running of your chain or agent.Similarity search
Performing a simple similarity search:Similarity search with scores
If you want to execute a similarity search and receive the corresponding scores:Similarity search with filtering
LambdaDB supports filtering using query string syntax:Maximal Marginal Relevance (MMR) search
MMR optimizes for both similarity to the query AND diversity among selected documents:Turn into retriever
You can also transform the vector store into a retriever for easier usage in your chains:"similarity": Standard similarity search (default)"mmr": Maximal marginal relevance search"similarity_score_threshold": Similarity search with a score threshold
Async operations
LambdaDBVectorStore supports async methods for all operations:
Currently, async methods run synchronously as the LambdaDB client doesn’t support async operations yet.
Consistency control
LambdaDB supports two consistency modes:- Eventual consistency (default): Faster performance, but data may be up to ~1 minute stale after writes
- Consistent reads: Immediate consistency, slight performance impact
Creating from texts
You can create a vector store and populate it with texts in one step:Usage for retrieval-augmented generation
Here’s a complete example using LambdaDB for RAG:Key features
Document size limits
- Maximum document size: 50KB per document
- The integration validates document sizes and raises an error if exceeded
Batch processing
- Documents are automatically batched in groups of 100 for upsert operations
- Stays within LambdaDB’s 6MB request limit
Filtering
- Supports LambdaDB’s query string syntax for metadata filtering
- Example:
filter={"queryString": {"query": "field:value"}}
Search options
- Similarity search: Find documents similar to a query
- MMR search: Balance similarity and diversity
- Score thresholding: Filter results by similarity score
- Consistent reads: Control read consistency vs. performance trade-off
API reference
For detailed documentation of allLambdaDBVectorStore features and configurations, head to the API reference.
Additional resources
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

