HASON Marcel AI engineering

AI experiment

Local RAG on your own documents

Ollama Python ChromaDB nomic-embed-text

I wanted to be able to ask questions about my own documents – invoices, contracts and technical notes – without anything ever leaving my computer. The result is a simple RAG pipeline: documents are split into chunks, embedded with nomic-embed-text and stored in ChromaDB. A question is embedded with the same model, the closest chunks are retrieved and llama3 composes the answer from them.

Tuning the chunk size ate most of the time. Too small and they lost context, too large and they diluted relevance. I ended up with 500 tokens and an overlap of 50 – it works surprisingly well on my Slovak documents.

$ ollama pull llama3
$ ollama pull nomic-embed-text
$ python ingest.py --dir ./documents --chunk 500 --overlap 50
  > 142 documents, 3,816 chunks, ChromaDB saved
$ python ask.py "When does my hosting contract end?"
  > The web hosting contract ends on 31 Mar 2027,
  > the notice period is 2 months. [hosting-contract.pdf, p. 4]