Skip to content

feat(rag): bilingual dora kb — labeled french working translation (#424 phase 2)#431

Merged
AndreLiar merged 2 commits into
devfrom
feat/kb-french-translation
Jun 14, 2026
Merged

feat(rag): bilingual dora kb — labeled french working translation (#424 phase 2)#431
AndreLiar merged 2 commits into
devfrom
feat/kb-french-translation

Conversation

@AndreLiar

Copy link
Copy Markdown
Owner

#424 Phase 2 — French DORA knowledge base

Phase 1 (#429) gave French users a French answer + a link to the official EUR-Lex French text. Phase 2 seeds the KB itself in French, so retrieved regulation snippets are in the user's language too.

What changed

  • scripts/translateComplianceKb.js → generates dora-articles.fr.json, a working LLM translation of the 58 DORA entries. Flagged official: false with an EUR-Lex disclaimer + source URL.
  • seedComplianceKb.js → loads en + fr files, tags every chunk metadata.lang / metadata.official. Smart-sync re-seeds when the point count changes (58 → 116).
  • complianceKbRetriever.js → language-filtered search: prefers the user's locale (fr), falls back to en, then unfiltered as a last resort. Carries metadata.official through.
  • contextFormatter.formatSources → now prefers metadata.url over the 'regulation' category tag. This also fixes Phase 1: the EUR-Lex link was being shadowed by metadata.source = 'regulation' and never reached the UI.
  • FrontendSource.official type + a "working translation" badge on unofficial chunks (en/fr i18n).

Trust / compliance

The French text is a labeled, non-official working translation. The authoritative text stays the official EUR-Lex French version, linked on every citation. We do not present a machine translation as the regulation.

Tests

  • retriever: language filter, EN fallback, official flag + EUR-Lex URL (EN/FR)
  • formatSources: metadata.url precedence over the category tag, official pass-through
  • backend targeted ✅ · full backend + 521 frontend ✅ (pre-push)

Deploy note

Prod compliance_kb needs a re-seed to pick up the French partition (point count 58 → 116 triggers smart-sync automatically on the seed step).

… p2)

french users now get regulation snippets in french, not just a french answer over
english source text. the kb is seeded in both languages and retrieval prefers the
user's locale, falling back to english when a french chunk is missing.

- translateComplianceKb: generates dora-articles.fr.json (working llm translation),
  flagged official:false with an eur-lex disclaimer + source url
- seedComplianceKb: loads en + fr files, tags each chunk metadata.lang / official
- complianceKbRetriever: language-filtered search (fr -> en -> unfiltered fallback),
  carries metadata.official through to the source object
- contextFormatter.formatSources: prefer metadata.url over the 'regulation' category
  tag (this also makes phase 1's eur-lex link actually reach the ui) + expose official
- frontend: Source.official type + a "working translation" badge on unofficial chunks,
  en/fr i18n strings
- unit tests: lang filter + en fallback, url precedence, official flag pass-through

the french text is a labeled non-official working translation; the authoritative
text stays the official eur-lex french version, linked on every citation.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AndreLiar AndreLiar merged commit 6650ce4 into dev Jun 14, 2026
7 checks passed
@AndreLiar AndreLiar deleted the feat/kb-french-translation branch June 14, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants