← All projects

RAG Chat Assistant for School Knowledge Management

Category AI / Enterprise
Year 2026
Result Production RAG assistant used daily by teachers for internal policies and legal questions
PythonFastAPIReact 19PostgreSQLpgvectorLangChainOpenAIDockerLangfuseAlembicTyper

Overview

The end client of VoiceAgenten is a German school with an established internal knowledge management system – wikis, policies, and internal documentation that teachers and staff rely on every day. The content was there, but scattered: anyone with a concrete question about a school regulation or a legal provision had to work through wiki pages and reference books manually.

Together with VoiceAgenten, I built a production AI chat assistant on top of it: teachers ask questions in natural language and receive answers with traceable source citations – from the internal wiki and, when relevant, from a legal reference book. What used to mean searching and cross-referencing is now a conversation.

My Role

I was brought in by VoiceAgenten, who held the contract with the school, as a freelance AI engineer and delivered the system independently from architecture through production operation – ingestion pipelines, hybrid retrieval, streaming chat API, React frontend, authentication and admin tooling, observability, and automated Docker deployment.

Scope

The system connects two knowledge sources in a single chat interface. Every night, an automated ingestion pipeline runs against the login-protected HumHub wiki: session authentication, extraction of actual article content, following outbound links, and splitting everything into searchable text chunks with metadata. In parallel, a legal reference book is parsed from PDF into section-aware chunks – with edition year, page ranges, and section paths stored in its own vector table.

On this foundation, hybrid search runs in PostgreSQL with pgvector: vector search and German full-text search are fused through a deterministic reranker. Routing between the wiki and legal corpora ensures legal content is only included when the query calls for it – for example through terms like ”§”, “Gesetz”, or “Elternzeit”. In chat, follow-up questions are condensed against the conversation history into standalone queries, answers are streamed via Server-Sent Events, and every statement carries structured source citations. When no relevant context is found, the assistant says so instead of hallucinating.

Beyond that, the system includes persistent chat histories, session-based authentication with Argon2, an admin area with user management and CSV import, and a Typer CLI for operational tasks. Optionally, Langfuse runs as self-hosted tracing so user feedback attaches directly to the exact answer generation.

Technical Highlights

Hybrid search directly on Postgres. Instead of a dedicated vector database, the system combines pgvector (cosine distance) with German full-text search (websearch_to_tsquery) and a custom reranker that fuses vector score, keyword ranking, term overlap in content, and overlap in headings with weighted signals.

Authenticated scraping of a legacy wiki. The HumHub wiki requires CSRF token extraction and session login. The pipeline filters out navigation and comments, follows outbound links, and deduplicates content – all covered by deterministic tests with mocked HTTP transports.

Multi-corpus retrieval with routing. Wiki knowledge and legal reference material are only merged when the query carries legal signals or the legal match score clears a higher threshold. This keeps everyday answers clean while making legal questions authoritative.

Production-grade chat with citations. Server-Sent Events for real-time streaming, LLM-based condensation of follow-up questions, structured citations (wiki URL and title, or book edition, pages, and section), and explicit behavior when context is missing.

Operations and observability. Alembic migrations, nightly re-ingestion via cron in the app container, self-hosted Langfuse tracing with trace IDs for user feedback, and deployment as a single-image setup behind Traefik with Let’s Encrypt TLS.

Result & Impact

The customer is very satisfied – and teachers use the assistant heavily in their daily work. Internal policies and legal questions can now be asked in natural language and come back with traceable sources. What could have stayed a notebook prototype is a complete RAG product: from ingestion through hybrid retrieval and streaming generation to the UI and production deployment – tuned for German and built for everyday school use.

Let's talk

Ready for your next project?

Whether you have a concrete requirement or an early idea, let's find out whether and how I can help.

For recruiters & agencies

Senior AI engineering and fullstack support for client projects. Ask directly about availability and engagement details.

View recruiter info →