AI Dev Kit
Search Results for

    Show / Hide Table of Contents

    Class ChatSession

    Represents a single chat session, including its metadata, settings, messages, and serialization logic. Provides support for saving, loading, summarizing, and auto-saving the session.

    Inheritance
    object
    ChatSession
    Namespace: Glitch9.AIDevKit.Advanced.Chat
    Assembly: .dll
    Syntax
    public class ChatSession : IData

    Constructors

    ChatSession()

    Declaration
    public ChatSession()

    Properties

    AutoSave

    Whether the session should automatically save on update.

    Declaration
    public bool AutoSave { get; set; }
    Property Value
    Type Description
    bool

    CreatedAt

    Creation timestamp.

    Declaration
    public UnixTime CreatedAt { get; }
    Property Value
    Type Description
    UnixTime

    Id

    Unique identifier of the chat session.

    Declaration
    public string Id { get; }
    Property Value
    Type Description
    string

    Last

    The last message received from the assistant.

    Declaration
    public ChatCompletion Last { get; }
    Property Value
    Type Description
    ChatCompletion

    LastException

    Declaration
    public Exception LastException { get; }
    Property Value
    Type Description
    Exception

    LastSummaryUpdate

    Time when the summary was last updated.

    Declaration
    public UnixTime LastSummaryUpdate { get; }
    Property Value
    Type Description
    UnixTime

    MaxContextMessages

    Maximum number of context messages to use before summarizing.

    Declaration
    public int MaxContextMessages { get; set; }
    Property Value
    Type Description
    int

    Messages

    List of all chat messages in the session.

    Declaration
    public List<ChatMessage> Messages { get; set; }
    Property Value
    Type Description
    List<ChatMessage>

    Model

    The AI model used for the chat.

    Declaration
    public Model Model { get; set; }
    Property Value
    Type Description
    Model

    ModelOptions

    Optional parameters for model behavior.

    Declaration
    public ModelSettings ModelOptions { get; set; }
    Property Value
    Type Description
    ModelSettings

    ModerationOptions

    Moderation settings.

    Declaration
    public ModerationOptions ModerationOptions { get; set; }
    Property Value
    Type Description
    ModerationOptions

    Name

    Name of the chat session.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    string

    ReasoningOptions

    Additional reasoning configuration.

    Declaration
    public ReasoningOptions ReasoningOptions { get; set; }
    Property Value
    Type Description
    ReasoningOptions

    RecentMessages

    List of recent chat messages used for summarization.

    Declaration
    public List<ChatMessage> RecentMessages { get; }
    Property Value
    Type Description
    List<ChatMessage>

    SpeechOutputOptions

    Settings for speech output.

    Declaration
    public SpeechOutputOptions SpeechOutputOptions { get; set; }
    Property Value
    Type Description
    SpeechOutputOptions

    StartingMessage

    The message shown to the user at the start of the session.

    Declaration
    public string StartingMessage { get; set; }
    Property Value
    Type Description
    string

    Stream

    Whether streaming responses are enabled.

    Declaration
    public bool Stream { get; set; }
    Property Value
    Type Description
    bool

    Summary

    The current summary of the session.

    Declaration
    public string Summary { get; }
    Property Value
    Type Description
    string

    SummaryModel

    Model used to generate conversation summaries.

    Declaration
    public Model SummaryModel { get; set; }
    Property Value
    Type Description
    Model

    SystemInstruction

    System instruction for the assistant.

    Declaration
    public string SystemInstruction { get; set; }
    Property Value
    Type Description
    string

    UpdatedAt

    Last update timestamp.

    Declaration
    public UnixTime UpdatedAt { get; }
    Property Value
    Type Description
    UnixTime

    WebSearchOptions

    Settings for web search integration.

    Declaration
    public WebSearchOptions WebSearchOptions { get; set; }
    Property Value
    Type Description
    WebSearchOptions

    Methods

    ClearMessages()

    Declaration
    public void ClearMessages()

    CreateFile(string, string, string)

    Declaration
    public static ChatSession CreateFile(string id = null, string name = null, string startingMessage = null)
    Parameters
    Type Name Description
    string id
    string name
    string startingMessage
    Returns
    Type Description
    ChatSession

    DeleteFile()

    Declaration
    public bool DeleteFile()
    Returns
    Type Description
    bool

    DeleteFile(string)

    Declaration
    public static bool DeleteFile(string id)
    Parameters
    Type Name Description
    string id
    Returns
    Type Description
    bool

    Equals(ChatSession)

    Declaration
    public bool Equals(ChatSession other)
    Parameters
    Type Name Description
    ChatSession other
    Returns
    Type Description
    bool

    GENChat(ChatMessage)

    Creates a text generation task using this chat session and message as the prompt.

    Example: chatSession.GENChat(chatMessage).SetModel(OpenAIModel.GPT4o).ExecuteAsync();

    Declaration
    public GENChatTask GENChat(ChatMessage chatMessage)
    Parameters
    Type Name Description
    ChatMessage chatMessage
    Returns
    Type Description
    GENChatTask

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    LoadFile(string)

    Declaration
    public static ChatSession LoadFile(string id)
    Parameters
    Type Name Description
    string id
    Returns
    Type Description
    ChatSession

    Rewind()

    Declaration
    public (ChatMessage lastSent, ChatMessage lastReceived) Rewind()
    Returns
    Type Description
    (ChatMessage lastSent, ChatMessage lastReceived)

    SaveFile(string)

    Declaration
    public void SaveFile(string customPath = null)
    Parameters
    Type Name Description
    string customPath

    SaveFileAsync(string)

    Declaration
    public UniTask SaveFileAsync(string customPath = null)
    Parameters
    Type Name Description
    string customPath
    Returns
    Type Description
    UniTask

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    In this article
    Back to top Generated by DocFX