Represents a conversation session with memory.
Object
Namespace: Radzen
Assembly: Radzen.Blazor.dll
public class ConversationSessionRepresents a conversation session with memory.
public ConversationSession()Gets or sets the timestamp when the conversation was created.
public DateTime CreatedAt { get; set; }
| Type | Description |
|---|---|
| DateTime | Gets or sets the timestamp when the conversation was created. |
Gets or sets the conversation history sent to the model, including tool calls and tool results.
public List<Microsoft.Extensions.AI.ChatMessage> History { get; set; }
| Type | Description |
|---|---|
| List<Microsoft.Extensions.AI.ChatMessage> | Gets or sets the conversation history sent to the model, including tool calls and tool results. |
Gets or sets the unique identifier for the conversation session.
public string Id { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the unique identifier for the conversation session. |
Gets or sets the timestamp when the conversation was last updated.
public DateTime LastUpdated { get; set; }
| Type | Description |
|---|---|
| DateTime | Gets or sets the timestamp when the conversation was last updated. |
Gets or sets the maximum number of messages to keep in memory.
public int MaxMessages { get; set; }
| Type | Description |
|---|---|
| int | Gets or sets the maximum number of messages to keep in memory. |
Gets or sets the list of messages in the conversation as displayed by RadzenAIChat.
public List<ChatMessage> Messages { get; set; }
| Type | Description |
|---|---|
| List<ChatMessage> | Gets or sets the list of messages in the conversation as displayed by RadzenAIChat. |
Gets or sets the title of the conversation. Defaults to the beginning of the first user message.
public string Title { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the title of the conversation. Defaults to the beginning of the first user message. |
Gets or sets the user the conversation belongs to. Set through UserId or CancellationToken); CancellationToken) filters by it.
public string UserId { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the user the conversation belongs to. Set through UserId or CancellationToken); CancellationToken) filters by it. |
Adds messages to the history sent to the model and manages memory limits. Tool calls and their results are kept together.
public void AddHistory(IEnumerable<Microsoft.Extensions.AI.ChatMessage> messages)
| Type | Name | Description |
|---|---|---|
| IEnumerable<Microsoft.Extensions.AI.ChatMessage> | messages | The messages. |
Adds a message to the conversation and manages memory limits.
public void AddMessage(string role, string content)
| Type | Name | Description |
|---|---|---|
| string | role | The role of the message sender. |
| string | content | The message content. |
Adds a message to the conversation and manages memory limits.
public void AddMessage(ChatMessage message)
| Type | Name | Description |
|---|---|---|
| ChatMessage | message |
Clears all messages from the conversation.
public void Clear()