LLMMiddleware

org.llm4s.llmconnect.middleware.LLMMiddleware

A middleware that wraps an LLMClient to add cross-cutting behavior.

Middleware instances are composable and applied in order via LLMClientPipeline. The last middleware added is the outermost wrapper (first to execute).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def name: String

Human-readable name for logging/debugging.

Human-readable name for logging/debugging.

Attributes

def wrap(next: LLMClient): LLMClient

Wrap the given LLMClient, returning a new client with added behavior.

Wrap the given LLMClient, returning a new client with added behavior.

Implementations should delegate all LLMClient methods to next, adding behavior before/after delegation as needed.

Value parameters

next

the next client in the pipeline

Attributes

Returns

a new LLMClient with this middleware's behavior added