Skip to main content

GraphRAG + LangGraph agent for intelligent knowledge graph reasoning over Neo4j

Project description

GibsGraph

Natural language queries for any Neo4j graph — automatically. Built by Victor Gibson at Gibbr AB

CI Coverage License: MIT Python 3.12+

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.

Roadmap | Changelog | Contributing


What it does (v0.1.1)

  • Natural language queries — ask anything about your Neo4j graph
  • Auto schema discovery — connects and learns your graph structure automatically
  • 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 and Anthropic supported, auto-detected from env keys

Planned (not yet implemented)

  • Text-to-graph ingestion (g.ingest())
  • G-Retriever GNN reasoning
  • PCST subgraph pruning

Quick start

pip install git+https://github.com/gibbrdev/gibsgraph.git
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:

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

Or use a .env file — copy .env.example to get started.


Installation

pip install git+https://github.com/gibbrdev/gibsgraph.git

Optional extras:

pip install "gibsgraph[gnn]"    # G-Retriever GNN (needs GPU/CUDA)
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
    +-- tools/         <- Cypher validator, Mermaid visualizer
    +-- kg_builder/    <- Text to Neo4j (planned)
    +-- 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

pytest                          # All tests
pytest tests/unit/              # Unit only
pytest tests/integration/       # Integration (requires Neo4j)
pytest --cov --cov-report=html  # With coverage report

Stress tests against the Neo4j Movies dataset: 11/11 queries passing (100%).


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:

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

gibsgraph-0.2.0.tar.gz (45.0 kB view details)

Uploaded Source

Built Distribution

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

gibsgraph-0.2.0-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file gibsgraph-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for gibsgraph-0.2.0.tar.gz
Algorithm Hash digest
SHA256 509fb505b96c53469bdefba21e73dfe99b5f62bfeb791483887f259c8d39cf18
MD5 c3b8b78e87960a44bc518adc63fd43ff
BLAKE2b-256 827f2305670a4e7ff236834a70df59979c91c6f485dd5e48f2d26d7116b178d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for gibsgraph-0.2.0.tar.gz:

Publisher: release.yml on gibbrdev/gibsgraph

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

File details

Details for the file gibsgraph-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: gibsgraph-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gibsgraph-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd96c6ff774e6199e6345ba15ff6b54d47f2fc80d5291ed3bcbb37e6aa5b493a
MD5 e04b7afe403e147a11b97154a51e98de
BLAKE2b-256 33af58b4dbbad44b74a38536e02acfa5e791481e0a618264ef0a784d17e7972c

See more details on using hashes here.

Provenance

The following attestation bundles were made for gibsgraph-0.2.0-py3-none-any.whl:

Publisher: release.yml on gibbrdev/gibsgraph

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