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 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.
public List<ChatMessage> Messages { get; set; }
| Type | Description |
|---|---|
| List<ChatMessage> | Gets or sets the list of messages in the conversation. |
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. |
Gets the conversation messages formatted for the AI API.
public List<object> GetFormattedMessages(string systemPrompt)
| Type | Name | Description |
|---|---|---|
| string | systemPrompt | The system prompt to include. |
| Type | Description |
|---|---|
| List<object> | A list of message objects for the AI API. |