Search Results for

    Show / Hide Table of Contents

    Class ConversationService

    Inheritance
    object
    ConversationService
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Glitch9.AIDevKit.Agents.Conversations
    Assembly: Glitch9.AIDevKit.dll
    Syntax
    public sealed class ConversationService

    Constructors

    | Edit this page View Source

    ConversationService(string, string, IEventHandler<ConversationEvent>, IMemorySettings, IConversationStore)

    Declaration
    public ConversationService(string agentId, string agentName, IEventHandler<ConversationEvent> eventHandler, IMemorySettings settings, IConversationStore store)
    Parameters
    Type Name Description
    string agentId
    string agentName
    IEventHandler<ConversationEvent> eventHandler
    IMemorySettings settings
    IConversationStore store

    Properties

    | Edit this page View Source

    AgentId

    Declaration
    public string AgentId { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    AgentName

    Declaration
    public string AgentName { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    AutoSave

    Declaration
    public bool AutoSave { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Conversation

    Declaration
    public Conversation Conversation { get; }
    Property Value
    Type Description
    Conversation
    | Edit this page View Source

    IsInitialized

    Declaration
    public bool IsInitialized { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Items

    Declaration
    public List<ConversationItem> Items { get; }
    Property Value
    Type Description
    List<ConversationItem>
    | Edit this page View Source

    LastMessage

    Declaration
    public Message LastMessage { get; }
    Property Value
    Type Description
    Message
    | Edit this page View Source

    Messages

    Declaration
    public List<Message> Messages { get; }
    Property Value
    Type Description
    List<Message>
    | Edit this page View Source

    Name

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Settings

    Declaration
    public IMemorySettings Settings { get; }
    Property Value
    Type Description
    IMemorySettings

    Methods

    | Edit this page View Source

    CreateConversationAsync(CancellationToken)

    Declaration
    public UniTask<Conversation> CreateConversationAsync(CancellationToken ct = default)
    Parameters
    Type Name Description
    CancellationToken ct
    Returns
    Type Description
    UniTask<Conversation>
    | Edit this page View Source

    DeleteConversationAsync(string, CancellationToken)

    Declaration
    public UniTask<bool> DeleteConversationAsync(string convId = null, CancellationToken ct = default)
    Parameters
    Type Name Description
    string convId
    CancellationToken ct
    Returns
    Type Description
    UniTask<bool>
    | Edit this page View Source

    ListConversationsAsync(CancellationToken)

    Declaration
    public UniTask<Conversation[]> ListConversationsAsync(CancellationToken ct = default)
    Parameters
    Type Name Description
    CancellationToken ct
    Returns
    Type Description
    UniTask<Conversation[]>
    | Edit this page View Source

    LoadConversationAsync(string, bool, CancellationToken)

    Declaration
    public UniTask<Conversation> LoadConversationAsync(string convId, bool createIfError = true, CancellationToken ct = default)
    Parameters
    Type Name Description
    string convId
    bool createIfError
    CancellationToken ct
    Returns
    Type Description
    UniTask<Conversation>
    | Edit this page View Source

    PushInputMessageAsync(Message, int)

    Pushes a system message or a user message to the session.

    Declaration
    public UniTask<List<Message>> PushInputMessageAsync(Message inputMessage, int index = -1)
    Parameters
    Type Name Description
    Message inputMessage

    The message to be added to the session.

    int index
    Returns
    Type Description
    UniTask<List<Message>>

    Context messages after the new message has been added. This includes the new message and any previous messages in the session, limited by the profile's max context size.

    | Edit this page View Source

    PushOutputItems(ConversationItem[], Usage)

    Pushes multiple conversation items (messages, tool calls, reasoning, etc.) from the agent output.

    Declaration
    public void PushOutputItems(ConversationItem[] items, Usage usage)
    Parameters
    Type Name Description
    ConversationItem[] items

    Array of conversation items to add.

    Usage usage

    Token usage information.

    | Edit this page View Source

    PushOutputMessage(ResponseMessage, Usage)

    Pushes the response (ChatCompletion) from the chat model to the session. It will extract the assistant's message from the ChatCompletion and add it to the session.

    Declaration
    [Obsolete("Use PushOutputItems instead to support multiple conversation item types.")]
    public void PushOutputMessage(ResponseMessage outputMessage, Usage usage)
    Parameters
    Type Name Description
    ResponseMessage outputMessage

    The assistant's response message.

    Usage usage

    Token usage information.

    | Edit this page View Source

    ReCalculateTotalUsage()

    Declaration
    public void ReCalculateTotalUsage()
    | Edit this page View Source

    SaveConversationAsync(CancellationToken)

    Declaration
    public UniTask<Conversation> SaveConversationAsync(CancellationToken ct = default)
    Parameters
    Type Name Description
    CancellationToken ct
    Returns
    Type Description
    UniTask<Conversation>
    | Edit this page View Source

    SaveConversationItemsAsync(CancellationToken)

    Declaration
    public UniTask<ConversationItem[]> SaveConversationItemsAsync(CancellationToken ct = default)
    Parameters
    Type Name Description
    CancellationToken ct
    Returns
    Type Description
    UniTask<ConversationItem[]>
    | Edit this page View Source

    SetConversationAsync(Conversation, CancellationToken)

    Declaration
    public UniTask<bool> SetConversationAsync(Conversation conversation, CancellationToken ct = default)
    Parameters
    Type Name Description
    Conversation conversation
    CancellationToken ct
    Returns
    Type Description
    UniTask<bool>

    Extension Methods

    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation