Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

55 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MemGraphRAG

EXEIO project โ€” authored and maintained by ExeioS33 / EXEIO.

Industrialized API server for MemGraphRAG: a memory-enhanced GraphRAG engine with a three-layer memory (schema / fact / passage), conflict-aware construction, and Personalized PageRank retrieval.

This repository (memgraphrag; remote exeio-memgraphrag) packages the research engine as a LightRAG-style production service: FastAPI REST API, pluggable storage (PostgreSQL + pgvector, Neo4j + GDS), OpenAI-compatible LLM/embedding bindings, Docling-capable file processing, Docker Compose, and uv-based tooling.

๐Ÿš€ Quick start

# Install (requires uv)
uv sync --extra api

# Copy and edit environment
cp env.example .env

# Run API server (file-based defaults; no external DB required)
uv run memgraphrag-server

# Or full stack (API image tagged exeio-memgraphrag:<version>)
docker compose up -d --build

# Optional: CLI + Streamlit clients (talk to the running API)
uv sync --extra client
uv run memgraphrag-cli health
uv run streamlit run memgraphrag/client/app.py

API docs: http://localhost:9621/docs
Clients guide: docs/Clients.md.
Compose image: exeio-memgraphrag:0.1.0 (also :latest). Direct deps are exact-pinned in pyproject.toml; full tree is locked in uv.lock.

๐ŸŽฎ Streamlit playground

Optional emoji-heavy UI for query, ingest, param optimization, and graph exploration (talks to the running API โ€” not baked into the service image):

MemGraphRAG Playground Streamlit UI

๐Ÿ— Architecture overview

flowchart TB
  subgraph API["API layer (FastAPI)"]
    DOC[documents]
    QRY[query]
    GRPH[graph]
    OLL[ollama]
  end

  subgraph FP["File processing"]
    PAR["Parsers: legacy / Docling"]
    CHK["Chunkers: F / R / P"]
  end

  subgraph ENG["MemGraphRAG engine"]
    MEM["Three-layer memory<br/>schema ยท fact ยท passage"]
    PPR["PPR retrieval<br/>igraph / neo4j_gds"]
  end

  subgraph STOR["Pluggable storage"]
    PG["Postgres + pgvector"]
    NEO["Neo4j + GDS"]
    FILE["File defaults<br/>JSON / GraphML / nano-vectordb"]
  end

  LLM["OpenAI-compatible<br/>LLM + embeddings"]

  DOC --> FP
  FP --> ENG
  QRY --> ENG
  GRPH --> ENG
  OLL --> ENG
  ENG --> STOR
  ENG --> LLM
  MEM --> PPR
Loading

๐Ÿง  Three-layer memory

The core engine builds and queries a typed memory graph:

Layer Role
Schema Ontology / type structure for entities and relations
Fact Conflict-aware factual triples extracted from content
Passage Chunk-level evidence nodes linked into the graph

Ingestion runs conflict detection and resolution before installing nodes and edges into the graph.

๐Ÿ”Œ API layer

FastAPI app with routers aligned to LightRAG-style surfaces:

  • documents โ€” upload, status, and pipeline control
  • query โ€” MemGraphRAG-native retrieval and RAG QA
  • graph โ€” graph inspection and operations
  • ollama โ€” Ollama-compatible /api endpoints (prefixes such as /naive, /context, /bypass)

Auth supports JWT (AUTH_ACCOUNTS) and/or API key (MEMGRAPHRAG_API_KEY).

๐Ÿ“„ File processing

  • Parsers: legacy (local PDF/Office/text) and optional Docling (compose profile / external service)
  • Chunkers: F (fixed), R (recursive), P (paragraph / semantic) โ€” selected via env (CHUNK_*)

๐Ÿ’พ Pluggable storage

Selected by MEMGRAPHRAG_{KV,VECTOR,GRAPH,DOC_STATUS}_STORAGE:

Concern Production backends Defaults (no external DB)
KV / doc-status / vector PostgreSQL + pgvector JSON / nano-vectordb
Graph Neo4j 5 + GDS igraph GraphML files

๐Ÿ”Ž PPR retrieval

Personalized PageRank over the memory graph:

  • PPR_ENGINE=igraph (default) โ€” paper-exact local engine
  • PPR_ENGINE=neo4j_gds โ€” Neo4j Graph Data Science alternative

๐Ÿ“ก Langfuse observability

