CachingLLMClient

org.llm4s.llmconnect.caching.CachingLLMClient
See theCachingLLMClient companion class

Attributes

Companion
class
Source
CachingLLMClient.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply(baseClient: LLMClient, embeddingClient: EmbeddingProvider, embeddingModel: EmbeddingModelConfig, config: CacheConfig, tracing: Tracing): CachingLLMClient

A client that answers a prompt semantically close to an earlier one from its cache, and asks baseClient otherwise.

A client that answers a prompt semantically close to an earlier one from its cache, and asks baseClient otherwise.

Value parameters

baseClient

the client asked on a cache miss

config

the similarity threshold, the entries' time to live and how many are kept

embeddingClient

embeds each prompt: an EmbeddingClient, or any EmbeddingProvider

embeddingModel

the embedding model embeddingClient is asked for

tracing

receives a cache_hit or cache_miss event per call

Attributes

Source
CachingLLMClient.scala