0
Fork 0
mirror of https://github.com/TanStack/ai.git synced 2026-11-18 19:34:58 +00:00
ai/docs/reference/functions/defineChatMiddleware.md
github-actions[bot] b98aa8b429
docs: regenerate API documentation (#1188)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-08-21 21:20:02 +00:00

1.4 KiB

id title
defineChatMiddleware defineChatMiddleware

Function: defineChatMiddleware()

function defineChatMiddleware<TContext, TRequires, TProvides, TInterruptDefinitions>(middleware): DefinedChatMiddleware<TContext, TRequires, TProvides, TInterruptDefinitions>;

Defined in: packages/ai/src/activities/chat/middleware/define.ts:27

Identity helper for authoring middleware with precise capability inference. Returns the middleware unchanged at runtime; only sharpens its type so the chat() array coverage check and createChatMiddleware builder can read the exact requires/provides.

Type Parameters

TContext

TContext = unknown

TRequires

TRequires extends readonly CapabilityHandle[] = readonly []

TProvides

TProvides extends readonly CapabilityHandle[] = readonly []

TInterruptDefinitions

TInterruptDefinitions extends AnyInterruptDefinition = never

Parameters

middleware

ChatMiddleware<TContext, TInterruptDefinitions> & object

Returns

DefinedChatMiddleware<TContext, TRequires, TProvides, TInterruptDefinitions>