RAG by hand: how we built an AI assistant for support and what came of it

Ilya Paramoshin16 Dec 2025

Problem

Support engineers at MTS Web Services answer questions from internal documentation and old tickets spread across Confluence and Jira. The same problem is described in many ways, and jargon mixes Russian and Latin spellings. Security rules forbid sending texts to external APIs, so cloud vector databases and hosted LLMs are out. The assistant must run entirely inside the company perimeter and stay current as pages and tickets change.

Example from the article: an engineer types "404 on prod" or "message delivery fails with a delay" and expects a grounded answer with links to the Confluence page or Jira ticket that solved it.

Solution in brief

The team built a RAG service with two independent loops. Indexing turns Confluence and Jira content to Markdown, cuts it into chunks of about 3000 characters and stores vectors and text in one PostgreSQL database. Search runs pgvector and BM25 in parallel, merges normalized scores with boosts, and passes the top fragments to a locally hosted LLM with a strict prompt.

Questions this case answers
  • How to answer questions over a changing internal knowledge base without sending any data to external services
  • How to merge lexical and dense retrieval scores so that short exact-match queries and free-form queries both work
  • How to update a vector index continuously without rebuilding it or blocking reads
  • How to build a RAG assistant over internal Confluence and Jira content that runs fully inside the company perimeter

Tools and methods

  • PostgreSQL + pgvector — single store for vectors, texts and metadata; IVFFlat index
  • BGE-m3 — self-hosted embedding model, 1024 dimensions
  • BM25 — keyword half of the hybrid search
  • markdownify — HTML to Markdown that keeps structure
  • Streamlit — web UI with model choice, Hybrid/BM25/Vector mode and relevance threshold
  • VictoriaMetrics, Grafana, GitLab CI, Docker — monitoring, delivery
  • Query expansion — synonyms, transliterations, acronyms
  • Prompt engineering — context-only prompts
Continue reading — it's free

Google or a one-time email code. No password.