Skip to main content

Module middleware

Module middleware 

Source
Expand description

Language model middleware.

A middleware wraps a model: it may rewrite call options, wrap the generate/stream calls, and override identity or supported URLs. Apply with wrap_language_model; the first middleware in the list is the outermost.

Modules§

builtin
Built-in middleware.

Structs§

MiddlewareContext
The model being wrapped and the kind of call.

Enums§

CallKind
Which model method is being called.

Traits§

LanguageModelMiddleware
Intercepts language model calls. Every method has a pass-through default.

Functions§

wrap_language_model
Wraps model with middleware; the first entry becomes the outermost layer. An empty list returns model unchanged.

Type Aliases§

GenerateNext
Continuation of a wrapped do_generate.
StreamNext
Continuation of a wrapped do_stream.