Gourab RoyHome

SOFTWARE PROJECT · 2026

A small RAG system for asking questions about your own documents

I built DocuMindGPT as a command line workflow for PDFs and text files. It stores document chunks in Supabase, retrieves relevant context for each question, and asks a second model to audit the generated answer.

Input
PDF and text
Storage
Supabase pgvector
Generator
Gemini 2.5 Flash
Interface
Python CLI

PURPOSE

Keep answers tied to a supplied source

The tool is meant for situations where the answer should come from a known document rather than the model memory. A system instruction tells the generator to use only the retrieved context and to say when the context does not contain an answer.

I separated ingestion from chat so a document can be processed once and queried repeatedly. The command line keeps the example compact and makes each stage easy to inspect.

WORKFLOW

From a file to an audited answer

01Read and split

Extract text from a PDF or read a plain text file, then create overlapping chunks.

02Embed and store

Generate Gemini document embeddings and insert the chunks into Supabase.

03Retrieve and answer

Embed the question, retrieve matching chunks, and ask Gemini to answer from that context.

04Audit

Send the question, context, and answer to a second evaluation prompt.

Chunk size1,000 characters
Overlap200 characters
RetrievedTop 5 chunks
Threshold0.5 similarity

ANSWER AUDIT

A useful check, not an independent judge

Generation inputQuestion + retrieved context

The answer model is instructed not to add information beyond the supplied chunks.

Audit outputScore + verdict + reason

The evaluator checks grounding and relevance, then returns structured JSON.

The score runs from 1 through 10. A score of 7 or more receives a Pass verdict. If retrieval returns no context, the audit is skipped.

The generator and evaluator both use Gemini 2.5 Flash. The audit can help during interactive use, but it is still a model based assessment and should not be treated as independent verification.

CURRENT EVIDENCE

What is public today

The repository does not publish aggregate benchmark results

The code implements retrieval, grounded generation, and a per answer audit. It does not currently include a benchmark dataset, a saved evaluation run, or an aggregate accuracy table.

  • Implemented

    PDF and text ingestion, chunking, batch embedding, Supabase insertion, similarity retrieval, grounded prompting, interactive chat, and JSON audit parsing.

  • Handled failures

    The CLI reports missing files, empty PDFs, missing credentials, failed API calls, absent retrieval context, and malformed evaluator output.

  • Still needed for comparative claims

    A fixed evaluation set, retrieval measures, answer quality measures, and comparison with a baseline under the same documents and questions.

SETUP

Run the command line tool

Create a Supabase project, run `setup.sql`, and place the Gemini and Supabase credentials in a local `.env` file. Credentials should not be committed.

pip install -r requirements.txt python main.py upload path/to/document.pdf python main.py chat