Cache repeated model work without serving stale answers
Caching is valuable when many requests share the same instructions, reference material, or deterministic transformation. It becomes dangerous when the answer depends on user state, rapidly changing data, permissions, or time-sensitive facts.
Build the cache key from the model, prompt version, relevant parameters, normalized input, data version, and authorization context. Set a clear expiry, and invalidate entries when any dependency changes.
Prompt-prefix caching and application-level response caching solve different problems. The first reduces repeated model processing; the second reuses a prior result. Treat them separately so a cost optimization does not become a correctness bug.
- Category
- Automation
- Platform
- Web