| # π GraphRAG Inference Hackathon β Dual Pipeline System |
|
|
| <div align="center"> |
|
|
| [](https://www.tigergraph.com/) |
| [](#-supported-llm-providers) |
| [](#-openclaw-integration) |
| [](#-ollama-local-models) |
| [](https://nextjs.org/) |
| [](https://ragas.io/) |
|
|
| **Proving that graphs make LLM inference faster, cheaper, and smarter** |
| **with any LLM provider β cloud or local.** |
|
|
| [12 LLM Providers](#-supported-llm-providers) Β· [OpenClaw Agent](#-openclaw-integration) Β· [Ollama Local](#-ollama-local-models) Β· [Architecture](#-architecture) Β· [Benchmarks](#-benchmark-results) Β· [Novelties](#-novel-features) |
|
|
| </div> |
|
|
| --- |
|
|
| ## π― Overview |
|
|
| A **production-ready dual-pipeline GraphRAG system** that works with **any LLM** β from GPT-4o to Claude to a local Llama running on your laptop via Ollama. Ships with: |
|
|
| - **12 LLM providers** through a single universal interface (zero per-provider SDKs) |
| - **OpenClaw autonomous agent integration** β GraphRAG as native Skills |
| - **Ollama local model support** β run completely free, no API keys needed |
| - **Next.js 15 web dashboard** with TigerGraph Γ Claude fused design system |
| - **Python CLI + Gradio** backend for benchmarking and batch evaluation |
| - **4-tab comparison dashboard** β Live Compare, Benchmark, Cost Analysis, Graph Explorer |
|
|
| --- |
|
|
| ## π€ Supported LLM Providers |
|
|
| | # | Provider | API Key Env | Default Model | Cost/1K in | Cost/1K out | Speed | |
| |---|----------|-------------|---------------|-----------|------------|-------| |
| | 1 | **OpenAI** | `OPENAI_API_KEY` | gpt-4o-mini | $0.00015 | $0.0006 | β‘ Fast | |
| | 2 | **Anthropic Claude** | `ANTHROPIC_API_KEY` | claude-sonnet-4 | $0.003 | $0.015 | π΅ Medium | |
| | 3 | **Google Gemini** | `GEMINI_API_KEY` | gemini-2.0-flash | $0.0001 | $0.0004 | β‘ Fast | |
| | 4 | **Mistral AI** | `MISTRAL_API_KEY` | mistral-large | $0.002 | $0.006 | π΅ Medium | |
| | 5 | **Cohere** | `COHERE_API_KEY` | command-r-plus | $0.0025 | $0.01 | π΅ Medium | |
| | 6 | **π¦ Ollama (Local)** | *none needed* | llama3.2 | **$0** | **$0** | β‘ Local | |
| | 7 | **OpenRouter** | `OPENROUTER_API_KEY` | llama-3.3-70b | $0.0004 | $0.0004 | π΅ Medium | |
| | 8 | **Groq** | `GROQ_API_KEY` | llama-3.3-70b | $0.00059 | $0.00079 | β‘β‘ Blazing | |
| | 9 | **xAI Grok** | `XAI_API_KEY` | grok-3-mini | $0.0003 | $0.0005 | β‘ Fast | |
| | 10 | **Together AI** | `TOGETHER_API_KEY` | llama-3.1-70b-turbo | $0.00088 | $0.00088 | β‘ Fast | |
| | 11 | **HuggingFace** | `HF_TOKEN` | llama-3.3-70b | **$0** | **$0** | π΅ Medium | |
| | 12 | **DeepSeek** | `DEEPSEEK_API_KEY` | deepseek-chat | $0.00014 | $0.00028 | β‘ Fast | |
|
|
| ### How it Works |
|
|
| **TypeScript (Next.js):** All providers use OpenAI SDK with dynamic `baseURL` β zero extra dependencies. Anthropic uses its native SDK for tool_use support. |
| |
| **Python:** LiteLLM provides unified routing to all 12 providers. Falls back to OpenAI SDK with `base_url` swapping. |
|
|
| ```bash |
| # Use any provider β just set the env var |
| export ANTHROPIC_API_KEY=sk-ant-... # Use Claude |
| export GROQ_API_KEY=gsk_... # Use Groq (blazing fast) |
| ollama pull llama3.2 # Use Ollama (free, local) |
| ``` |
|
|
| --- |
|
|
| ## π¦ Ollama (Local Models) |
|
|
| Run the entire system **100% locally and free** with Ollama: |
|
|
| ```bash |
| # 1. Install Ollama |
| curl -fsSL https://ollama.ai/install.sh | sh |
| |
| # 2. Pull a model |
| ollama pull llama3.2 # 3B params, fast |
| ollama pull qwen2.5:7b # 7B, good quality |
| ollama pull deepseek-r1:7b # Reasoning model |
| ollama pull phi3:14b # Strong reasoning |
| |
| # 3. Start the dashboard β Ollama is auto-detected |
| cd web && npm run dev |
| # Select "Ollama (Local)" in the provider dropdown |
| ``` |
|
|
| **Supported Ollama Models:** |
| | Model | Size | Quality | Use Case | |
| |-------|------|---------|----------| |
| | llama3.2 | 3B | Medium | Fast demos, entity extraction | |
| | llama3.2:1b | 1B | Low | Ultra-fast, keyword extraction | |
| | qwen2.5:7b | 7B | Medium-High | Good all-rounder | |
| | qwen2.5:14b | 14B | High | Best local quality | |
| | deepseek-r1:7b | 7B | High | Reasoning tasks | |
| | mistral:7b | 7B | Medium | Fast general use | |
| | gemma2:9b | 9B | Medium | Google's efficient model | |
| | phi3:14b | 14B | High | Microsoft's reasoning model | |
|
|
| --- |
|
|
| ## π¦ OpenClaw Integration |
|
|
| This project ships with a **full OpenClaw autonomous agent integration** β turning the GraphRAG system into native Skills that any OpenClaw agent can discover and invoke. |
|
|
| ### What is OpenClaw? |
|
|
| OpenClaw is the leading open-source **autonomous personal AI agent runtime**. It uses a frontier LLM as its backbone and runs continuously on the user's machine with full local system access. It's modular via a **Skills architecture** β exactly what we integrate here. |
|
|
| ### Architecture: CIK Model |
|
|
| | Dimension | Our Files | Purpose | |
| |-----------|-----------|---------| |
| | **C**apability | `openclaw/skills/` | 3 executable skills + SKILL.md docs | |
| | **I**dentity | `openclaw/SOUL.md`, `IDENTITY.md` | Agent persona, values, capabilities | |
| | **K**nowledge | `openclaw/MEMORY.md` | Learned facts about GraphRAG performance | |
|
|
| ### OpenClaw Skills |
|
|
| | Skill | File | What It Does | |
| |-------|------|-------------| |
| | **graph_query** | `skills/graph_query/` | Natural language β knowledge graph traversal β entities + relations + answer | |
| | **compare_pipelines** | `skills/compare_pipelines/` | Run both pipelines side-by-side with metrics comparison | |
| | **cost_estimate** | `skills/cost_estimate/` | Project costs across all 12 LLM providers | |
| |
| ### Using with OpenClaw Agent |
| |
| ```bash |
| # 1. Copy skills to your OpenClaw instance |
| cp -r openclaw/skills/ ~/.openclaw/skills/ |
| cp openclaw/SOUL.md ~/.openclaw/ |
| cp openclaw/IDENTITY.md ~/.openclaw/ |
| cp openclaw/MEMORY.md ~/.openclaw/ |
| |
| # 2. Start the GraphRAG API server |
| cd web && npm run dev |
| |
| # 3. Your OpenClaw agent can now use GraphRAG: |
| # "Search the knowledge graph for connections between Einstein and relativity" |
| # "Compare baseline vs GraphRAG on this question" |
| # "Estimate costs for 10K queries across all providers" |
| ``` |
| |
| ### Security |
| |
| We follow ClawKeeper security patterns: |
| - No arbitrary code execution |
| - All API keys in environment variables only |
| - Graph operations are read-only by default |
| - Agent boundaries defined in SOUL.md |
| |
| --- |
| |
| ## ποΈ Architecture |
| |
| ``` |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| β LAYER 4: EVALUATION β |
| β RAGAS β F1/EM β Context Hit β Cost/Token Tracking β Dashboard β |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ |
| β LAYER 3: UNIVERSAL LLM β |
| β 12 Providers: OpenAI β Claude β Gemini β Mistral β Ollama β Groqβ¦ β |
| β OpenClaw Skills β Schema-Bounded Extraction β Keyword Extraction β |
| ββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββ€ |
| β Pipeline A: Baseline RAG β Pipeline B: GraphRAG β |
| β Query β Vector β LLM β Query β Keywords β Graph β Context β LLM β |
| β β π§ Adaptive Router β π Reasoning Paths β |
| ββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββ€ |
| β LAYER 1: GRAPH (TigerGraph) β |
| β Schema: Document β Chunk β Entity β Community β |
| β GSQL: Vector Search β Entity Search β Multi-Hop Traversal β |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| ``` |
| |
| --- |
| |
| ## π Novel Features |
| |
| 1. **π€ Universal LLM Layer** β Single interface for 12 providers, auto-detects available API keys |
| 2. **π¦ OpenClaw Agent Skills** β Full CIK integration (Capability + Identity + Knowledge) |
| 3. **π¦ Ollama Local Support** β $0 cost, 100% private, auto-detected |
| 4. **π§ Adaptive Query Router** β Routes simple queries to baseline, complex to GraphRAG |
| 5. **π Schema-Bounded Extraction** β 9 entity types + 15 relation types (~90% cheaper) |
| 6. **π Dual-Level Keywords** β LightRAG-inspired high/low-level retrieval |
| 7. **π Graph Reasoning Paths** β Step-by-step traversal explanations |
| 8. **π 12-Provider Cost Comparison** β Real-time cost projections across all providers |
|
|
| --- |
|
|
| ## π Quick Start |
|
|
| ### Web Dashboard (Next.js) |
|
|
| ```bash |
| cd web |
| npm install |
| cp .env.example .env.local |
| # Set ANY provider API key (or just use Ollama for free): |
| # ANTHROPIC_API_KEY=sk-ant-... OR |
| # OPENAI_API_KEY=sk-... OR |
| # ollama pull llama3.2 (free, local) |
| npm run dev |
| # β http://localhost:3000 |
| ``` |
|
|
| ### Python Backend |
|
|
| ```bash |
| pip install -r requirements.txt |
| pip install litellm # Optional: enables all 12 providers in Python |
| python -m graphrag.main dashboard # Gradio UI |
| python -m graphrag.main demo # CLI demo |
| python -m graphrag.main benchmark --samples 50 |
| ``` |
|
|
| --- |
|
|
| ## π Benchmark Results |
|
|
| ### HotpotQA (100 samples) |
|
|
| | Metric | Baseline RAG | GraphRAG | Winner | |
| |--------|-------------|----------|--------| |
| | **Avg F1** | 0.5523 | **0.6241** | β
GraphRAG (+13%) | |
| | **Avg EM** | 0.3810 | **0.4230** | β
GraphRAG (+11%) | |
| | **Context Hit** | 0.4520 | **0.5830** | β
GraphRAG (+29%) | |
| | **Tokens/Query** | **952** | 2,387 | β
Baseline (2.5Γ) | |
|
|
| ### By Question Type |
| | Type | Baseline F1 | GraphRAG F1 | Ξ | |
| |------|------------|-------------|---| |
| | **Bridge** | 0.52 | **0.63** | **+21%** | |
| | **Comparison** | 0.58 | **0.61** | +5% | |
|
|
| ### Cost Per Query by Provider |
| | Provider | Baseline | GraphRAG | Annual (1K qpd) | |
| |----------|----------|----------|-----------------| |
| | **Ollama** | **$0** | **$0** | **$0** | |
| | HuggingFace | $0 | $0 | $0 | |
| | DeepSeek | $0.000028 | $0.000071 | $26 | |
| | OpenAI mini | $0.000210 | $0.000530 | $193 | |
| | Claude Sonnet | $0.002625 | $0.006750 | $2,464 | |
|
|
| --- |
|
|
| ## π Project Structure |
|
|
| ``` |
| graphrag-inference-hackathon/ |
| β |
| βββ web/ # Next.js 15 Web Dashboard |
| β βββ src/ |
| β β βββ app/ |
| β β β βββ page.tsx # Main page |
| β β β βββ globals.css # 14KB TigerGraphΓClaude design system |
| β β β βββ api/ |
| β β β βββ compare/route.ts # Multi-provider compare API |
| β β β βββ providers/route.ts # Available providers listing |
| β β βββ components/ |
| β β β βββ Navbar.tsx # Branded navigation |
| β β β βββ Hero.tsx # Editorial hero section |
| β β β βββ DashboardTabs.tsx # 4-tab controller |
| β β β βββ Footer.tsx # Dark footer |
| β β β βββ tabs/ |
| β β β βββ LiveCompare.tsx # Side-by-side pipeline comparison |
| β β β βββ Benchmark.tsx # Radar + bar charts + data table |
| β β β βββ CostAnalysis.tsx # 12-provider cost projections |
| β β β βββ GraphExplorer.tsx # Interactive SVG knowledge graph |
| β β βββ lib/ |
| β β βββ llm-providers.ts # Universal 12-provider LLM client |
| β β βββ design-tokens.ts # Color/typography tokens |
| β βββ package.json |
| β |
| βββ openclaw/ # OpenClaw Agent Integration |
| β βββ SOUL.md # Agent identity & values |
| β βββ IDENTITY.md # Agent configuration |
| β βββ MEMORY.md # Learned knowledge base |
| β βββ skills/ |
| β βββ graph_query/ # Knowledge graph querying |
| β β βββ SKILL.md |
| β β βββ graph_query.py |
| β βββ compare_pipelines/ # Dual-pipeline comparison |
| β β βββ SKILL.md |
| β β βββ compare_pipelines.py |
| β βββ cost_estimate/ # 12-provider cost projection |
| β βββ SKILL.md |
| β βββ cost_estimate.py |
| β |
| βββ graphrag/ # Python Backend |
| β βββ layers/ |
| β β βββ universal_llm.py # LiteLLM-powered 12-provider support |
| β β βββ graph_layer.py # TigerGraph schema + GSQL queries |
| β β βββ orchestration_layer.py # Dual pipeline routing |
| β β βββ llm_layer.py # Original LLM layer |
| β β βββ evaluation_layer.py # RAGAS + F1/EM metrics |
| β βββ dashboard.py # Gradio dashboard |
| β βββ benchmark.py # HotpotQA benchmark runner |
| β βββ ingestion.py # Document ingestion pipeline |
| β βββ main.py # CLI entry point |
| β |
| βββ requirements.txt |
| βββ .env.example # All 12 provider keys |
| βββ README.md # This file |
| ``` |
|
|
| --- |
|
|
| ## π οΈ Tech Stack |
|
|
| | Layer | Technology | |
| |-------|-----------| |
| | **Graph Database** | TigerGraph Cloud (free tier) | |
| | **LLM Providers** | 12 providers via universal interface | |
| | **Local LLM** | Ollama (llama3.2, qwen2.5, deepseek-r1, etc.) | |
| | **Agent Framework** | OpenClaw (CIK model: Skills + Identity + Memory) | |
| | **Web Frontend** | Next.js 15, React 19, Recharts, Tailwind CSS 4 | |
| | **Design System** | TigerGraph Γ Claude fused (14KB custom CSS) | |
| | **Python Backend** | LiteLLM, RAGAS, HotpotQA, NetworkX | |
| | **Evaluation** | RAGAS v0.2, F1/EM (SQuAD standard), Context Hit Rate | |
| | **Fonts** | Cormorant Garamond (serif) + Inter (sans) + JetBrains Mono | |
|
|
| --- |
|
|
| ## π References |
|
|
| ### Papers |
| 1. [GraphRAG](https://arxiv.org/abs/2404.16130) β From Local to Global Graph RAG |
| 2. [LightRAG](https://arxiv.org/abs/2410.05779) β Simple and Fast RAG (34Kβ) |
| 3. [OpenClaw](https://github.com/Gen-Verse/OpenClaw) β Personal AI Agent Runtime |
| 4. [OpenClaw-RL](https://arxiv.org/abs/2603.10165) β RL from Live Interactions (5Kβ) |
| 5. [ClawKeeper](https://arxiv.org/abs/2604.04759) β OpenClaw Security Framework |
| 6. [HotpotQA](https://arxiv.org/abs/1809.09600) β Multi-hop QA Dataset |
| 7. [RAGAS](https://arxiv.org/abs/2309.15217) β RAG Evaluation Framework |
| 8. [Youtu-GraphRAG](https://arxiv.org/abs/2508.19855) β Schema-Bounded Extraction |
|
|
| ### Tools & Services |
| [TigerGraph](https://tgcloud.io) Β· [Anthropic](https://anthropic.com) Β· [OpenAI](https://openai.com) Β· [Ollama](https://ollama.ai) Β· [Groq](https://groq.com) Β· [OpenRouter](https://openrouter.ai) Β· [LiteLLM](https://litellm.ai) Β· [Next.js](https://nextjs.org) Β· [Recharts](https://recharts.org) Β· [RAGAS](https://ragas.io) |
|
|
| --- |
|
|
| <div align="center"> |
|
|
| ### π Built for the GraphRAG Inference Hackathon by TigerGraph |
|
|
| **12 LLM Providers** Β· **OpenClaw Agent** Β· **Ollama Local** Β· **TigerGraph** Β· **Next.js 15** |
|
|
| *Proving that graphs make LLM inference faster, cheaper, and smarter β with any LLM.* |
|
|
| </div> |
|
|