phago-rag
Biological RAG — query interface on self-organizing Hebbian knowledge graph.
Overview
This crate provides retrieval-augmented generation capabilities:
- Hybrid Query: Combines TF-IDF with graph-based re-ranking
- Structural Queries: Shortest path, centrality, bridges, components
- MCP Adapter: Model Context Protocol integration for external LLMs
- Scoring: Precision, MRR, NDCG metrics
Benchmark Results
| Method | P@5 | MRR | NDCG@10 |
|---|---|---|---|
| Graph-only | 0.280 | 0.650 | 0.357 |
| TF-IDF | 0.742 | 0.775 | 0.404 |
| Hybrid | 0.742 | 0.800 | 0.410 |
The graph's value is in re-ranking TF-IDF candidates using structural context.
Usage
use *;
// Hybrid query (TF-IDF + graph re-ranking)
let results = hybrid_query;
for r in results
MCP Integration
use *;
// Remember a document
phago_remember;
// Recall with hybrid scoring
let results = phago_recall;
// Explore graph structure
let stats = phago_explore;
Part of Phago
This is a subcrate of phago. For most use cases, depend on the main phago crate instead.
License
MIT