Skip to content
Taha Media

A document assistant that cites its sources

Answers only from your files, cites the file and section, says when the answer isn't there instead of inventing one, and flags instructions hidden in documents.

  • Python
  • FastAPI
  • PostgreSQL
  • pgvector
  • llama.cpp
  • Docker

Measured result

20/20

evaluation cases

The problem

General-purpose assistants invent convincing answers, and staff can't tell where they came from. A single document with hidden instructions can change the assistant's behaviour.

What I built

  • Documents are chunked and embedded into PostgreSQL with pgvector, and the closest passages are retrieved for each question.
  • Structured answers: status, answer, and citations with a verbatim quote from the passage.
  • Guards against instructions injected inside documents, and an explicit refusal when the information isn't there.
  • Works with OpenAI, Claude, or a local model on the company's server.

Measured result

  • A 20-case evaluation including unanswerable questions and injection attempts: 20/20 on the second run (19/20 on the first), using a local 35B model on my own server.
  • 38 unit tests pass without needing a model or a database.

On my modest hardware an answer took about a minute; a stronger server or a cloud model is much faster.

All case studies

13/13tests passing

WhatsApp Cloud API audit and a secure webhook

A toolkit that shows whether a WhatsApp integration is really official and who owns it, plus a webhook that verifies Meta's signature and never processes a message twice.