DeltaKitDeltaKit

Types

Message and content part type definitions from @deltakit/core.

All types are exported from @deltakit/core (and re-exported by @deltakit/react).

import type { Message, ContentPart, TextPart } from "@deltakit/core";

Message

A chat message containing an array of typed content parts.

interface Message<TPart extends { type: string } = ContentPart> {
  id: string;
  role: "user" | "assistant";
  parts: TPart[];
}
FieldTypeDescription
idstringUnique identifier
role"user" | "assistant"Who sent the message
partsTPart[]Array of content parts

The generic TPart defaults to ContentPart but can be customized to include your own part types.

ContentPart

Union of all built-in content part types:

type ContentPart = TextPart | ToolCallPart | ReasoningPart;

TextPart

Plain text content.

interface TextPart {
  type: "text";
  text: string;
}

ToolCallPart

A tool/function call made by the assistant.

interface ToolCallPart {
  type: "tool_call";
  tool_name: string;
  argument: string;
  callId?: string;
  result?: string;
}
FieldTypeDescription
tool_namestringName of the tool being called
argumentstringJSON string of the call arguments
callIdstring?Unique ID to correlate with its result
resultstring?Populated when tool execution completes

ReasoningPart

The model's chain-of-thought or reasoning output.

interface ReasoningPart {
  type: "reasoning";
  text: string;
}

Custom Part Types

You can define your own part types and pass them as the generic parameter:

interface ImagePart {
  type: "image";
  url: string;
  alt?: string;
}

type MyPart = ContentPart | ImagePart;

// Messages can now contain image parts alongside text and tool calls
const messages: Message<MyPart>[] = [
  {
    id: "1",
    role: "assistant",
    parts: [
      { type: "text", text: "Here is the image:" },
      { type: "image", url: "https://example.com/photo.png" },
    ],
  },
];

For rendering parts in React, see Custom Content Parts.

On this page