Optional retrieval tracing via Langfuse (LANGFUSE_ENABLE_TRACE, keys, LANGFUSE_BASE_URL / LANGFUSE_HOST). When enabled, each /query emits nested spans for fact linking, PPR, dense fallback, and RAG generation. See docs/LangfuseObservability.md.

๐Ÿค– LLM & embeddings

OpenAI-compatible bindings only (LLM_*, EMBEDDING_*) โ€” point at OpenAI, Azure, vLLM, Ollama OpenAI shim, or any compatible gateway. No local torch/HF embedders in the service image for the POC path.

๐Ÿ“ฆ Code Structure

High-level layout of this industrial server repo:

memgraphrag/                 # repository root
โ”œโ”€โ”€ memgraphrag/             # Python package
โ”‚   โ”œโ”€โ”€ api/                 # FastAPI app, auth, config, routers
โ”‚   โ”œโ”€โ”€ chunker/             # Chunkers F / R / P
โ”‚   โ”œโ”€โ”€ parser/              # Legacy + Docling parsers & registry
โ”‚   โ”œโ”€โ”€ storage/             # KV / vector / graph / doc-status backends
โ”‚   โ”œโ”€โ”€ ppr/                 # igraph & Neo4j GDS Personalized PageRank
โ”‚   โ”œโ”€โ”€ llm/                 # OpenAI-compatible LLM / embedding bindings
โ”‚   โ”œโ”€โ”€ observability/       # Langfuse retrieval tracing (optional)
โ”‚   โ”œโ”€โ”€ client/              # HTTP client, CLI (memgraphrag-cli), Streamlit UI
โ”‚   โ”œโ”€โ”€ openie/              # OpenIE fact extraction
โ”‚   โ”œโ”€โ”€ prompts/             # Prompt templates
โ”‚   โ”œโ”€โ”€ sidecar/             # Sidecar writer utilities
โ”‚   โ”œโ”€โ”€ utils/               # Hashing, tokenizer, env helpers
โ”‚   โ”œโ”€โ”€ core.py              # MemGraphRAG engine (index / retrieve / rag_qa)
โ”‚   โ”œโ”€โ”€ memory.py            # Three-layer memory (schema / fact / passage)
โ”‚   โ”œโ”€โ”€ pipeline.py          # Async ingestion pipeline
โ”‚   โ”œโ”€โ”€ retrieval.py         # Retrieval orchestration
โ”‚   โ”œโ”€โ”€ base.py              # Storage ABCs
โ”‚   โ””โ”€โ”€ rerank.py            # Fact / passage reranking
โ”œโ”€โ”€ docs/                    # Deployment & API guides
โ”œโ”€โ”€ tests/                   # Unit / edge / gated integration tests
โ”œโ”€โ”€ scripts/                 # Helper scripts (e.g. test.sh)
โ”œโ”€โ”€ Dockerfile               # Service image
โ”œโ”€โ”€ docker-compose.yml       # Postgres + Neo4j + app (+ docling profile)
โ”œโ”€โ”€ docker-entrypoint.sh     # Container entrypoint
โ”œโ”€โ”€ pyproject.toml           # Packaging & extras
โ”œโ”€โ”€ env.example              # Environment template
โ”œโ”€โ”€ AGENTS.md                # Agent / contributor conventions
โ””โ”€โ”€ README.md

๐Ÿ“š Documentation

Guides under docs/, including:

๐Ÿค– Agent maintenance

This repository is maintained by AI agents. Conventions, tech stack, and architecture decisions live in AGENTS.md.

๐Ÿ“š Citation

This industrial API server is based on / inspired by the MemGraphRAG research paper. Ownership of this repository remains with EXEIO / ExeioS33.

Paper: arXiv:2606.00610

@article{wu2026memgraphrag,
  title={MemGraphRAG: Memory-based Multi-Agent System for Graph Retrieval-Augmented Generation},
  author={Wu, Chuanjie and Xiang, Zhishang and Tang, Yunbo and Chen, Zerui and Zhang, Qinggang and Su, Jinsong},
  journal={arXiv preprint arXiv:2606.00610},
  year={2026}
}

๐Ÿ“„ License

MIT โ€” see LICENSE. Copyright ยฉ 2026 EXEIO / ExeioS33.

About

Industrialized API server for MemGraphRAG memory-enhanced GraphRAG engine with a three-layer memory (schema / fact / passage), conflict-aware construction, and Personalized PageRank retrieval.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages