AiMessage

References
public sealed class AiMessage
A single message in an AI conversation. The shape varies by role: system/user/assistant text messages carry only Text; assistant tool-call messages carry only ToolCall; tool result messages carry ToolName plus the result in Text. Construct via the static factory methods.

Properties

ReasoningContent

#
Chain-of-thought returned by reasoning-mode models (DeepSeek thinking models require this to be round-tripped back to the API on subsequent turns or the request is rejected). Null when the provider didn't return one. Only meaningful on assistant messages.
public string ReasoningContent { get; }

Role

#
public AiMessageRole Role { get; }

Text

#
Text content for system/user/assistant text messages, or the result body for tool messages. Null for assistant tool-call messages.
public string Text { get; }

ToolCall

#
Populated only for assistant messages that are tool calls; null otherwise.
public AiToolCall ToolCall { get; }

ToolName

#
Populated only for tool result messages; identifies which tool the result is for.
public string ToolName { get; }

ToolUseId

#
Populated only for tool result messages; the provider-assigned id of the call this result responds to.
public string ToolUseId { get; }

Methods

Assistant

#
public static AiMessage Assistant(
text,
reasoningContent = null
)

AssistantToolCall

#
public static AiMessage AssistantToolCall(
call,
reasoningContent = null
)

System

#
public static AiMessage System(
text
)

ToolResult

#
public static AiMessage ToolResult(
call,
content
)

User

#
public static AiMessage User(
text
)