Class LocalChatbot
- Namespace
- Glitch9.AIDevKit.Components
A full-featured chatbot component that integrates with the AIDevKit's chat system. This component allows you to send messages, receive responses, and manage chat sessions. It supports both streaming and non-streaming responses, and can handle function calls.
public class LocalChatbot : ChatbotBase<ChatSession, ChatMessage, ChatDelta>
- Inheritance
-
objectLocalChatbot
- Inherited Members
Fields
profile
protected LocalChatbotProfileBase profile
Field Value
sessionId
protected string sessionId
Field Value
- string
Properties
AutoSave
If enabled, the chatbot will automatically save the chat session after each message is sent or received.
This is useful for preserving chat history and ensuring that conversations are not lost.
public bool AutoSave { get; set; }
Property Value
- bool
IsInitialized
Indicates whether the assistant is initialized and ready to process requests.
This property should be overridden by derived classes to provide specific initialization logic.
public override bool IsInitialized { get; }
Property Value
- bool
Messages
The list of messages in the chatbot's conversation history.
This property should be set to the messages that the chatbot has processed, including user messages and responses.
It is used to maintain the context of the conversation and provide a history of interactions.
public override List<ChatMessage> Messages { get; }
Property Value
- List<ChatMessage>
Model
The model used by the chatbot for processing requests and generating responses.
This property should be set to the model that provides the necessary capabilities for the chatbot.
public override Model Model { get; set; }
Property Value
Name
The name of the chatbot.
public override string Name { get; set; }
Property Value
- string
Profile
public override ChatbotProfile Profile { get; }
Property Value
Session
The chat session associated with this chatbot.
This session contains the chat history and is used to manage the conversation state.
public ChatSession Session { get; }
Property Value
SessionId
The unique identifier for the chat session.
This ID is used to load or create a chat session and is essential for managing the chat history.
public string SessionId { get; }
Property Value
- string
UtilityModel
The utility model used for resolving intents and processing requests.
This property should be set to the model that provides the necessary capabilities for the chatbot.
public override Model UtilityModel { get; set; }
Property Value
Methods
CreateConversationAsyncINTERNAL()
protected override UniTask<ChatSession> CreateConversationAsyncINTERNAL()
Returns
- UniTask<ChatSession>
DeleteConversationAsyncINTERNAL(string)
protected override UniTask<bool> DeleteConversationAsyncINTERNAL(string conversationId)
Parameters
conversationIdstring
Returns
- UniTask<bool>
InitializeAsync()
public override UniTask InitializeAsync()
Returns
- UniTask
LoadConversationAsyncINTERNAL(string)
protected override UniTask<ChatSession> LoadConversationAsyncINTERNAL(string conversationId)
Parameters
conversationIdstring
Returns
- UniTask<ChatSession>
OnReceiveMessage(ChatMessage)
protected override void OnReceiveMessage(ChatMessage response)
Parameters
responseChatMessage
ProcessChatRequestAsyncINTERNAL(ChatMessage)
protected override UniTask<ChatMessage> ProcessChatRequestAsyncINTERNAL(ChatMessage inputMessage)
Parameters
inputMessageChatMessage
Returns
- UniTask<ChatMessage>
SaveConversationAsync()
public UniTask SaveConversationAsync()
Returns
- UniTask