LLMClientPipeline

org.llm4s.llmconnect.middleware.LLMClientPipeline
See theLLMClientPipeline companion object
final class LLMClientPipeline

Builder for composing middleware into a pipeline around a base LLMClient.

Middleware is applied in FIFO order: the first middleware added is closest to the base client, the last added is the outermost wrapper.

Usage:

val client = LLMClientPipeline(openAIClient)
 .use(LoggingMiddleware(logger))             // innermost
 .use(MetricsMiddleware(collector))
 .use(RateLimitingMiddleware(config))         // outermost
 .build()

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def build(): LLMClient

Build the final client by applying all middlewares in order.

Build the final client by applying all middlewares in order.

Attributes

def middlewareNames: Seq[String]

Returns the names of all middleware in the pipeline, in application order.

Returns the names of all middleware in the pipeline, in application order.

Attributes

def use(middleware: LLMMiddleware): LLMClientPipeline

Add a middleware to the pipeline.

Add a middleware to the pipeline.

Attributes