Get Started

Build your own "chat with my files" app in Python, step by step

"What's the notice period in my tenancy agreement?" Build the app that answers questions like that from your own files, quotes its sources and says when it doesn't know. Every model runs on your own computer, so nothing gets uploaded.

100 minIntermediateTools: FreeStep 1 free
A working appdrop in PDFs, Word, PowerPoint, Excel or text files, ask questions, get answers with numbered sources
Your first cited answer within 10 minutes, before any of the theory
A real understanding of embeddings, chunking, top-k search and grounding prompts, so you can tune it instead of guessing
  • A terminal version (ingest.py, ask.py) and a browser version (app.py) built on the same small engine
  • A test set and a script that scores retrieval and answers, so every change you make is measured
Before you start
01/08Fast path: your first cited answer in 10 minutes0 done
STEP 01 of 08~10 min

Fast path: your first cited answer in 10 minutes

See the finished thing working first. The rest of the lesson takes it apart so you can tune it.

  1. Download the starter kit: chat-with-my-files.zip (178KB) and unzip it into your Documents folder. It comes with four sample documents from a fictional bike shop, so you can check every answer against something you know. Then get the embedding model (622MB), install the project and ask your first question:

    Windows
    ollama pull embeddinggemma
    cd $HOME\Documents\chat-with-my-files
    uv sync
    uv run ingest.py
    uv run ask.py "How long is the warranty on an aluminium frame?"
    Mac / Linux
    ollama pull embeddinggemma
    cd ~/Documents/chat-with-my-files
    uv sync
    uv run ingest.py
    uv run ask.py "How long is the warranty on an aluminium frame?"
  2. ingest.py reads the four files and builds a searchable index. ask.py prints the passages it found under Sources found, then an Answer from the local model with [1]-style numbers pointing at those sources. The first answer is the slowest, because Ollama has to load the model into memory.

  3. Want the browser version straight away? Run uv run streamlit run app.py, ask a question at the bottom of the page and open Sources under the answer. Step 6 covers it properly.

    TipSwapping in your own files is one change: put them in the docs folder (PDF, Word, PowerPoint, Excel, Markdown or text) and run uv run ingest.py again.
✓
Checkpointask.py answers "5 years" with a [1] citation, and returns-and-warranty.pdf is in the sources list.
If it breaks'uv' is not recognised + 2 more
'uv' is not recognised
Install it with winget install --id astral-sh.uv -e (Windows) or curl -LsSf https://astral.sh/uv/install.sh | sh (Mac or Linux), then open a new terminal. Full walkthrough in Install anything from GitHub.
'Can't reach Ollama'
Open the Ollama app from the Start menu (or Applications on a Mac) and run the command again.
The pull says the model needs a newer version of Ollama
EmbeddingGemma needs Ollama 0.11.10 or later. The first fix in step 2 shows how to update.
Still stuck? Ask the community
Next mission · Own your AIGive your offline AI real tools: live weather, your own notes and a calculator
→