GoRAG is a production-ready Retrieval-Augmented Generation (RAG) framework built for high-scale AI engineering. It features a three-layer architecture that serves developers at all skill levels.
graph TB
subgraph Pattern层["Pattern Layer (Application)"]
P1["NativeRAG<br/>Vector Retrieval"]
P2["GraphRAG<br/>Knowledge Graph"]
end
subgraph Pipeline层["Pipeline Layer (Assembly)"]
I["Indexer"]
R["Retriever"]
D["Repository"]
end
subgraph Step层["Step Layer (Function)"]
S1["Independent Modules<br/>Rewrite/Chunk/Embed..."]
end
Pattern层 --> Pipeline层
Pipeline层 --> Step层
| Layer | Who Uses | Responsibility |
|---|---|---|
| Pattern | Application Developers | Choose RAG mode, configure Options |
| Pipeline | Advanced Developers | Assemble Indexer/Retriever/Repository |
| Step | Framework Developers | Extend independent modules |
- 🚀 Performance First: Concurrent workers and streaming parsers with
O(1)memory efficiency - 🏗️ Pipeline-Based Architecture: Every step is explicit, traceable, and pluggable
- 🧠 Three-Phase Enhancement: Query enhancement → Retrieval → Result enhancement
- 🕸️ Advanced GraphRAG: Native support for Neo4j, SQLite, and BoltDB
- 🔭 Built-in Observability: Comprehensive distributed tracing
- 📦 Zero Dependencies: Pure Go implementation with auto-download models
Best for document QA and semantic search:
import "github.com/DotNetAge/gorag/pkg/pattern"
// Create a NativeRAG with auto-configuration
rag, _ := pattern.NativeRAG("my-app",
pattern.WithBGE("bge-small-zh-v1.5"),
)
// Index documents
rag.IndexDirectory(ctx, "./docs", true)
// Retrieve
results, _ := rag.Retrieve(ctx, []string{"What is GoRAG?"}, 5)Best for complex relationship reasoning:
rag, _ := pattern.GraphRAG("knowledge-graph",
pattern.WithBGE("bge-small-zh-v1.5"),
pattern.WithNeoGraph("neo4j://localhost:7687", "neo4j", "password", "neo4j"),
)
// Add nodes and edges
rag.AddNode(ctx, &core.Node{ID: "person-1", Type: "Person", ...})
rag.AddEdge(ctx, &core.Edge{Source: "person-1", Target: "company-1", ...})
// Query neighbors
neighbors, edges, _ := rag.GetNeighbors(ctx, "person-1", 1, 10)- Quick Start Guide - Pattern layer in 15 minutes
- NativeRAG Details - Three-phase enhancement
- GraphRAG Details - Knowledge graph reasoning
- Options Reference - All configuration options
- Development Guide - Pipeline layer development
- Indexer Development - Build custom indexers
- Retriever Development - Build custom retrievers
- Step Development Guide - Create new steps
idx, _ := indexer.DefaultAdvancedIndexer(
indexer.WithZapLogger("./logs/rag.log", 100, 30, 7, true),
indexer.WithPrometheusMetrics(":8080"),
indexer.WithOpenTelemetryTracer(ctx, "jaeger:4317", "RAG"),
)- Go 1.24+: Latest language features
- Zero-CGO SQLite: Painless cross-compilation
- Clean Architecture: Strict separation of interfaces and implementations
- Modular Steps: Reuse steps in any custom pipeline
We aim to build the most robust AI infrastructure for the Go ecosystem.
- Check our Contributing Guidelines
GoRAG is licensed under the MIT License.