Skip to content

DotNetAge/gorag

Repository files navigation

🦖 GoRAG

The Expert-Grade, High-Performance Modular RAG Framework for Go

Go Report Card Go Reference License: MIT Go Version Documentation

English | 中文文档


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.

🏗️ Three-Layer Architecture

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层
Loading
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

✨ Key Features

  • 🚀 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

🚀 Quick Start

NativeRAG (Vector Retrieval)

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)

GraphRAG (Knowledge Graph)

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)

📚 Documentation

Getting Started

Advanced Topics

Step Layer


🔭 Built-in Observability

idx, _ := indexer.DefaultAdvancedIndexer(
    indexer.WithZapLogger("./logs/rag.log", 100, 30, 7, true),
    indexer.WithPrometheusMetrics(":8080"),
    indexer.WithOpenTelemetryTracer(ctx, "jaeger:4317", "RAG"),
)

⚡ Technical Standards

  • 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

🤝 Contributing

We aim to build the most robust AI infrastructure for the Go ecosystem.

📄 License

GoRAG is licensed under the MIT License.

About

GoRAG is a production-ready, high-performance RAG (Retrieval-Augmented Generation) framework built entirely in Go. Designed for enterprise scalability, it seamlessly connects your internal data to the most powerful LLMs with zero Python dependencies.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors