Objective
HR answers the same 50 questions a week (PTO, parental leave, expenses), and country/role-specific rules differ. Generic RAG bots get the answer wrong because they don't see the employee's row. This recipe wires an HR-assistant that reads who's asking (country, tenure, role band) and combines it with the right policy doc.
Step 1: Create employees + policy docs
CREATE TABLE IF NOT EXISTS recipe_hr_employees (
employee_id INTEGER PRIMARY KEY,
email TEXT,
country TEXT,
hire_date DATE,
role_band TEXT, -- 'IC1' .. 'IC6' / 'M1' .. 'M5'
status TEXT -- 'active' | 'leave' | 'terminated'
);
CREATE TABLE IF NOT EXISTS recipe_hr_policies (
policy_id INTEGER PRIMARY KEY,
title TEXT,
scope TEXT, -- 'global' or 'country:XX' or 'role:IC' etc.
body TEXT,
embedding VECTOR(384)
);
Step 2: Seed
INSERT INTO recipe_hr_employees VALUES
(1001,'alice@yourco.com','US','2023-06-15','IC4','active'),
(1002,'bob@yourco.com', 'UK','2024-11-02','IC3','active'),
(1003,'carol@yourco.com','DE','2022-03-20','M2','active'),
(1004,'dan@yourco.com', 'US','2025-09-08','IC2','active');
INSERT INTO recipe_hr_policies (policy_id, title, scope, body) VALUES
(1,'Parental Leave — US','country:US', 'US-based employees receive 12 weeks of paid parental leave at full salary, available within 12 months of the qualifying event. Eligibility requires 6 months of tenure at time of leave.'),
(2,'Parental Leave — UK','country:UK', 'UK-based employees receive statutory maternity/paternity pay supplemented to 18 weeks at full salary. Eligibility requires 26 weeks of tenure at the 15th week before the expected birth.'),
(3,'Parental Leave — DE','country:DE', 'German employees receive Elternzeit up to 36 months, with Elterngeld funded by the state. Top-up to full salary for the first 14 weeks is provided by the company. No tenure requirement.'),
(4,'PTO', 'global', 'All employees receive 20 days of PTO accrued per calendar year. Unused PTO does not roll over beyond 5 days. Bank holidays follow the local calendar.'),
(5,'Expense Limits — IC', 'role:IC', 'Individual contributors may book domestic flights up to $500, hotels up to $250/night, and meals up to $75/day. Above-limit expenses require manager approval.'),
(6,'Expense Limits — M', 'role:M', 'Managers may book domestic flights up to $800, hotels up to $400/night, and meals up to $120/day. International travel always requires VP approval regardless of role.');