# ChatMessage Class

Represents a chat message in the RadzenAIChat component.

Namespace: [Radzen.Blazor](https://blazor.radzen.com/docs/api/Radzen.Blazor.md)

Assembly: Radzen.Blazor.dll

## Inheritance

- Object
- ChatMessage

## Syntax

```csharp
public class ChatMessage
```

## Constructors

| Constructor | Description |
|-------------|-------------|
| `public ChatMessage()` | Represents a chat message in the RadzenAIChat component. |

## Properties

| Property | Type | Description |
|------|------|-------------|
| AdditionalProperties | `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. |
| Attachments | `List<ChatAttachment>` | Gets or sets the files attached to the message. |
| Citations | `List<ChatCitation>` | Gets or sets the sources the answer is based on: citations the provider attached to the response and citations returned by tools. |
| Content | `string` | Gets or sets the content of the message. |
| Id | `string` | Gets or sets the unique identifier for the message. |
| IsStreaming | `bool` | Gets or sets whether this message is currently streaming. |
| IsUser | `bool` | Gets or sets whether this message is from the user. |
| Kind | [`ChatMessageKind`](https://blazor.radzen.com/docs/api/Radzen.Blazor.ChatMessageKind.md) | Gets or sets the kind of the message. Default is Message; the other kinds are entries the application adds with ChatMessage). |
| Reasoning | `string` | Gets or sets the reasoning the model produced before answering, when the model exposes it. |
| Role | `string` | Gets or sets the role associated with the message (e.g., "user", "assistant"). |
| Timestamp | `DateTime` | Gets or sets the timestamp when the message was created. |
| ToolCalls | `List<ChatToolCall>` | Gets or sets the tool calls the assistant made while producing this message. |
| Usage | `Microsoft.Extensions.AI.UsageDetails` | Gets or sets the token usage reported by the model for this response, when the provider reports it. |
| UserId | `string` | Gets or sets the ID of the user who sent the message. |

## Methods

| Method | Returns | Description |
|------|---------|-------------|
| `GetParts()` | `IReadOnlyList<ChatMessagePart>` | 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. Returns: The parts of the message. |
| `MergeAdditionalProperties(Microsoft.Extensions.AI.AdditionalPropertiesDictionary properties)` | `void` | Merges additional data into AdditionalProperties. Parameters: `properties`: The data to merge. Nothing happens when it is null or empty. |

