Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Class ConversationSession

    Represents a conversation session with memory.

    Inheritance
    object
    ConversationSession
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    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.

    Introducing Radzen Blazor Studio

    Radzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.

    Learn More

    Download Now
    Download Now
    In This Article
    Back to top Radzen Blazor Components, © 2018-2025 Radzen. Source Code licensed under MIT