Class ConversationSession
Represents a conversation session with memory.
Inherited Members
Namespace: Radzen
Assembly: Radzen.Blazor.dll
Syntax
public class ConversationSession
Constructors
ConversationSession()
Represents a conversation session with memory.
Declaration
public ConversationSession()
Properties
CreatedAt
Gets or sets the timestamp when the conversation was created.
Declaration
public DateTime CreatedAt { get; set; }
Property Value
Type | Description |
---|---|
DateTime |
Id
Gets or sets the unique identifier for the conversation session.
Declaration
public string Id { get; set; }
Property Value
Type | Description |
---|---|
string |
LastUpdated
Gets or sets the timestamp when the conversation was last updated.
Declaration
public DateTime LastUpdated { get; set; }
Property Value
Type | Description |
---|---|
DateTime |
MaxMessages
Gets or sets the maximum number of messages to keep in memory.
Declaration
public int MaxMessages { get; set; }
Property Value
Type | Description |
---|---|
int |
Messages
Gets or sets the list of messages in the conversation.
Declaration
public List<ChatMessage> Messages { get; set; }
Property Value
Type | Description |
---|---|
List<ChatMessage> |
Methods
AddMessage(string, string)
Adds a message to the conversation and manages memory limits.
Declaration
public void AddMessage(string role, string content)
Parameters
Type | Name | Description |
---|---|---|
string | role | The role of the message sender. |
string | content | The message content. |
Clear()
Clears all messages from the conversation.
Declaration
public void Clear()
GetFormattedMessages(string)
Gets the conversation messages formatted for the AI API.
Declaration
public List<object> GetFormattedMessages(string systemPrompt)
Parameters
Type | Name | Description |
---|---|---|
string | systemPrompt | The system prompt to include. |
Returns
Type | Description |
---|---|
List<object> | A list of message objects for the AI API. |