← All AI solutions

TergeuPro 07 / 25

AI legal assistant (RAG over the Criminal Code)

A self-hosted assistant that answers investigators’ questions with citations to articles of the Criminal Code of Kazakhstan.

zanalem.kz ↗

Problem

General chatbots hallucinate laws and can’t be used with sensitive case data in the cloud.

What it does

How it works

  1. Question → bge-m3 embedding (via Ollama) + BM25 keyword search over the knowledge base
  2. Candidates re-ranked by bge-reranker-v2-m3 (CrossEncoder on GPU)
  3. Top chunks + question → Qwen 2.5 72B via an OpenAI-compatible FastAPI proxy
  4. Answer streamed back with article references

Stack & models

PythonFastAPIOllamaQwen 2.5 72Bbge-m3bge-reranker-v2-m3BM25Yii2 API