Standard library only · runs in your browser
On Monday the owner shortens the refund window to 14 days and updates the policy document. On Wednesday the bot is still telling customers 30. Retrieval picked up the new document within seconds. The answer never changed.
Helpdesk answers from documents, and the agent added a cache so the same question doesn't call the model twice. The cache key is the question text, so an answer stays cached after the document behind it changes.
Fix cache_key(question, retrieved):
retrieved is the list of documents retrieval returned for this question, each {"id": ..., "version": ...}. A document's version goes up by one every time it's edited.?, . or !.run_session(docs, events) (provided) replays a day of questions and document edits, and returns every answer plus the number of cache hits.
cache_key(question: str, retrieved: list[dict]) -> str (run_session is provided)