Retrieval-Augmented Generation with Qdrant and Ollama
Find a file
Snider c4c4bab176 chore: bump go directive to 1.26.0
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:33:48 +00:00
cmd/rag feat: migrate rag commands from CLI 2026-02-21 19:38:11 +00:00
docs docs: graduate TODO/FINDINGS into production documentation 2026-02-20 15:01:55 +00:00
tools/rag feat: add RAG Python tools from CLI 2026-02-21 21:16:54 +00:00
benchmark_gpu_test.go feat(bench): add Phase 4 GPU benchmarks on RX 7800 XT 2026-02-20 11:51:25 +00:00
benchmark_test.go feat: Phase 3 enhancements — sentence splitting, collection helpers, keyword filter, benchmarks 2026-02-20 08:02:00 +00:00
chunk.go feat: Phase 3 enhancements — sentence splitting, collection helpers, keyword filter, benchmarks 2026-02-20 08:02:00 +00:00
chunk_test.go feat: Phase 3 enhancements — sentence splitting, collection helpers, keyword filter, benchmarks 2026-02-20 08:02:00 +00:00
CLAUDE.md docs: graduate TODO/FINDINGS into production documentation 2026-02-20 15:01:55 +00:00
collections.go feat: Phase 3 enhancements — sentence splitting, collection helpers, keyword filter, benchmarks 2026-02-20 08:02:00 +00:00
collections_test.go feat: Phase 3 enhancements — sentence splitting, collection helpers, keyword filter, benchmarks 2026-02-20 08:02:00 +00:00
embedder.go feat: extract Embedder and VectorStore interfaces, add mock-based tests 2026-02-20 00:15:54 +00:00
go.mod chore: bump go directive to 1.26.0 2026-02-22 20:33:48 +00:00
go.sum feat: migrate rag commands from CLI 2026-02-21 19:38:11 +00:00
helpers.go feat: extract Embedder and VectorStore interfaces, add mock-based tests 2026-02-20 00:15:54 +00:00
helpers_test.go feat: extract Embedder and VectorStore interfaces, add mock-based tests 2026-02-20 00:15:54 +00:00
ingest.go feat: extract Embedder and VectorStore interfaces, add mock-based tests 2026-02-20 00:15:54 +00:00
ingest_test.go feat: extract Embedder and VectorStore interfaces, add mock-based tests 2026-02-20 00:15:54 +00:00
integration_test.go test: add Phase 3 integration tests with live Qdrant + Ollama (69.0% -> 89.2%) 2026-02-20 00:33:03 +00:00
keyword.go feat: Phase 3 enhancements — sentence splitting, collection helpers, keyword filter, benchmarks 2026-02-20 08:02:00 +00:00
keyword_test.go feat: Phase 3 enhancements — sentence splitting, collection helpers, keyword filter, benchmarks 2026-02-20 08:02:00 +00:00
mock_test.go feat: Phase 3 enhancements — sentence splitting, collection helpers, keyword filter, benchmarks 2026-02-20 08:02:00 +00:00
ollama.go feat: extract go-rag from go-ai as standalone RAG package 2026-02-19 18:29:59 +00:00
ollama_integration_test.go test: add Phase 3 integration tests with live Qdrant + Ollama (69.0% -> 89.2%) 2026-02-20 00:33:03 +00:00
ollama_test.go test: add Phase 1 pure-function unit tests (18.4% -> 38.8% coverage) 2026-02-20 00:02:52 +00:00
qdrant.go feat: Phase 3 enhancements — sentence splitting, collection helpers, keyword filter, benchmarks 2026-02-20 08:02:00 +00:00
qdrant_integration_test.go test: add Phase 3 integration tests with live Qdrant + Ollama (69.0% -> 89.2%) 2026-02-20 00:33:03 +00:00
qdrant_test.go test: add Phase 1 pure-function unit tests (18.4% -> 38.8% coverage) 2026-02-20 00:02:52 +00:00
query.go feat: Phase 3 enhancements — sentence splitting, collection helpers, keyword filter, benchmarks 2026-02-20 08:02:00 +00:00
query_test.go feat: extract Embedder and VectorStore interfaces, add mock-based tests 2026-02-20 00:15:54 +00:00
README.md docs: add README with quick start and docs links 2026-02-20 15:11:19 +00:00
vectorstore.go feat: Phase 3 enhancements — sentence splitting, collection helpers, keyword filter, benchmarks 2026-02-20 08:02:00 +00:00

go-rag

Retrieval-Augmented Generation library for Go. Provides document chunking with three-level Markdown splitting and configurable overlap, embedding generation via Ollama, vector storage and cosine-similarity search via Qdrant (gRPC), keyword boosting post-filter, and result formatting in plain text, XML (for LLM prompt injection), or JSON. Designed around Embedder and VectorStore interfaces that decouple business logic from service implementations and enable mock-based testing.

Module: forge.lthn.ai/core/go-rag Licence: EUPL-1.2 Language: Go 1.25

Quick Start

import "forge.lthn.ai/core/go-rag"

// Ingest a directory of Markdown files
err := rag.IngestDirectory(ctx, "/path/to/docs", "my-collection", false)

// Query for relevant context (suitable for LLM prompt injection)
context, err := rag.QueryDocsContext(ctx, "how does rate limiting work?", "my-collection", 5)

// Interface-accepting variants for long-lived processes
results, err := rag.QueryWith(ctx, store, embedder, "question", "collection", 5)

Documentation

  • Architecture — interfaces, chunking strategy, ingestion pipeline, query pipeline, keyword boosting
  • Development Guide — prerequisites, build, test tags, live vs mock tests
  • Project History — completed phases and known limitations

Build & Test

go test ./...                        # unit + mock tests (no external services)
go test -tags rag ./...              # full suite with live Qdrant + Ollama
go test -race ./...
go build ./...

Licence

European Union Public Licence 1.2 — see LICENCE for details.