Skip to content

Method

How it works

1. The source

The official English text of Federal Decree by Law No. (33) of 2021 Regulating Labour Relations (last updated 2024-07-29), copied from the UAE Legislation portal and checked piece by piece against the original with a SHA-256 hash. A small Python pipeline splits it into 74 articles and 276 clauses, with unit tests.

2. Finding the right clause

A BM25 keyword search over the clauses, the classic ranking function behind search engines. People and the law use different words, so a small dictionary adds the law's terms to a question: “notice period” → “warning period”, “passport” → “official documents”, “salary” → “wage”. The search needs no AI service, so the article finder and the fallback answers keep working when the AI is down.

It was tested on questions written in everyday language, each labelled with the article that answers it. The test set (30 questions) was written and committed before any tuning and never used to improve the search:

SearchFound 1stTop 3Top 5
BM25 on clause text47%60%70%
+ article titles53%67%67%
+ everyday-words dictionary (used by the app)67%90%93%

On the 45-question dev set, which was used to find gaps in the dictionary, the final search puts the right article in the top 5 for 98% of questions. Details in eval/retrieval-results.md.

3. Writing the answer

A Gemini model gets three tools: search_law, get_article and calculate_gratuity. It may search several times, rephrasing in the law's words, and must answer only from the clauses it read, citing each one. Gratuity amounts always come from the calculator, which follows Article 51 exactly and is unit-tested, never from the model's own arithmetic. Under every answer you can open the clauses it read.

What it can't do

  • It covers the Decree-Law only, not the Executive Regulation (Cabinet Resolution 1 of 2022) or ministerial decisions, which add many details.
  • It doesn't apply to domestic workers, government employees or the armed forces (Article 3). The DIFC and ADGM free zones have their own employment laws.
  • The English text is a translation; the Arabic original prevails.
  • It is general information, not legal advice. For your case, contact the Ministry of Human Resources & Emiratisation (MOHRE) or a lawyer.