Docs
Cloudflare
CodeRabbit
Railway
OpenRouter
SerpAPI
AG Grid
WorkOS
Netlify
Clerk
Unkey
Electric
Sentry
Prisma
Cloudflare
CodeRabbit
Railway
OpenRouter
SerpAPI
AG Grid
WorkOS
Netlify
Clerk
Unkey
Electric
Sentry
Prisma
Class References
Function References
Interface References
Type Alias References
Variable References

chatParamsFromRequestBody

Function: chatParamsFromRequestBody()

ts
function chatParamsFromRequestBody(body): Promise<{
  aguiContext: object[];
  context: object[];
  forwardedProps: Record<string, unknown>;
  messages: (
     | ModelMessage<
     | string
     | ContentPart<unknown, unknown, unknown, unknown, unknown>[]
     | null>
    | UIMessage<unknown>)[];
  parentRunId?: string;
  runId: string;
  state: unknown;
  threadId: string;
  tools: object[];
}>;
function chatParamsFromRequestBody(body): Promise<{
  aguiContext: object[];
  context: object[];
  forwardedProps: Record<string, unknown>;
  messages: (
     | ModelMessage<
     | string
     | ContentPart<unknown, unknown, unknown, unknown, unknown>[]
     | null>
    | UIMessage<unknown>)[];
  parentRunId?: string;
  runId: string;
  state: unknown;
  threadId: string;
  tools: object[];
}>;

Defined in: packages/ai/src/utilities/chat-params.ts:44

Parse and validate an HTTP request body as an AG-UI .

Returns a spread-friendly object whose field is suitable for passing directly to . The existing handles AG-UI fan-out dedup and reasoning/activity/developer-role normalization internally.

Parameters

body

Returns

<{ : []; : []; : <, >; : ( | < | | <, , , , >[] | > | <>)[]; : ; : ; : ; : ; : []; }>

Throws

An error with a migration-pointing message when the body does not conform to AG-UI 0.0.52 . Surface this as a 400 Bad Request to the client.