Language Model Middleware
Since
0.3.0-beta01
Functions
Link copied to clipboard
Override the model id the wrapper presents (null = keep the wrapped model's).
Link copied to clipboard
Override the provider name the wrapper presents (null = keep the wrapped model's).
Link copied to clipboard
Override the supported-URL patterns the wrapper presents (null = keep the wrapped model's).
Link copied to clipboard
open suspend fun transformParams(operation: MiddlewareOperation, params: LanguageModelCallParams, model: LanguageModel): LanguageModelCallParams
Transform the call params before wrapGenerate/wrapStream run, for the given operation. The transformed params flow into both the wrap hooks and the downstream call. This is the params-only seam — a middleware can implement just this (e.g. ai.torad.aisdk.middleware.defaultSettingsMiddleware). Default: pass through. Mirrors v6's transformParams({ type, params, model }).
Link copied to clipboard
Wrap the one-shot generate call. Default: pass through.
Link copied to clipboard
Wrap the streaming call. Default: pass through.