MarkCockerill12/RAGsystem

Rust

0

12 commits

updated Aug 19, 2026

See the code

README

๐Ÿ“ก Agentic RAG System

A high-performance Retrieval-Augmented Generation (RAG) web application engineered with Rust, HTMX, and Groq. This system transforms local documents into an interactive knowledge base with autonomous agentic capabilities.


โœจ Features

  • ๐Ÿš€ Resilience: Uses GPT OSS 20B, with retry strategies to circumvent rate limits.
  • ๐Ÿ›ก๏ธ Private Local Embeddings: Built-in 384-dimensional vectorization using all-MiniLM-L6-v2 via HuggingFace Candle.
  • ๐Ÿค– Agentic Reasoning: An autonomous loop that uses the search_documents tool to query the local index before synthesizing answers.
  • ๐Ÿ—๏ธ Industrial Tech Stack:
  • Backend: Axum (high-concurrency asynchronous web framework).
  • Database: SQLite with WAL mode for high-throughput concurrent access.
  • Frontend: HTMX for reactive, SPA-like interactions without the complexity of modern JS frameworks.
  • ๐Ÿ’… Noir Aesthetic: A premium, terminal-inspired dark UI powered by Tailwind CSS.

๐Ÿ› ๏ธ Infrastructure & Resilience

API Fallback & Retry Strategy

This system is designed to handle the constraints of the Groq Free Tier gracefully:

  1. Primary Model: Defaults to openai/gpt-oss-20b for tasks.
  2. Momentary Limits (TPM/RPM): Automatically parses retry-after headers and performs jittered retries (up to 10 times) before failing.
  3. Agentic Tool Fallback: Robust regex-based parsing to catch and fix tool_use_failed errors from the API.
  4. Identifier Boosting: Specialized retrieval logic that prioritizes short, technical identifiers (e.g., 2c, 1a) for precise lookup.

๐Ÿš€ Deployment & Demo

๐ŸŒ Live Website

You can access the hosted version of the system here: https://agentic-rag-n4wm.onrender.com/


๐Ÿ’ป Getting Started Locally

1. Clone the Repository

First, download the project to your local machine:

git clone https://github.com/MarkCockerill12/RAGsystem.git
cd RAGsystem

2. Prerequisites

  • Rust Toolchain: Install via rustup (Ensure you have cargo and rustc 1.85+).
  • Groq API Key: Obtain a free-tier key from the Groq Console.
  • System Dependencies:
    • Windows: Build tools for Visual Studio (C++ workload) are required for compiling certain dependencies like rusqlite.
    • Linux: sudo apt-get install pkg-config libssl-dev build-essential
    • macOS: brew install openssl pkg-config

3. Configure Environment

Create a .env file in the project root:

GROQ_API_KEY=gsk_your_key_here
PORT=3000

4. Launch the Application

cargo run --release

Access the dashboard at http://localhost:3000.


๐Ÿ“– Architectural Overview

  1. Ingestion: Documents (PDF, TXT, DOCX) are processed and cleaned server-side.
  2. Chunking: Text is split using a semantic sliding window to preserve context across boundaries.
  3. Vectorization: Chunks are embedded into a vector space using a local BERT model (MiniLM).
  4. Retrieval: Queries trigger a semantic search against the SQLite index using Cosine Similarity.
  5. Synthesis: The agentic reasoning loop evaluates retrieved context and generates a precise response, citing source material where applicable.

๐ŸŒ Deployment

The system is optimized for containerized environments like Render.

Render Configuration

  • RAM: 512MB (Free Tier compatible)
  • Startup: The included Dockerfile pre-downloaded the embedding model, ensuring sub-second cold starts.
  • Persistence: Uses an ephemeral SQLite database; for production, consider mounting a volume or using an external DB provider.

๐Ÿ“„ License

This project is open-source and intended for professional demonstration and educational purposes.

Contributors

MarkCockerill12

12 commits

MarkCockerill12/RAGsystem

