Hit

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.

Constructors

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

Properties

Link copied to clipboard

How long ago the entry was written.

Link copied to clipboard

Id of the entry that matched, for SemanticCache.invalidate.

Link copied to clipboard

The prompt this response was originally produced for — rarely identical to the query.

Link copied to clipboard

Metadata stored alongside the entry.

Link copied to clipboard

The cached response.

Link copied to clipboard

Similarity between query and matchedPrompt, in [-1.0, 1.0].

Functions

Link copied to clipboard
open override fun toString(): String