Skip to content
← Projects

Knowledge Assistant

A self-hosted assistant that answers questions from your own documents and databases, cites the exact source, and says "not found" instead of guessing. Works in English and Khmer.

Jul 2026 · Open source · Python, FastAPI, PostgreSQL, pgvector, React, Ollama, Tesseract OCR, Docker

Runs fully offline with Ollama: no API key, and no document ever leaves your server.

Overview

Knowledge Assistant lets a team upload PDFs, Word, Excel, PowerPoint and other files, or connect a Postgres, MySQL or SQLite database, and ask questions in plain language. Every answer links back to the excerpt it came from.

Retrieval is hybrid: pgvector similarity is fused with Postgres full-text search using Reciprocal Rank Fusion, so paraphrased questions and exact names, IDs or numbers both find the right passage.

It is built for Cambodian teams as much as English ones. Scanned Khmer PDFs are OCR'd automatically, and the default local models handle Khmer questions and answers.

Model providers are small adapters, so the same app runs on Ollama, Gemini, Claude, OpenAI, or any OpenAI-compatible API by changing one environment variable.

The problem

HR policies, payroll rules and contracts are exactly the documents teams should not paste into someone else's chat product, and most assistants guess when they do not know.

What I did

I built the whole product: ingestion and OCR, chunking and embeddings, hybrid retrieval, the FastAPI backend, the React interface, and the Docker deployment.

  1. Kept everything local-first in one Postgres database: documents, vectors and chat history.
  2. Combined vector and keyword search so tables and exact values are found as reliably as prose.
  3. Required a citation for every answer and an explicit "not found" when the sources do not cover the question.

The result

A private document assistant that a small company can run on its own machine, in Khmer or English, with answers it can check.

  • Public repository with architecture and data-model diagrams.
  • Built-in evaluation harness for retrieval and answer quality.

Features

  • Answers stream token by token over SSE, each with source citations
  • Hybrid retrieval: pgvector + Postgres full-text, fused with RRF
  • SQL connector imports tables as searchable sources
  • Khmer and English OCR built into the Docker image
  • Telegram bot that answers from the same knowledge base
  • Evaluation harness with a golden-question set, usable as a deploy gate