Skip to main content

An integration package connecting ArcadeDB and LangChain.

Project description

langchain-arcadedb

PyPI - Version PyPI - License PyPI - Downloads

This package contains the LangChain integration for ArcadeDB, the multi-model database with native graph, document, key-value, time-series, and vector support.

Installation

pip install langchain-arcadedb

This will also install the neo4j Python driver, which is used to connect to ArcadeDB via its native Bolt protocol.

Prerequisites

ArcadeDB must be running with the Bolt protocol plugin enabled.

Docker (quickest way)

docker run --rm -p 2480:2480 -p 7687:7687 \
    -e JAVA_OPTS="-Darcadedb.server.plugins=Bolt:com.arcadedb.bolt.BoltProtocolPlugin" \
    -e arcadedb.server.rootPassword=playwithdata \
    arcadedata/arcadedb:latest

Then create a database (e.g. via the HTTP API):

curl -X POST http://localhost:2480/api/v1/server \
    -d '{"command":"create database mydb"}' \
    -u root:playwithdata \
    -H "Content-Type: application/json"

Server / Embedded

If you run ArcadeDB from a distribution or embedded, add the Bolt plugin to your server configuration:

arcadedb.server.plugins=Bolt:com.arcadedb.bolt.BoltProtocolPlugin

See the ArcadeDB docs for details.

Quick Start

from langchain_arcadedb import ArcadeDBGraph

graph = ArcadeDBGraph(
    url="bolt://localhost:7687",
    username="root",
    password="playwithdata",
    database="mydb",
)

# Schema is auto-detected from existing data
print(graph.get_schema)

# Run Cypher queries
result = graph.query("MATCH (n:Person) RETURN n.name AS name")

Use with GraphCypherQAChain

ArcadeDBGraph implements the GraphStore protocol, so it works as a drop-in replacement wherever LangChain expects a graph store:

from langchain_arcadedb import ArcadeDBGraph
from langchain_neo4j import GraphCypherQAChain
from langchain_openai import ChatOpenAI

graph = ArcadeDBGraph(
    url="bolt://localhost:7687",
    username="root",
    password="playwithdata",
    database="mydb",
)

llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)
chain = GraphCypherQAChain.from_llm(llm=llm, graph=graph, verbose=True)

answer = chain.invoke({"query": "Who does Alice know?"})

Import Graph Documents

You can import structured graph documents directly:

from langchain_arcadedb import ArcadeDBGraph, GraphDocument, Node, Relationship
from langchain_core.documents import Document

graph = ArcadeDBGraph(
    url="bolt://localhost:7687",
    username="root",
    password="playwithdata",
    database="mydb",
)

# Build a graph document
nodes = [
    Node(id="alice", type="Person", properties={"name": "Alice", "age": 30}),
    Node(id="bob", type="Person", properties={"name": "Bob", "age": 25}),
]
relationships = [
    Relationship(source=nodes[0], target=nodes[1], type="KNOWS"),
]
doc = GraphDocument(
    nodes=nodes,
    relationships=relationships,
    source=Document(page_content="Alice knows Bob"),
)

graph.add_graph_documents([doc])

Configuration

Connection parameters can be passed directly or via environment variables:

Parameter Environment Variable Default
url ARCADEDB_URI bolt://localhost:7687
username ARCADEDB_USERNAME root
password ARCADEDB_PASSWORD playwithdata
database ARCADEDB_DATABASE (empty)

Key Features

  • Bolt protocol -- connects via the standard Neo4j Python driver
  • APOC-free -- schema introspection and document import use pure Cypher
  • GraphStore protocol -- works with GraphCypherQAChain out of the box
  • Graph document import -- batched MERGE operations grouped by type
  • Lazy initialization -- connection is established on first use
  • Schema auto-detection -- node labels, relationship types, and property types are inferred from sampled data

Development

# Install dependencies
uv sync --all-groups

# Run unit tests
make test

# Run integration tests (requires a running ArcadeDB instance)
make integration_tests

# Lint & format
make lint
make format

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_arcadedb-0.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_arcadedb-0.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file langchain_arcadedb-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_arcadedb-0.1.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for langchain_arcadedb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8693de0df8f7569460bc551af798ff1c3c4be4a6af63c3afc14ceece5ad334ce
MD5 19dc8ba9061b5202f981216951cbd69b
BLAKE2b-256 c85af1c4353ba66bfb2532a6e5d9fa34da0c93db9c9dc849f944fdde940417da

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_arcadedb-0.1.0.tar.gz:

Publisher: publish.yml on ArcadeData/langchain-arcadedb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_arcadedb-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_arcadedb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8009e799435bde7f1746edbf506b4540f9caf6be4d5704a313339bca91b41131
MD5 92e8291d9996b7cc25f9f85b1a69a9e3
BLAKE2b-256 509444985eb4d7e2c96a49c2b1eb358c11f54ba1157c205a6069284f3550aeff

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_arcadedb-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ArcadeData/langchain-arcadedb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page