Class ConversationService
Inheritance
ConversationService
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
Properties
|
Edit this page
View Source
AgentId
Declaration
public string AgentId { get; }
Property Value
|
Edit this page
View Source
AgentName
Declaration
public string AgentName { get; }
Property Value
|
Edit this page
View Source
AutoSave
Declaration
public bool AutoSave { get; }
Property Value
|
Edit this page
View Source
Conversation
Declaration
public Conversation Conversation { get; }
Property Value
|
Edit this page
View Source
IsInitialized
Declaration
public bool IsInitialized { get; }
Property Value
|
Edit this page
View Source
Items
Declaration
public List<ConversationItem> Items { get; }
Property Value
|
Edit this page
View Source
LastMessage
Declaration
public Message LastMessage { get; }
Property Value
|
Edit this page
View Source
Messages
Declaration
public List<Message> Messages { get; }
Property Value
|
Edit this page
View Source
Name
Declaration
public string Name { get; set; }
Property Value
|
Edit this page
View Source
Settings
Declaration
public IMemorySettings Settings { get; }
Property Value
Methods
|
Edit this page
View Source
CreateConversationAsync(CancellationToken)
Declaration
public UniTask<Conversation> CreateConversationAsync(CancellationToken ct = default)
Parameters
Returns
|
Edit this page
View Source
DeleteConversationAsync(string, CancellationToken)
Declaration
public UniTask<bool> DeleteConversationAsync(string convId = null, CancellationToken ct = default)
Parameters
Returns
| Type |
Description |
| UniTask<bool> |
|
|
Edit this page
View Source
ListConversationsAsync(CancellationToken)
Declaration
public UniTask<Conversation[]> ListConversationsAsync(CancellationToken ct = default)
Parameters
Returns
|
Edit this page
View Source
LoadConversationAsync(string, bool, CancellationToken)
Declaration
public UniTask<Conversation> LoadConversationAsync(string convId, bool createIfError = true, CancellationToken ct = default)
Parameters
Returns
|
Edit this page
View Source
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
Returns
|
Edit this page
View Source
SaveConversationItemsAsync(CancellationToken)
Declaration
public UniTask<ConversationItem[]> SaveConversationItemsAsync(CancellationToken ct = default)
Parameters
Returns
|
Edit this page
View Source
SetConversationAsync(Conversation, CancellationToken)
Declaration
public UniTask<bool> SetConversationAsync(Conversation conversation, CancellationToken ct = default)
Parameters
Returns
| Type |
Description |
| UniTask<bool> |
|
Extension Methods