Skip to content
N1
CRM / Bitrix24 · AI · contract review

An AI lawyer in the portal: first-pass contract review under Kazakhstan law

Client: Business center network, NDA Category: CRM / Bitrix24 Stack: PHP, Bitrix24 (boxed), PDF/Word/RTF text extraction, OCR, JSON base of Kazakhstan legal acts, Anthropic / OpenAI / GigaChat Timeline: rolled out in stages
Problem

The business center network's lawyer has to read every incoming lease and supply contract from scratch, even though most risks are typical. A first-pass review right in the portal was needed, so the lawyer would start from a ready list of risks.

Constraints

Documents arrive in various formats, including scans; the model's answers had to rely on Kazakhstan law rather than "general knowledge", and the external LLM provider could become unavailable or change.

What I did
  • Text extraction from PDF, Word and RTF, with an OCR branch for scans
  • Splitting the contract into clauses, a topic classifier and a set of rules that find typical risks without the model
  • Matching norms from a JSON base of Kazakhstan legal acts by keywords and weights — norms appear in the report with references
  • A swappable LLM provider (Anthropic, OpenAI, GigaChat) with a single report contract: the local rule engine always runs, and the model only supplements its output
  • A final report: risks, recommendations and references to Kazakhstan legal norms for each clause
Architecture
Contract file → Text extraction / OCR → Clauses and rules → Kazakhstan norm matching → LLM provider → report
Result

Lawyers upload a contract to the portal and get a first-pass report with risks and references to norms; the report is built even without an LLM, and the model only strengthens the review.

What can be reused
A single report contract across several LLM providers Local rule engine as a fallback for AI Matching legal norms from a JSON base of acts