Skip to content
Simon Place
FR EN
Book a Meet call

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 editor
const 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 editor
function recallAtK(cases, k) {  // TODO  return 0;}function mrr(cases) {  // TODO  return 0;}
Give the agent a skillMeasure retrieval
Open in the editor

Running 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

Some of these need a free account or an API key, which may be paid.

Legal notice and privacy