InMemoryPromptCache

class InMemoryPromptCache(maxEntries: Int?) : PromptCache(source)

In-memory implementation of PromptCache. This implementation stores cache entries in memory.

Constructors

Link copied to clipboard
constructor(maxEntries: Int?)

Types

Link copied to clipboard

A companion object implementation of the PromptCache.Factory.Named specialized for an in-memory prompt cache. This factory is responsible for creating instances of InMemoryPromptCache based on a specific configuration string.

Functions

Link copied to clipboard
open suspend override 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
open suspend override 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.