GoRAG is a simple yet powerful RAG (Retrieval-Augmented Generation) application written in Go. It allows you to create a smart "knowledge base" from your documents (PDF and Markdown) and interact with it through a modern web interface or API. Everything runs locally using Ollama, ensuring your data privacy.
- Multi-Format Extraction: Automatically processes PDF and Markdown files from your documents directory.
- Modern Web UI: Beautiful, responsive chat interface with real-time response streaming.
- Persistent Vector Store: Powered by BadgerDB, providing high-performance local storage (no more massive JSON files).
- Source Citations: The assistant cites specific sources (e.g.,
[Source 1]) in its answers so you can verify the information. - Smart Chunking: Text is split into chunks with configurable overlap to preserve context across boundaries.
- Docker Ready: Complete
docker-compose.ymlincluded for easy deployment with Ollama. - Graceful Shutdown: Cleanly handles termination signals to ensure data integrity.
- Index Management CLI: Build your index on demand with a dedicated flag.
- Structured Logging: Uses Go's
slogfor clean, professional logging.
- Go: Version 1.25 or higher.
- Ollama: Installed and running with your preferred model (e.g.,
llama3).ollama pull llama3
-
Clone the repository:
git clone https://github.com/podanypepa/gorag.git cd gorag -
Add your documents: Place your
.pdfor.mdfiles into thedocs/directory. -
Build the Index:
go run . --index -
Run the Server:
go run .Visit
http://localhost:9090in your browser.
- Start the containers:
docker-compose up -d
- Download the model (first time):
docker exec -it gorag-ollama-1 ollama run llama3 - Index your documents:
docker-compose run gorag ./gorag --index
| Variable | Description | Default Value |
|---|---|---|
OLLAMA_URL |
The URL of the Ollama API instance. | http://localhost:11434 |
MODEL_NAME |
The name of the model to use. | llama3 |
INDEX_DIR |
The directory for the BadgerDB store. | index_db |
PDF_DIR |
The directory containing documents. | docs/ |
SERVER_PORT |
The port for the web server. | 9090 |
Ask questions via simple GET requests:
curl "http://localhost:9090/ask?q=What are the key findings?"A simple streaming CLI client is available in bin/client.
cd bin/client
go build -o ollama_stream .
./ollama_stream "Explain quantum computing."This project explores the power of local RAG systems using Go. Secure, fast, and fully local.