Module 7 of 10, lesson 4 of 5
Practice
Agentic RAG
Write the code
Runs in your browser, with no install, account or API key. The model is scripted, so the results are repeatable.
function rrf(rankings, { k = 60, limit = 10 } = {}) { // TODO return [];}module.exports = { rrf };
Give the agent a skillMerge rankings with RRF
Open in the editorconst tokens = (text) => text.toLowerCase().split(/\W+/).filter(Boolean);function idf(term, docs) { const found = docs.filter((d) => tokens(d.text).includes(term)).length; return Math.log(1 + docs.length / (1 + found));}function score(doc, terms, docs) { const words = tokens(doc.text);
Repair the agentClose a permissions leak
Open in the editorfunction recallAtK(cases, k) { // TODO return 0;}function mrr(cases) { // TODO return 0;}
Give the agent a skillMeasure retrieval
Open in the editorRunning project
Running project: give the agent two sources, the refund policy and the product sheets. Write ten questions, two of them out of scope. Measure whether the right passage is retrieved, before generating any answer.
Practice
- Building Agentic RAG with LlamaIndex DeepLearning.AI
Short course on agents that query documents. - AI Agents for Beginners Microsoft
18 free lessons with a short video and Python code samples each.
Some of these need a free account or an API key, which may be paid.