GraphRAG + LangGraph agent for intelligent knowledge graph reasoning over Neo4j
Project description
GibsGraph
Natural language queries for any Neo4j graph — automatically. Built by V.Gibson at Gibbr AB
GibsGraph connects to any Neo4j knowledge graph, auto-discovers its schema, and lets you ask questions in plain English. It generates Cypher automatically, retrieves the relevant subgraph, and returns a grounded answer — with the Cypher shown so you can verify what was queried.
What it does (v0.3.5)
- Natural language queries — ask anything about your Neo4j graph
- Text-to-graph ingestion —
g.ingest("any text")extracts entities and relationships into Neo4j automatically - Expert knowledge graph — 920 records: 36 clauses, 133 functions, 446 examples, 23 modeling patterns, 318 best practices
- Bundled expert data — works out of the box without loading data into Neo4j first (quality-filtered to ~849 records)
- 4-stage validation — syntactic → structural → semantic → domain, with enterprise severity levels
- Auto schema discovery — connects and learns your graph structure automatically
- PCST subgraph pruning — prunes vector neighbourhoods to the most query-relevant subset (opt-in, requires
gibsgraph[gnn]) - Dual retrieval — vector search (when index exists) with text-to-Cypher fallback
- Cypher self-healing — if generated Cypher fails, the error is sent back to the LLM for correction
- Cypher transparency — see exactly what was queried
- Visualization — Mermaid diagrams and Neo4j Bloom deep links
- Secure by default — read-only transactions, parameterized Cypher, injection validation
- LLM flexibility — OpenAI, Anthropic, Mistral, xAI/Grok — auto-detected from env keys
Planned (not yet implemented)
- G-Retriever GNN reasoning
Quick start
pip install gibsgraph
from gibsgraph import Graph
# Connect — auto-detects LLM from your env keys
g = Graph("bolt://localhost:7687", password="your-password")
# Ask anything
result = g.ask("What movies did Tom Hanks act in?")
print(result) # the answer
print(result.cypher) # Cypher that was run
print(result.confidence) # 0.0-1.0
print(result.visualization) # Mermaid diagram string
g.close() # or use: with Graph(...) as g:
# Ingest text into your graph
g = Graph("bolt://localhost:7687", password="your-password", read_only=False)
g.ingest("Apple acquired Beats Electronics for $3 billion in 2014.", source="news")
g.close()
Configuration
Set environment variables (or pass them directly):
export NEO4J_URI=bolt://localhost:7687
export NEO4J_PASSWORD=your_password
export OPENAI_API_KEY=sk-... # or ANTHROPIC_API_KEY, MISTRAL_API_KEY, XAI_API_KEY
Or use a .env file — copy .env.example to get started.
Installation
pip install gibsgraph
Optional extras:
pip install "gibsgraph[mistral]" # Mistral LLM support
pip install "gibsgraph[gnn]" # PCST pruning + G-Retriever GNN
pip install "gibsgraph[ui]" # Streamlit demo UI
pip install "gibsgraph[full]" # everything including dev tools
Docker
cp .env.example .env
# Edit .env with your Neo4j password and API key
docker compose up
# Open http://localhost:8501
Architecture
User Query
|
v
LangGraph Agent (agent.py)
+-- retrieval/ <- Auto schema discovery + text-to-Cypher + vector search + PCST pruning
+-- tools/ <- Cypher validator, Mermaid visualizer
+-- training/ <- 4-stage validation (syntactic/structural/semantic/domain)
+-- expert.py <- ExpertStore + BundledExpertStore (JSONL fallback)
+-- data/ <- Bundled expert JSONL (clauses, functions, examples, patterns, practices)
+-- kg_builder/ <- Text to Neo4j via SimpleKGPipeline
+-- gnn/ <- G-Retriever inference (planned)
|
v
Neo4j Knowledge Graph
Examples
| Example | Description |
|---|---|
examples/regulatory_kg.py |
EU regulatory knowledge graph (gibs.dev use case) |
Testing
281 unit tests, 80% coverage.
pytest # All tests
pytest tests/unit/ # Unit only
pytest tests/integration/ # Integration (requires Neo4j)
pytest --cov --cov-report=html # With coverage report
Contributing
Contributions welcome! Please read CONTRIBUTING.md first.
pip install -e ".[dev]"
ruff check src/ tests/
mypy src/gibsgraph
pytest
License
MIT — see LICENSE
Acknowledgements
Built on:
- neo4j-graphrag-python
- LangGraph
- G-Retriever (He et al., 2024)
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
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 gibsgraph-0.3.5.tar.gz.
File metadata
- Download URL: gibsgraph-0.3.5.tar.gz
- Upload date:
- Size: 263.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67c2ba5bee1558b80863ac3dff8ed17f46c52706e21638941b0c37c864cf2ec4
|
|
| MD5 |
54dffb02b089cf76b6d4b67203174ff3
|
|
| BLAKE2b-256 |
a1fa13cd367c6214c99cb368dc722bafcb319fa566025df6a4e3dad135f5ebb3
|
Provenance
The following attestation bundles were made for gibsgraph-0.3.5.tar.gz:
Publisher:
release.yml on gibbrdev/gibsgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gibsgraph-0.3.5.tar.gz -
Subject digest:
67c2ba5bee1558b80863ac3dff8ed17f46c52706e21638941b0c37c864cf2ec4 - Sigstore transparency entry: 1003659153
- Sigstore integration time:
-
Permalink:
gibbrdev/gibsgraph@a054ff1f07925eae12b66bd7e3fc7afa107272fa -
Branch / Tag:
refs/tags/v0.3.5 - Owner: https://github.com/gibbrdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a054ff1f07925eae12b66bd7e3fc7afa107272fa -
Trigger Event:
push
-
Statement type:
File details
Details for the file gibsgraph-0.3.5-py3-none-any.whl.
File metadata
- Download URL: gibsgraph-0.3.5-py3-none-any.whl
- Upload date:
- Size: 210.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11300787336096243b42deaeda0620dfb5a066405d53a1a3116e8d5fc0f3d34d
|
|
| MD5 |
cc4ccc5367e5fd2af584d1e0ad0ccf25
|
|
| BLAKE2b-256 |
d2d6aeac7f6d037ebfc82ee164554fcfae33622120ccc877b87900a737509385
|
Provenance
The following attestation bundles were made for gibsgraph-0.3.5-py3-none-any.whl:
Publisher:
release.yml on gibbrdev/gibsgraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gibsgraph-0.3.5-py3-none-any.whl -
Subject digest:
11300787336096243b42deaeda0620dfb5a066405d53a1a3116e8d5fc0f3d34d - Sigstore transparency entry: 1003659156
- Sigstore integration time:
-
Permalink:
gibbrdev/gibsgraph@a054ff1f07925eae12b66bd7e3fc7afa107272fa -
Branch / Tag:
refs/tags/v0.3.5 - Owner: https://github.com/gibbrdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a054ff1f07925eae12b66bd7e3fc7afa107272fa -
Trigger Event:
push
-
Statement type: