CacheEntry
One cached prompt/response pair plus the vector used to find it again.
The embedding passed in is normalized on construction, so CacheEntry.embedding is always unit length and Vectors.dot against another normalized vector yields cosine similarity directly.
Identity is the id alone: two entries with the same id are the same entry, whatever else changed. That keeps entries usable as map keys without ever comparing float arrays element by element.
Properties
Dimensionality of embedding.
Unit-normalized embedding of prompt.
Partition this entry belongs to. Lookups only ever see entries from their own scope, which is how you keep a gpt-4o answer from being served to a haiku caller — see SemanticCache.
Functions
Copy of this entry with a different response, keeping id, embedding and creation time. Useful when refreshing a stale answer without paying to re-embed the prompt.