Personal AI Tutor
A tutor grounded in your own textbooks
A local-first RAG tutor that answers only from your PDFs and cites the page it used.
Personal AI Tutor turns textbooks, lecture notes and papers into a tutor you can question. Answers come only from retrieved passages, with page-level citations. Everything runs offline on your own machine through Ollama and ChromaDB, so no data leaves your computer and there are no API fees.
What it does
- Context-length guard aborts the model call when retrieved text is too thin, so the tutor says it lacks the information instead of making something up.
- Subject paths are resolved to absolute paths and checked against the database root, blocking directory traversal.
- Deterministic answers with temperature set to 0, grounded only in the indexed material.
- Two interfaces over one core library: a Streamlit chat UI and a FastAPI /ask endpoint that returns the answer plus source file and page.
- Recursive PDF ingestion per subject folder, with an overwrite check to avoid duplicate indexes.
- Mock-based Pytest suite that runs without a live Ollama or Chroma instance, so it suits CI.
- Multi-stage Dockerfile and Docker Compose setup.
How it works
PDFs are loaded, split recursively into chunks and embedded with nomic-embed-text into a Chroma vector store. A question from the UI or the API runs a similarity search, and the retrieved context goes to qwen3:8b through Ollama. The answer comes back with its sources. Models can be swapped in config, for example to qwen3:14b or llama3.