Youssef Jedidi
← All work

2026

Sole developer · Prototype · public repository · 2026

Bilingual HR Policy Retrieval Agent

An English and French HR policy prototype that cites the passage behind each answer and hands conflicting or unclear cases to a person.

Role
Sole developer
Status
Prototype · public repository
Policy Retrieval Agent bilingual interface with a cited answer and source trail
The interface. A cited answer to a synthetic policy question.

Background

HR questions can touch company policy and Quebec labour law, in English or French. An answer with no source can mislead, so the agent shows its evidence or stops.

A question, in English or FrenchWHERE IT CAN STOP1Route the questionregex rules in English and French, then the model’s intentPerson, or refusedsensitive, financial, vague, under 0.70 · out of scope: refused2Search the policieskeyword and meaning search, merged into one list3Check the sourcesthe authoritative source is preferredPersonsources disagree; both are named4Draft and auditmust cite a [SOURCE: file] · legal rules, then a model auditPersonstill not compliant after 3 tries5Translate backinto the language of the questionCited draft, untranslatedif translation drops the tags; skips the next check6Confidence checkrouting 25% · search 35% · draft 20% · audit 20%Personbelow 0.72 admin · 0.82 financial · 0.95 sensitiveAnswer with sourcesin the language of the question

A question in English or French

  1. Route the question

    → person if sensitive · out of scope: refused

  2. Search the policies

  3. Check the sources

    → person if sources disagree

  4. Draft and audit

    → person if not compliant after 3 tries

  5. Translate back

    tags dropped: cited draft, untranslated

  6. Confidence check

    → person below 0.72–0.95, highest if sensitive

  7. ✓Answer with sources

Figure 1. Where a question can stop. Four of the six checks can hand the question to a person. Routing, drafting, auditing and translation each use Gemini flash-lite at temperature 0. Source: src/main.py.

When sources disagree, a person decides

When the retrieved sources contradict each other, the agent doesn’t pick one. It names both and sends the question to a person.

Search finds both exact terms and passages with a similar meaning.

Python · Streamlit · BM25 · Vector Search · Reciprocal-Rank Fusion · Gemini · pytest

One English querylanguage from marker words;French rewritten into EnglishMeaning searchChroma embeddings · top 10Keyword searchBM25 · top 10Merge the rankingsreciprocal rank fusion,k = 60One ranked listup to 20 passages, each withits file name for [SOURCE]
Figure 2. Two searches, one list. French questions are rewritten into English first, so both searches run on the same wording. Keyword search finds exact terms, meaning search finds paraphrases, and fusion keeps passages that rank well in either. Source: src/engine/retrieval.py.

Where it stands

Each answer shows its sources or the reason it went to a person; the code checks that a draft cites a source, not that every statement does. On the 36 test cases I wrote, every question ended the way the test expected.

Built as a prototype, not deployed HR software. The 36 cases ran once against Google’s model APIs and aren’t an independent evaluation. If translating an answer back to French drops its citations, the agent returns the cited English draft and skips the confidence check.

36 test cases I wrote · one run · March 19, 2026

36 test cases · one run · March 19, 2026

Expected outcomeBaseParaphrasedReasoningEnded as expected
Answer with sources66416 of 16
Hand to a person55212 of 12
Sources disagree: hand to a person22–4 of 4
Refuse: outside HR policy22–4 of 4
  • Answer with sources16 of 16
  • Hand to a person12 of 12
  • Sources disagree: hand to a person4 of 4
  • Refuse: outside HR policy4 of 4

Intent was routed correctly in all 36, and every answer that needed a citation had one. The only failed check was about wording: a French probation question was correctly sent to a person, but the message lacked a phrase the test looked for, in both the base and paraphrased sets.

The one failed check was wording: a French hand-off message lacked a phrase the test looked for.

Figure 3. How it did on its own test set. The paraphrased set rewords the base questions; the reasoning set asks questions the policy answers only indirectly, such as leave after 18 months. I wrote all three I wrote every case, so this checks behaviour, not accuracy on real HR questions. Reports: benchmark_suite_report.json.

Links