Represents a chat message in the RadzenAIChat component.
Object
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class ChatMessageRepresents a chat message in the RadzenAIChat component.
public ChatMessage()Gets or sets additional data about the message, for example the files an answer changed or the credits it used. Streaming responses collect the AdditionalProperties of their updates here; render them with MessageFooterTemplate or UsageTemplate.
public Microsoft.Extensions.AI.AdditionalPropertiesDictionary AdditionalProperties { get; set; }
| Type | Description |
|---|---|
| Microsoft.Extensions.AI.AdditionalPropertiesDictionary | Gets or sets additional data about the message, for example the files an answer changed or the credits it used. Streaming responses collect the AdditionalProperties of their updates here; render them with MessageFooterTemplate or UsageTemplate. |
Gets or sets the files attached to the message.
public List<ChatAttachment> Attachments { get; set; }
| Type | Description |
|---|---|
| List<ChatAttachment> | Gets or sets the files attached to the message. |
Gets or sets the sources the answer is based on: citations the provider attached to the response and citations returned by tools.
public List<ChatCitation> Citations { get; set; }
| Type | Description |
|---|---|
| List<ChatCitation> | Gets or sets the sources the answer is based on: citations the provider attached to the response and citations returned by tools. |
Gets or sets the content of the message.
public string Content { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the content of the message. |
Gets or sets the unique identifier for the message.
public string Id { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the unique identifier for the message. |
Gets or sets whether this message is currently streaming.
public bool IsStreaming { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets whether this message is currently streaming. |
Gets or sets whether this message is from the user.
public bool IsUser { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets whether this message is from the user. |
Gets or sets the kind of the message. Default is Message; the other kinds are entries the application adds with ChatMessage).
public ChatMessageKind Kind { get; set; }
| Type | Description |
|---|---|
| ChatMessageKind | Gets or sets the kind of the message. Default is Message; the other kinds are entries the application adds with ChatMessage). |
Gets or sets the reasoning the model produced before answering, when the model exposes it.
public string Reasoning { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the reasoning the model produced before answering, when the model exposes it. |
Gets or sets the role associated with the message (e.g., "user", "assistant").
public string Role { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the role associated with the message (e.g., "user", "assistant"). |
Gets or sets the timestamp when the message was created.
public DateTime Timestamp { get; set; }
| Type | Description |
|---|---|
| DateTime | Gets or sets the timestamp when the message was created. |
Gets or sets the tool calls the assistant made while producing this message.
public List<ChatToolCall> ToolCalls { get; set; }
| Type | Description |
|---|---|
| List<ChatToolCall> | Gets or sets the tool calls the assistant made while producing this message. |
Gets or sets the token usage reported by the model for this response, when the provider reports it.
public Microsoft.Extensions.AI.UsageDetails Usage { get; set; }
| Type | Description |
|---|---|
| Microsoft.Extensions.AI.UsageDetails | Gets or sets the token usage reported by the model for this response, when the provider reports it. |
Gets or sets the ID of the user who sent the message.
public string UserId { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the ID of the user who sent the message. |
Splits the message into its parts in the order the assistant produced them: the text written before a tool call, the call, the text written after it. Tool calls are placed by TextPosition; calls with the same position keep their order in ToolCalls. Empty text is skipped. Each text part is rendered as Markdown on its own, so a call that falls inside a list or a code block splits that block in two.
public IReadOnlyList<ChatMessagePart> GetParts()
| Type | Description |
|---|---|
| IReadOnlyList<ChatMessagePart> | The parts of the message. |
Merges additional data into AdditionalProperties.
public void MergeAdditionalProperties(Microsoft.Extensions.AI.AdditionalPropertiesDictionary properties)
| Type | Name | Description |
|---|---|---|
| Microsoft.Extensions.AI.AdditionalPropertiesDictionary | properties | The data to merge. Nothing happens when it is null or empty. |