Rust

0

12 commits

updated Aug 19, 2026

See the code

README

๐Ÿ“ก Agentic RAG System

A high-performance Retrieval-Augmented Generation (RAG) web application engineered with Rust, HTMX, and Groq. This system transforms local documents into an interactive knowledge base with autonomous agentic capabilities.


โœจ Features

  • ๐Ÿš€ Resilience: Uses GPT OSS 20B, with retry strategies to circumvent rate limits.
  • ๐Ÿ›ก๏ธ Private Local Embeddings: Built-in 384-dimensional vectorization using all-MiniLM-L6-v2 via HuggingFace Candle.
  • ๐Ÿค– Agentic Reasoning: An autonomous loop that uses the search_documents tool to query the local index before synthesizing answers.
  • ๐Ÿ—๏ธ Industrial Tech Stack:
  • Backend: Axum (high-concurrency asynchronous web framework).
  • Database: SQLite with WAL mode for high-throughput concurrent access.
  • Frontend: HTMX for reactive, SPA-like interactions without the complexity of modern JS frameworks.
  • ๐Ÿ’… Noir Aesthetic: A premium, terminal-inspired dark UI powered by Tailwind CSS.

๐Ÿ› ๏ธ Infrastructure & Resilience

API Fallback & Retry Strategy

This system is designed to handle the constraints of the Groq Free Tier gracefully:

  1. Primary Model: Defaults to openai/gpt-oss-20b for tasks.
  2. Momentary Limits (TPM/RPM): Automatically parses retry-after headers and performs jittered retries (up to 10 times) before failing.
  3. Agentic Tool Fallback: Robust regex-based parsing to catch and fix tool_use_failed errors from the API.
  4. Identifier Boosting: Specialized retrieval logic that prioritizes short, technical identifiers (e.g., 2c, 1a) for precise lookup.

๐Ÿš€ Deployment & Demo

๐ŸŒ Live Website

You can access the hosted version of the system here: https://agentic-rag-n4wm.onrender.com/


๐Ÿ’ป Getting Started Locally

1. Clone the Repository

First, download the project to your local machine:

git clone https://github.com/MarkCockerill12/RAGsystem.git
cd RAGsystem

2. Prerequisites

  • Rust Toolchain: Install via rustup (Ensure you have cargo and rustc 1.85+).
  • Groq API Key: Obtain a free-tier key from the Groq Console.
  • System Dependencies:
    • Windows: Build tools for Visual Studio (C++ workload) are required for compiling certain dependencies like rusqlite.
    • Linux: sudo apt-get install pkg-config libssl-dev build-essential
    • macOS: brew install openssl pkg-config

3. Configure Environment

Create a .env file in the project root:

GROQ_API_KEY=gsk_your_key_here
PORT=3000

4. Launch the Application

cargo run --release

Access the dashboard at http://localhost:3000.


๐Ÿ“– Architectural Overview

  1. Ingestion: Documents (PDF, TXT, DOCX) are processed and cleaned server-side.
  2. Chunking: Text is split using a semantic sliding window to preserve context across boundaries.
  3. Vectorization: Chunks are embedded into a vector space using a local BERT model (MiniLM).
  4. Retrieval: Queries trigger a semantic search against the SQLite index using Cosine Similarity.
  5. Synthesis: The agentic reasoning loop evaluates retrieved context and generates a precise response, citing source material where applicable.

๐ŸŒ Deployment

The system is optimized for containerized environments like Render.

Render Configuration

  • RAM: 512MB (Free Tier compatible)
  • Startup: The included Dockerfile pre-downloaded the embedding model, ensuring sub-second cold starts.
  • Persistence: Uses an ephemeral SQLite database; for production, consider mounting a volume or using an external DB provider.

๐Ÿ“„ License

This project is open-source and intended for professional demonstration and educational purposes.

Contributors

MarkCockerill12

12 commits

Languages

Rust

80.2%

HTML

17.6%

Dockerfile

2.2%