Skip to main content

langchain-ladybug

LangChain integration for the Ladybug graph database.

This package provides:

  • LadybugGraph — a LangChain graph wrapper for Ladybug that supports schema introspection, Cypher queries, and document ingestion via add_graph_documents.
  • LadybugQAChain — a question-answering chain that generates Ladybug-dialect Cypher queries from natural language and returns answers grounded in the graph.
  • Prompt templates (LADYBUG_GENERATION_PROMPT, CYPHER_QA_PROMPT) tuned for the Ladybug Cypher dialect.

Installation

uv pip install langchain-ladybug

The ladybug Python package must also be installed:

uv pip install ladybug

Quick Start

import ladybug as lb
from langchain_ladybug import LadybugGraph, LadybugQAChain
from langchain_openai import ChatOpenAI

db = lb.Database("/path/to/my.db")

graph = LadybugGraph(db)

llm = ChatOpenAI(model="gpt-4o", temperature=0)

chain = LadybugQAChain.from_llm(
    llm=llm,
    graph=graph,
)

answer = chain.invoke({"query": "Who acted in The Godfather?"})
print(answer["result"])

Development

# Install dependencies
uv sync

# Run unit tests
make test

# Lint
make lint

# Format
make format

Acknowledgements

Started from the Kuzu → Ladybug LangChain support port by @adsharma (PR #438) — a proposed LadybugDB (formerly Kuzu) integration into the upstream langchain-community repo

Project Structure

langchain_ladybug/
├── graphs/
│   ├── graph_document.py   # Node, Relationship, GraphDocument data classes
│   └── ladybug_graph.py    # LadybugGraph wrapper
└── chains/
    ├── prompts.py           # Ladybug-dialect Cypher prompt templates
    └── ladybug_qa.py        # LadybugQAChain
tests/
├── unit_tests/             # No network calls
└── integration_tests/      # Requires ladybug

Metadata

Release files for langchain-ladybug 0.3.1

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-ladybug 0.3.1
File Size Uploaded Provenance
langchain_ladybug-0.3.1.tar.gz 237.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-ladybug 0.3.1
File Interpreter ABI Platform
langchain_ladybug-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 247.4 kB

Release files / langchain_ladybug-0.3.1.tar.gz

Download URL langchain_ladybug-0.3.1.tar.gz
Size 237.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f0889fc360241ecd3dbd17478f867853df3faeda68023c24226b3a8973ce4e6d
BLAKE2b-256 checksum
How to use checksums
f8ddd6b9904a4f71454e6851134ed246da24f562210dd00521ac27ea740b29c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.8

Release files / langchain_ladybug-0.3.1-py3-none-any.whl

Download URL langchain_ladybug-0.3.1-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cab20fae1dc9306d6b5a5422e4491744677bf4d0c497cc7cea474f92f14507c3
BLAKE2b-256 checksum
How to use checksums
5c814f91e563c03e707da057a9451e66e1816d79b877cf853c8a22ab6d06dade
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.8

Security for langchain-ladybug 0.3.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files No provenance

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