← all simulations
Cookbook 02 The Python 02_rag_gatekeeper.py

The gatekeeper

Search gives you a pile of documents. Some are useful, some are noise, and one is actively trying to manipulate the AI that reads it. Jev checks each one for a fraction of a cent before the expensive model sees any of them.

Now screening — four checks, one call

Press Play to screen the first document.

What this saves

Screened
0
documents
Forwarded
0
to the big model
Words saved
0
never sent
Gate cost
$0.000
for all of it

Each check costs about a thousandth of a cent. Reading one irrelevant document with a frontier model costs hundreds of times more.