Skip to content

Ramzi-Abidi/RTFM

Repository files navigation

RTFM

An AI powered documentation assistant built with RAG (Retrieval Augmented Generation). Upload your documentation files, ask questions in natural language, and get accurate answers with source citations, powered entirely by free-tier APIs.

Tech Stack

Layer Technology
Backend NestJS (TypeScript)
Frontend React + Vite + TailwindCSS
Vector DB / Cache / Storage Redis Stack
LLM Groq (llama-3.3-70b-versatile) with Google AI (Gemini) fallback
Embeddings Jina AI (jina-embeddings-v3, 1024 dimensions)
Package Manager pnpm

How It Works

Ingestion

  1. upload .md or .txt documentation files
  2. split content into chunks by markdown headers and word count
  3. generate 1024-dim embeddings via Jina AI
  4. store chunks + embeddings in Redis vector index (idx:docs)
  5. deduplicate via SHA-256 content hash

Question Answering (RAG)

  1. embed the user question via Jina AI (retrieval.query task)
  2. check semantic cache (idx:cache) for a similar previously answered question
  3. if cache miss, run KNN vector search to find top 5 relevant chunks
  4. build prompt with retrieved context and send to Groq LLM
  5. return answer with source file citations
  6. cache Q&A pair for future similar questions

Quick Start

1. Get API Keys (All Free)

  • Groq : LLM (free tier: 14k requests/day)
  • Jina AI : Embeddings (free tier: 1M tokens)
  • Google AI Studio : Fallback LLM (free tier: 1M tokens/day)

2. Setup Environment

cd server
cp .env.example .env
# Fill in your API keys in .env

3. Start Redis

docker-compose -f docker/docker-compose.yml up -d

4. Start Backend

cd server
pnpm install
pnpm run start:dev

5. Start Frontend

cd client
pnpm install
pnpm run dev

App runs at http://localhost:5173, backend at http://localhost:3000.

API Endpoints

Endpoint Method Description
/api/ingest POST Upload documentation files (multipart)
/api/ask POST Ask a question { question: string }
/api/documents GET List all uploaded documents
/api/documents/:id DELETE Delete a document and its chunks

Redis Data Model

Key Pattern Type Description
file:<hash> Hash Document metadata (fileName, chunks, createdAt)
doc:<hash>:<i> Hash Document chunk with embedding vector
cache:<id> Hash Cached Q&A pair with embedding vector
idx:docs Index Vector index for document chunk search
idx:cache Index Vector index for semantic cache lookup

UI preview (V1)

image

License

MIT

About

A documentation assistant that can ingest technical documentation, answer questions about it, and remember context across conversations.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors