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

UIMessage

Interface: UIMessage<TData>

Defined in: packages/ai/src/types.ts:436

UIMessage - Domain-specific message format optimized for building chat UIs Contains parts that can be text, tool calls, or tool results. Generic over the structured-output data type so useChat({ outputSchema })'s schema narrows parts.find(p => p.type === 'structured-output').data on the consumer side without manual casts.

Type Parameters

TData

TData = unknown

Properties

createdAt?

ts
optional createdAt: Date;
optional createdAt: Date;

Defined in: packages/ai/src/types.ts:440


id

ts
id: string;
id: string;

Defined in: packages/ai/src/types.ts:437


parts

ts
parts: MessagePart<TData>[];
parts: MessagePart<TData>[];

Defined in: packages/ai/src/types.ts:439


role

ts
role: "user" | "assistant" | "system";
role: "user" | "assistant" | "system";

Defined in: packages/ai/src/types.ts:438