CacheLookup

sealed interface CacheLookup

Outcome of SemanticCache.lookup.

A semantic cache that only answers "hit or miss" is impossible to tune: when your hit rate is 4% you need to know whether prompts are landing just under the threshold or being vetoed by a guard, because the fix is opposite in each case. Every miss therefore carries the reason and the best candidate that was considered.

Inheritors

Types

Link copied to clipboard
class Hit(val response: String, val matchedPrompt: String, val similarity: Double, val entryId: String, val age: Duration, val metadata: Map<String, String>) : CacheLookup

A cached response was judged safe to serve.

Link copied to clipboard
class Miss(val reason: MissReason, val bestSimilarity: Double?, val bestPrompt: String?, val detail: String?) : CacheLookup

No cached response was safe to serve.