muthuk1's picture
Massive README update with 12 LLM providers, OpenClaw integration, Ollama support, full architecture docs
c0294cf verified
|
raw
history blame
16.2 kB
# πŸ” GraphRAG Inference Hackathon β€” Dual Pipeline System
<div align="center">
[![TigerGraph](https://img.shields.io/badge/Graph-TigerGraph-FF6B00?style=for-the-badge)](https://www.tigergraph.com/)
[![12 LLMs](https://img.shields.io/badge/LLMs-12_Providers-002B49?style=for-the-badge)](#-supported-llm-providers)
[![OpenClaw](https://img.shields.io/badge/Agent-OpenClaw-cc785c?style=for-the-badge)](#-openclaw-integration)
[![Ollama](https://img.shields.io/badge/Local-Ollama-5db872?style=for-the-badge)](#-ollama-local-models)
[![Next.js](https://img.shields.io/badge/UI-Next.js_15-000?style=for-the-badge&logo=next.js)](https://nextjs.org/)
[![RAGAS](https://img.shields.io/badge/Eval-RAGAS-c64545?style=for-the-badge)](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>