CacheEntry

org.llm4s.llmconnect.caching.CacheEntry
case class CacheEntry(embedding: Seq[Double], response: Completion, timestamp: Instant, options: CompletionOptions)

An entry in the CachingLLMClient semantic cache.

Stores the embedding vector of the original query alongside the cached org.llm4s.llmconnect.model.Completion, so that later queries can be matched by cosine similarity rather than exact string equality.

Value parameters

embedding

L2-normalised embedding vector of the query that produced this entry. Used for cosine-similarity lookup against new queries. Dimensionality matches the configured embedding model.

options

The org.llm4s.llmconnect.model.CompletionOptions used to produce response. A cache hit requires an exact match on options; mismatched options (e.g. different temperature or tool set) result in a OptionsMismatch miss and bypass the cache.

response

The org.llm4s.llmconnect.model.Completion returned by the LLM for the original query. This is the value returned to the caller on a cache hit.

timestamp

Wall-clock time when this entry was inserted. Compared against CacheConfig.ttl to determine whether the entry has expired.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product