Project
AI Knowledge Copilot
Overview
A reusable retrieval-augmented generation (RAG) platform: upload any PDFs, ask questions, get cited answers.
Knowledge Copilot is a document question-answering platform. It works with any set of PDFs, from handbooks and research papers to internal docs, not one fixed corpus. Each answer cites the source file, page and passage it came from, with a relevance score.
Working end to end with a local model. Hosted LLM providers are planned.
Problem
Teams have knowledge locked inside PDFs. Keyword search misses meaning, and a plain LLM invents answers. RAG retrieves the relevant passages first and answers only from them.
Role
Sole engineer
Stack
- API
- PythonFastAPISQLAlchemy 2SQLite
- Retrieval
- ChromaDBsentence-transformersall-MiniLM-L6-v2
- Generation
- transformersgoogle/flan-t5-base (local)
- UI & ops
- StreamlitpypdfDocker ComposepytestGitHub Actions
Architecture
Two services, a layered backend and a pluggable LLM provider.
Streamlit UI
Upload PDFs, ask questions and inspect citations. Talks to the API over HTTP.
Ingestion
Per-page PDF extraction, then character chunks (800 chars, 150 overlap), then embeddings, then ChromaDB with document/page metadata.
Retrieval
Embed the question and take the top-4 chunks by cosine similarity.
Generation
A prompt that says to answer only from the retrieved context, using a local flan-t5 model behind an LLMProvider interface.
Storage
ChromaDB for vectors, SQLite for document metadata and chat history.
Engineering
Engineering decisions
LLM behind a provider interface
The local model works today, and hosted models can be added without touching the pipeline.
Page-level citations
Answers are only trustworthy if a reader can jump to the exact source passage.
Lazy model loading
Tests and CI don't pay the cost of loading embedding and generation models.
Challenges & solutions
Grounding answers in the documents
The prompt restricts the model to the retrieved context, and each answer ships with its supporting chunks and scores.
Keeping it general-purpose
Nothing is specific to one corpus. Documents can be added or deleted through the API, and retrieval spans everything uploaded.
Results & roadmap
Results & outcomes
No answer-quality metrics have been measured yet.
REST endpoints
6
Source: Health, document upload/list/delete, ask, chat history
Automated tests
11
Source: Chunking, PDF service, repository and API health
Roadmap
- PDF ingestion + cited Q&ADone
- Hosted LLM providers · OpenAI / Anthropic behind the existing interfacePlanned
- Hybrid search + re-rankingPlanned
- Async ingestion workerPlanned
- Auth, multi-tenancy, PostgresPlanned
- DOCX / TXT / HTMLPlanned