A fast, robust, and production-ready RAG backend - so you can focus on the chunks.
Caution
DynaRAG is in a Pre-release state. Full release and stability will arrive soon.
- What is DynaRAG?
- Core Features
- Technical Benefits
- About Us
- Target Users
- Why DynaRAG?
- Prerequisites
- Module Structure
- License
DynaRAG is a RAG (Retrieval-Augmented Generation) backend that implements a simple naive approach.
In this way, it is no more complex than the simplest RAG examples that you may find on Haystack or Langchain.
Instead, DynaRAG focuses on providing a highly performant backend for adding, retrieving and filtering text chunks.
DynaRAG does this by pushing the inference and database-query latencies into the parts of the RAG pipeline that yield the lowest round trip time.
- Naive RAG with Go-managed feature extraction models (props to hugot for building awesome go bindings for Onnx)
DynaRAG provides several key operations through its client interface:
Chunk
: Add new text chunks with associated metadata and file pathsSimilar
: Find semantically similar chunks using vector similarity searchQuery
: Generate RAG responses by combining relevant chunks with LLM processingPurgeChunks
: Remove stored chunks (with optional dry-run)GetStats
: Retrieve usage statisticsListChunks
: List all stored chunks with their metadata
During initialisation (client.Initialise()
), DynaRAG automatically runs database migrations to:
- Set up the required PostgreSQL extensions (pgvector)
- Create necessary tables for storing embeddings and metadata
- Configure indexes for efficient vector similarity search
These migrations ensure your database is properly configured for vector operations and chunk
storage with DynaRAG. The migrations are managed using golang-migrate
.
Note
The database must be accessible with the provided connection string and the user must have sufficient privileges to create extensions and tables.
DynaRAG is written entirely in Go, including feature extraction models interfaced with via the Onnx runtime. This provides several advantages over Python-based approaches:
- Inherently faster performance, as we can leverage Golangs awesome concurrency model
- Single binary compilation for easier deployment
- Generally, better memory safety
- No performance loss in HTTP layer communication with feature extraction service
- Strongly typed from the offset
- Easily slots in to applications that Golang was made for (i.e. servers), without a networking overhead
DynaRAG is built and maintained by Predixus, an Analytics and Data company based in Cambridge, UK.
DynaRAG is ideal for developers or product owners looking to add RAG capabilities to their applications in a lightweight and performant manner. It excels when working with clear text chunks that directly represent potential answers to user questions.
DynaRAG was developed to address the need for a simple, self-hosted RAG solution for internal and client projects. DynaRAG was born out of our need for a fast, robust and simple RAG backend that didn't break the bank and allowed us to own the inference resources.
The key considerations to the project were:
- Minimal project footprint
- Cost-effective implementation
- Focus on optimal chunking rather than complex retrieval
- Ability to own inference capability and make the most use of compute resources available
Tip
Focus on the quality of your text chunks when using DynaRAG. If each chunk clearly represents an answer to likely questions, naive RAG becomes highly effective.
DynaRAG depends on the Onnx runtime to run the embedding pipelines. Ensure that the runtime is
present in the default directory (/usr/lib/onnxruntime.so
). It can be downloaded from the
Microsoft downloads page.
The Go bindings for Huggingface tokenisers is also required. Download it from this repo and
place it in the default location /usr/lib/tokenizers.a
.
The DynaRAG Go! module is split into several packages:
internal/llm
- defines code to interface directly with the LLM provider (Groq, Ollama etc.)internal/store
- the interface to the PGVector store. The home of the sqlc auto-generated code and the migrations managed bygo-migrate
internal/embed
- the embedding process powered by Hugotinternal/rag
- code that defines the final summarisation layer, along with system promptstypes
- globally used types, some of which are used bysqlc
during code generationinternal/utils
- miscellaneous utilitiesmigrations
- contains the Postgres migrations required to configure your postgres instance for DynaRAGquery.sql
defines raw pSQL queries that drive the interactions with the PGVector instance.
Feature extraction (conversion of the text chunks into vectors) is performed through Hugot via the Onnx runtime.
On inference, the required models will be downloaded from Huggingface and stored in the ./models/ folder. This will only be done once to obtain the relevant .onnx binaries.
DynaRAG is licensed under the BSD 3-Clause License. See LICENSE for details.