Skip to main content

langchain-lambdadb

This package contains the LangChain integration with LambdaDB vector store.

Installation

pip install -U langchain-lambdadb

Prerequisites

  • LambdaDB credentials (API key). The collection is created automatically if it does not exist (with a default vector and text index), unless you set create_if_not_exists=False.

To filter by metadata, either create the collection beforehand with index_configs that include those metadata fields, or pass index_configs (and optionally partition_config) when constructing the vector store; in LambdaDB, only fields listed in index_configs can be used as filters.

Optional: Creating a collection manually

You can create a collection in LambdaDB yourself (e.g. to define custom indexes or partitions):

from lambdadb import LambdaDB, models

client = LambdaDB(
    base_url="https://api.lambdadb.ai",
    project_name="playground",
    project_api_key="<your-project-api-key>",
)

client.collections.create(
    collection_name="my_collection",
    index_configs={
        "vector": {
            "type": models.TypeVector.VECTOR,
            "dimensions": 1536,  # Match your embedding dimensions
            "similarity": models.Similarity.COSINE
        },
        "page_content": {
            "type": models.TypeText.TEXT,
            "analyzers": [models.Analyzer.ENGLISH]
        }
    }
)

The index name for the text field (e.g. "page_content") must match the text_field argument when constructing LambdaDBVectorStore (default is "page_content"). If you use a different name (e.g. "text"), pass it as text_field=....

Quick Start

import os
from lambdadb import LambdaDB
from langchain_lambdadb import LambdaDBVectorStore
from langchain_openai import OpenAIEmbeddings
from langchain_core.documents import Document

# Set up LambdaDB client (0.7.0+ use base_url and project_name)
client = LambdaDB(
    base_url=os.getenv("LAMBDADB_BASE_URL", "https://api.lambdadb.ai"),
    project_name=os.getenv("LAMBDADB_PROJECT_NAME", "playground"),
    project_api_key=os.getenv("LAMBDADB_PROJECT_API_KEY"),
)

# Uses existing collection or creates it if missing
vector_store = LambdaDBVectorStore(
    client=client,
    collection_name="my_collection",
    embedding=OpenAIEmbeddings()
)

# Add documents
documents = [
    Document(page_content="LambdaDB is a vector database", metadata={"source": "docs"}),
    Document(page_content="LangChain integrates with LambdaDB", metadata={"source": "docs"}),
]
vector_store.add_documents(documents)

# Search for similar documents
results = vector_store.similarity_search("What is LambdaDB?", k=2)
for doc in results:
    print(f"Content: {doc.page_content}")
    print(f"Metadata: {doc.metadata}")

Configuration

Set the following environment variables:

export LAMBDADB_BASE_URL="https://api.lambdadb.ai"   # optional, this is the default
export LAMBDADB_PROJECT_NAME="playground"             # optional, this is the default
export LAMBDADB_PROJECT_API_KEY="<your-project-api-key>"

Vector Store Features

The LambdaDBVectorStore supports:

  • Document Operations: Add, update, and delete documents
  • Similarity Search: Find similar documents using vector search
  • Metadata Filtering: Filter search results by document metadata
  • Batch Operations: Efficient bulk document processing
  • Async Support: Full async/await support for all operations

Advanced Usage

Similarity Search with Scores

# Get similarity scores with results
results_with_scores = vector_store.similarity_search_with_score(
    query="vector database features",
    k=3
)

for doc, score in results_with_scores:
    print(f"Score: {score:.4f}")
    print(f"Content: {doc.page_content}")

Metadata Filtering

Only metadata fields that are included in the collection's index_configs can be used as filters. If you use the default auto-created collection (no custom index_configs), add documents and use filters only on fields you passed in index_configs when creating the vector store.

# Search with metadata filters (collection must have index_configs for "source")
filtered_results = vector_store.similarity_search(
    query="database",
    k=5,
    filter={"queryString": {"query": "source:documentation"}}
)

Using as a Retriever

# Use as a retriever for RAG applications
retriever = vector_store.as_retriever(
    search_type="similarity",
    search_kwargs={"k": 4}
)

relevant_docs = retriever.invoke("How does LambdaDB work?")

Development

For development and testing:

# Clone the repository
git clone <repository-url>
cd langchain-lambdadb

# Install with development dependencies
poetry install --with test,lint

# Run tests with mock data
make test

# Run integration tests with real LambdaDB (requires credentials)
export LAMBDADB_BASE_URL="https://api.lambdadb.ai"
export LAMBDADB_PROJECT_NAME="playground"
export LAMBDADB_PROJECT_API_KEY="<your-project-api-key>"
# Optional: Use existing collection instead of creating test collections
export LAMBDADB_COLLECTION_NAME="your-test-collection"
make integration_tests

# Lint and format code
make lint
make format

Metadata

Release files for langchain-lambdadb 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-lambdadb 0.2.0
File Size Uploaded Provenance
langchain_lambdadb-0.2.0.tar.gz 12.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-lambdadb 0.2.0
File Interpreter ABI Platform
langchain_lambdadb-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.5 kB

Release files / langchain_lambdadb-0.2.0.tar.gz

Download URL langchain_lambdadb-0.2.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6b7ed3ad60290f18d003333f30c8ba606c03ca9a33a88a62236fdaf73a1e1037
BLAKE2b-256 checksum
How to use checksums
7db48c48d382d1eedb241b1a78e68d931166aa7f607f06607de832bea2f02307
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 6, 2026.

Transparency log

Release files / langchain_lambdadb-0.2.0-py3-none-any.whl

Download URL langchain_lambdadb-0.2.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d045f132e4e47e7d469386e4c356223607ae0ccb0bf82d2187ee998a972fae46
BLAKE2b-256 checksum
How to use checksums
557a46e666fb3ec0a4a482edc6f1e0878fad623d6311c75cd5a9aad19b2e5725
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 6, 2026.

Transparency log

Security for langchain-lambdadb 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_lambdadb-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page