Python client for CoordiNode — graph + vector + full-text database
Project description
coordinode
Python gRPC client for CoordiNode — the graph-native hybrid retrieval engine for AI and GraphRAG.
Installation
pip install coordinode
uv add coordinode
Requirements
- Python 3.11+
- Running CoordiNode instance (
docker compose up -dor binary)
Quick Start
from coordinode import CoordinodeClient
# Synchronous client — context manager handles connection lifecycle
with CoordinodeClient("localhost:7080") as db:
# Cypher query — returns List[Dict[str, Any]]
result = db.cypher("RETURN 1 AS n")
print(result) # [{'n': 1}]
# With parameters
rows = db.cypher(
"MATCH (n:Person {name: $name}) RETURN n.age AS age",
params={"name": "Alice"},
)
# Create nodes
db.cypher(
"CREATE (n:Document {title: $title, embedding: $vec})",
params={"title": "RAG intro", "vec": [0.1, 0.2, 0.3, 0.4]},
)
# Health check
assert db.health()
Async Client
import asyncio
from coordinode import AsyncCoordinodeClient
async def main():
async with AsyncCoordinodeClient("localhost:7080") as db:
rows = await db.cypher("MATCH (n:Concept) RETURN n.name AS name LIMIT 5")
for row in rows:
print(row["name"])
asyncio.run(main())
Connection Options
# host:port string
client = CoordinodeClient("localhost:7080")
# Separate host and port
client = CoordinodeClient("localhost", port=7080)
# TLS
client = CoordinodeClient("db.example.com:7443", tls=True)
# Custom timeout (seconds)
client = CoordinodeClient("localhost:7080", timeout=60.0)
Type Mapping
CoordiNode properties map to Python types automatically:
| Python type | CoordiNode type |
|---|---|
int |
int_value |
float |
float_value |
str |
string_value |
bool |
bool_value |
bytes |
bytes_value |
list[float] |
Vector (HNSW-indexable) |
list[Any] |
PropertyList |
dict[str, Any] |
PropertyMap |
None |
unset (null semantics) |
Vector Search
# Store a node with a vector embedding
db.cypher(
"CREATE (d:Doc {title: $title, embedding: $vec})",
params={"title": "RAG intro", "vec": [0.1] * 384},
)
# Nearest-neighbour search
results = db.vector_search(
label="Doc",
property="embedding",
vector=[0.1] * 384,
top_k=10,
metric="cosine", # "cosine" | "l2" | "dot" | "l1"
)
for r in results:
print(r.node.id, r.distance)
Hybrid Search (v0.4+)
Fuse BM25 full-text and vector similarity using Cypher scoring functions:
# Full-text scoring (text_score / text_match) requires a TEXT INDEX on the
# queried property — without it those calls return zero/no matches.
db.create_text_index("idx_doc_body", "Doc", "body")
# Reciprocal Rank Fusion of text + vector. Projecting `d AS doc_id` returns the
# internal node id (an integer) — fetch properties explicitly when needed.
rows = db.cypher("""
MATCH (d:Doc)
WHERE text_match(d, $q) OR d.embedding IS NOT NULL
RETURN d AS doc_id,
d.title AS title,
rrf_score(
text_score(d, $q),
vec_score(d.embedding, $vec)
) AS score
ORDER BY score DESC LIMIT 10
""", params={"q": "graph neural network", "vec": [0.1] * 384})
# Full node properties: db.get_node(rows[0]["doc_id"]).
Helpers available in Cypher (evaluated server-side in coordinode-rs ≥ v0.4.0):
text_score, vec_score, doc_score, text_match, rrf_score,
hybrid_score. These are built-in Cypher functions; nothing to import on the
Python side.
ATTACH / DETACH DOCUMENT (v0.4+)
Promote a nested property to a graph node (and back):
db.cypher("MATCH (a:Article {id: $id}) DETACH DOCUMENT a.body AS (d:Body)",
params={"id": 1})
db.cypher("MATCH (a:Article {id: $id})-[:HAS_BODY]->(d:Body) "
"ATTACH DOCUMENT d INTO a.body", params={"id": 1})
Consistency Controls
# Majority read for strict freshness. `n AS node_id` returns the integer id;
# use get_node(id) or project explicit properties (e.g. n.email AS email).
db.cypher(
"MATCH (n:Account) RETURN n AS node_id, n.email AS email",
read_concern="majority",
)
# Majority write (required for causal reads)
db.cypher("CREATE (n:Event {t: timestamp()})", write_concern="majority")
# Causal read: see at least state at raft index 42
db.cypher("MATCH (n) RETURN count(n) AS total", after_index=42)
Accepted values:
read_concern:local(default) ·majority·linearizable·snapshotwrite_concern:w0·w1(default) ·majorityread_preference:primary(default) ·primary_preferred·secondary·secondary_preferred·nearest
Related Packages
| Package | Description |
|---|---|
langchain-coordinode |
LangChain GraphStore + GraphCypherQAChain |
llama-index-graph-stores-coordinode |
LlamaIndex PropertyGraphStore |
Links
Support
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coordinode-1.0.6.tar.gz.
File metadata
- Download URL: coordinode-1.0.6.tar.gz
- Upload date:
- Size: 40.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d81d49bff1b520484ac9ce13f9b4540d67b26df750a61cbf893339c8f842e04
|
|
| MD5 |
c0174408fdf962dde4b072394ff537d3
|
|
| BLAKE2b-256 |
d03177f9ba3f572c396a9a86fc5e72bb5ae9d36fee6cbd99b3873fb05eeacb85
|
Provenance
The following attestation bundles were made for coordinode-1.0.6.tar.gz:
Publisher:
release.yml on structured-world/coordinode-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coordinode-1.0.6.tar.gz -
Subject digest:
0d81d49bff1b520484ac9ce13f9b4540d67b26df750a61cbf893339c8f842e04 - Sigstore transparency entry: 1435890612
- Sigstore integration time:
-
Permalink:
structured-world/coordinode-python@b5c1ed2a856ab1fc264d3b5ba8de158a699b646b -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/structured-world
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b5c1ed2a856ab1fc264d3b5ba8de158a699b646b -
Trigger Event:
push
-
Statement type:
File details
Details for the file coordinode-1.0.6-py3-none-any.whl.
File metadata
- Download URL: coordinode-1.0.6-py3-none-any.whl
- Upload date:
- Size: 76.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f3b0414ca9f0ca51159e6b5a9c2ce1684510c5ad7bca177d4fedb0b535d52c7
|
|
| MD5 |
ee919e1faf028c45f0d928eba50599bc
|
|
| BLAKE2b-256 |
b9537958523d95a978a0cd3bff496f37c054654bbad023b50da857c781e3ca19
|
Provenance
The following attestation bundles were made for coordinode-1.0.6-py3-none-any.whl:
Publisher:
release.yml on structured-world/coordinode-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coordinode-1.0.6-py3-none-any.whl -
Subject digest:
7f3b0414ca9f0ca51159e6b5a9c2ce1684510c5ad7bca177d4fedb0b535d52c7 - Sigstore transparency entry: 1435890615
- Sigstore integration time:
-
Permalink:
structured-world/coordinode-python@b5c1ed2a856ab1fc264d3b5ba8de158a699b646b -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/structured-world
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b5c1ed2a856ab1fc264d3b5ba8de158a699b646b -
Trigger Event:
push
-
Statement type: