PromptCache

interface PromptCache(source)

Interface for caching prompt execution results. Implementations should provide a way to store and retrieve prompt execution results.

Inheritors

Types

Link copied to clipboard
interface Factory

Represents a factory interface for creating instances of PromptCache. Factories implementing this interface are designed to construct specific types of prompt caches based on a provided configuration string.

Link copied to clipboard

Represents a request to be cached, consisting of a prompt and optional tools. This class is used by PromptCache implementations to store and retrieve cached responses.

Functions

Link copied to clipboard
abstract suspend fun get(request: PromptCache.Request): List<Message.Response>?

Get a cached response for a request, or null if not cached.

Link copied to clipboard
suspend fun PromptCache.get(prompt: Prompt, tools: List<ToolDescriptor>, clock: Clock = Clock.System): List<Message.Response>?

Get a cached response for a prompt with tools, or null if not cached.

Link copied to clipboard
abstract suspend fun put(request: PromptCache.Request, response: List<Message.Response>)

Put a response in the cache for a request.

Link copied to clipboard
suspend fun PromptCache.put(prompt: Prompt, tools: List<ToolDescriptor>, response: List<Message.Response>)

Put a response in the cache for a prompt with tools.