Skip to main content

langchain-coordinode

PyPI Python License CI

LangChain integration for CoordiNodeGraphStore implementation and GraphCypherQAChain support for GraphRAG pipelines.

Installation

pip install langchain-coordinode
uv add langchain-coordinode

Requirements

  • Python 3.11+
  • Running CoordiNode instance

Quick Start

GraphCypherQAChain — Question Answering over a Knowledge Graph

from langchain_coordinode import CoordinodeGraph
from langchain_classic.chains import GraphCypherQAChain
from langchain_openai import ChatOpenAI

# Connect to CoordiNode
graph = CoordinodeGraph("localhost:7080")

# Build a QA chain that generates and executes Cypher queries
chain = GraphCypherQAChain.from_llm(
    ChatOpenAI(model="gpt-4o-mini"),
    graph=graph,
    verbose=True,
)

result = chain.invoke({"query": "What concepts are related to attention mechanisms?"})
print(result["result"])

Schema Inspection

from langchain_coordinode import CoordinodeGraph

graph = CoordinodeGraph("localhost:7080")

# Refresh schema from database
graph.refresh_schema()

# Schema string used by the LLM to generate Cypher
print(graph.schema)
# Node properties: Person (name: String, age: Integer), Concept (name: String) ...
# Relationships: (Person)-[:KNOWS]->(Person), (Document)-[:ABOUT]->(Concept) ...

Direct Cypher Queries

from langchain_coordinode import CoordinodeGraph

graph = CoordinodeGraph("localhost:7080")

# Returns List[Dict[str, Any]]
result = graph.query(
    "MATCH (n:Person)-[:KNOWS]->(m) WHERE n.name = $name RETURN m.name AS colleague",
    params={"name": "Alice"},
)
for row in result:
    print(row["colleague"])

LLMGraphTransformer — Extract Knowledge from Text

from langchain_community.graphs.graph_document import GraphDocument
from langchain_openai import ChatOpenAI
from langchain_experimental.graph_transformers import LLMGraphTransformer
from langchain_coordinode import CoordinodeGraph
from langchain_core.documents import Document

graph = CoordinodeGraph("localhost:7080")
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)

transformer = LLMGraphTransformer(llm=llm)

docs = [Document(page_content="Alice knows Bob. Bob works at Acme Corp.")]
graph_docs = transformer.convert_to_graph_documents(docs)

# Store extracted entities and relationships
graph.add_graph_documents(graph_docs)

Connection Options

# host:port string
graph = CoordinodeGraph("localhost:7080")

# TLS
graph = CoordinodeGraph("db.example.com:7443", tls=True)

# Custom timeout
graph = CoordinodeGraph("localhost:7080", timeout=60.0)

API Reference

CoordinodeGraph

Method Description
query(query, params) Execute Cypher, returns List[Dict[str, Any]]
refresh_schema() Reload node/relationship schema from database
add_graph_documents(docs) Batch MERGE nodes + relationships from GraphDocument list
keyword_search(query, k, label, fuzzy, language) Full-text BM25 search — returns [{"id", "score", "snippet"}, …]
similarity_search(query_vector, k, label, property) Vector nearest-neighbour search — returns [{"id", "node", "distance"}, …]
schema Schema string for LLM context
structured_schema Structured schema dict for programmatic access

Related Packages

Package Description
coordinode Core gRPC client
llama-index-graph-stores-coordinode LlamaIndex PropertyGraphStore

Links

Support

USDT TRC-20

USDT (TRC-20), maintainer's personal wallet: TFDsezHa1cBkoeZT5q2T49Wp66K8t2DmdA

License

Apache-2.0

Download files

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

Source Distribution

langchain_coordinode-2.1.1.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

langchain_coordinode-2.1.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file langchain_coordinode-2.1.1.tar.gz.

File metadata

  • Download URL: langchain_coordinode-2.1.1.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for langchain_coordinode-2.1.1.tar.gz
Algorithm Hash digest
SHA256 fcbf1040b5a223fa29b6ad0de8873d38c2b77deb5d81fdc25ba541f31610f0ac
MD5 a4f2dde57b2a015defa2d9208157914f
BLAKE2b-256 f25f5732c5a2b3532c34f11bcc0462966a991829d75c080c768353a49da2e71a

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_coordinode-2.1.1.tar.gz:

Publisher: release.yml on structured-world/coordinode-python

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_coordinode-2.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_coordinode-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c4a289299520f6a143a8d433fe578483fb9d6db61508065e33c1ea560cb5da78
MD5 ea1efa7ef7ddce58724f80f4edc5f706
BLAKE2b-256 f56d594d2f5870f96b390bfe423eabf4362e06bc6f30d917c0c6e3e24814f3d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_coordinode-2.1.1-py3-none-any.whl:

Publisher: release.yml on structured-world/coordinode-python

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

Release history Release notifications | RSS feed

This release

2.1.1 This release

2 files

1.0.6

2 files

1.0.5

2 files

0.6.0

2 files

0.5.0

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

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