rag-rh-assistant / README.md
edouardfoussier's picture
Update README.md
5154308 verified

A newer version of the Gradio SDK is available: 5.45.0

Upgrade
metadata
license: mit
title: πŸ‡«πŸ‡· Assistant RH β€” RAG Chatbot
sdk: gradio
emoji: πŸ“š
colorFrom: indigo
colorTo: purple
app_file: app.py
pinned: true
short_description: πŸ‘‰ RAG-powered AI assistant for French Human Resources
tags:
  - gradio
  - rag
  - faiss
  - openai
  - hr
  - human-resources
  - law
  - france
  - french
  - chatbot
thumbnail: >-
  https://cdn-uploads.huggingface.co/production/uploads/6668057ef7604601278857f5/JeivLn409aMRCqx6RwO2J.png

πŸ‡«πŸ‡· RAG-powered HR Assistant

πŸ‘‰ An AI assistant specialised in French Human Resources
Built with Retrieval-Augmented Generation (RAG) on top of official public datasets.
It retrieves trusted information, generates concise answers, and always cites its sources.

πŸš€ Live demo on Hugging Face : Hugging Face Space

App Screenshot


✨ What is this?

This project is an AI assistant for HR topics in the French labor law and public administration HR practices.
It combines retrieval over trusted sources with LLM synthesis, and cites its sources.

  • UI: Gradio
  • Retrieval: FAISS (fallback: NumPy)
  • Embeddings: HF Inference API
  • LLM: OpenAI (BYO API Key)

πŸ“š Datasets & Attribution

This space relies on public HR datasets curated by AgentPublic:

For this project, I built cleaned and filtered derivatives hosted under my profile:


βš™οΈ How it works

  1. Question β†’ User asks in French (e.g., β€œDPAE : quelles obligations ?”).
  2. Retrieve β†’ FAISS searches semantic vectors from the datasets.
  3. Synthesize β†’ The LLM writes a concise, factual answer with citations [1], [2], ….
  4. Explain β†’ The β€œSources” panel shows the original articles used for answer generation

πŸ”‘ BYOK

The app never stores your OpenAI key; it’s used in-session only.


🧩 Configuration notes

  • FAISS is used when available; otherwise we fall back to NumPy dot-product search.
  • The retriever loads vectors from the datasets and keeps a compressed cache at runtime (/tmp/rag_index.npz) to speed up cold starts.
  • You can change the Top-K slider in the UI; it controls both retrieval and the number of passages given to the LLM.

πŸš€ Run locally

1) Clone & install

git clone https://huggingface.co/spaces/edouardfoussier/rag-rh-assistant
cd rag-rh-assistant
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

2) Configure environment

Key env vars:

  • HF_API_TOKEN β†’ required for embeddings via HF Inference API
  • HF_EMBEDDINGS_MODEL β†’ defaults to BAAI/bge-m3
  • EMBED_COL β†’ name of the embedding column in the dataset (defaults to embeddings_bge-m3)
  • OPENAI_API_KEY β†’ optional at startup (you can also enter it in the UI)
  • LLM_MODEL β†’ e.g. gpt-4o-mini (configurable)
  • LLM_BASE_URL β†’ default https://api.openai.com/v1

3) Launch

python app.py

Open http://127.0.0.1:7860 and enter your OpenAI API key in the sidebar (or set it in .env).


πŸ“Š Roadmap

  • Reranking (cross-encoder)
  • Multi-turn memory
  • More datasets (other ministries, codes)
  • Hallucination checks & eval (faithfulness)
  • Multi-LLM backends

πŸ™Œ Credits

  • Original data: AgentPublic
  • Built with: Hugging Face Spaces, Gradio, FAISS, OpenAI