All work

Document Assistant

Private RAG over your own documents and code

Role
Personal project
Year
2026
Code
github.com/j4dgpt/document-assistant
Answer based on the context above. Cite sources using [Source X] notation.
src/llm/ollama_client.py
The prompt that makes every answer cite its source

Overview

Point it at documents or a source tree, it indexes them locally, and you ask questions against that index. Embeddings come from sentence-transformers and answers from a local Ollama model, so nothing is sent to a hosted API.

Ingestion and querying are two paths through one pipeline in src/rag_pipeline.py, shared by a FastAPI service, a Gradio UI and a CLI.

What I built

Architecture

src/ingestion/loaders.py

Reads PDF, DOCX, Markdown and plain text as prose, and twenty source extensions as code. Anything else is rejected rather than guessed at.

Hard parts

Code is not prose

Splitting source files on the same boundaries as prose cuts functions in half. Files are tagged at load time and routed to a separate splitter with larger chunks and more overlap.

Answers you can check

The prompt numbers every retrieved chunk and requires the model to cite them, so each answer points back to the passage it came from.

Stack

Known limits