Class AgentProcessChatbot
-
- All Implemented Interfaces:
-
com.embabel.chat.Chatbot
public final class AgentProcessChatbot implements Chatbot
Chatbot implementation backed by an ongoing AgentProcess The AgentProcess must react to UserMessage and respond on its output channel The AgentProcess can assume that the Conversation will be available in the blackboard, and the latest UserMessage. Action methods will often take precondition being that the last event was a UserMessage. A convenient approach is for the core action methods to return ChatbotReturn, and handle ConversationOver, although that is not required.
-
-
Constructor Summary
Constructors Constructor Description AgentProcessChatbot(AgentPlatform agentPlatform, AgentSource agentSource, ConversationFactory conversationFactory, ListenerProvider listenerProvider, PlannerType plannerType, Verbosity verbosity)
-
Method Summary
Modifier and Type Method Description ChatSessioncreateSession(User user, OutputChannel outputChannel, String contextId, String conversationId)Create a new chat session, or restore an existing one. ChatSessionfindSession(String conversationId)Get a chat session by conversation id. final static ChatbotutilityFromPlatform(AgentPlatform agentPlatform, ConversationFactory conversationFactory, Verbosity verbosity, ListenerProvider listenerProvider)Create a chatbot that will use all actions available on the platform, with utility-based planning. final static ChatbotutilityFromPlatform(AgentPlatform agentPlatform, ConversationFactory conversationFactory, Verbosity verbosity)Create a chatbot that will use all actions available on the platform, with utility-based planning. final static ChatbotutilityFromPlatform(AgentPlatform agentPlatform, ConversationFactory conversationFactory)Create a chatbot that will use all actions available on the platform, with utility-based planning. final static ChatbotutilityFromPlatform(AgentPlatform agentPlatform)Create a chatbot that will use all actions available on the platform, with utility-based planning. -
-
Constructor Detail
-
AgentProcessChatbot
AgentProcessChatbot(AgentPlatform agentPlatform, AgentSource agentSource, ConversationFactory conversationFactory, ListenerProvider listenerProvider, PlannerType plannerType, Verbosity verbosity)
- Parameters:
agentPlatform- the agent platform to create and manage agent processesagentSource- factory for agents.conversationFactory- factory for creating conversations.
-
-
Method Detail
-
createSession
ChatSession createSession(User user, OutputChannel outputChannel, String contextId, String conversationId)
Create a new chat session, or restore an existing one.
If contextId is provided, objects from that context are loaded into the blackboard (e.g., user preferences, prior state).
If conversationId is provided and a conversation exists in storage, the session will be restored with its message history. Otherwise, a new conversation is created with that ID.
- Parameters:
user- the user to associate the session with, or null for anonymousoutputChannel- the output channel to send messages tocontextId- optional context ID to load prior state fromconversationId- optional ID to restore an existing conversation, or create with specific ID
-
findSession
ChatSession findSession(String conversationId)
Get a chat session by conversation id.
-
utilityFromPlatform
@JvmOverloads() final static Chatbot utilityFromPlatform(AgentPlatform agentPlatform, ConversationFactory conversationFactory, Verbosity verbosity, ListenerProvider listenerProvider)
Create a chatbot that will use all actions available on the platform, with utility-based planning.
- Parameters:
agentPlatform- the agent platformconversationFactory- factory for creating conversations.verbosity- verbosity settings for debugginglistenerProvider- provider for event listeners
-
utilityFromPlatform
@JvmOverloads() final static Chatbot utilityFromPlatform(AgentPlatform agentPlatform, ConversationFactory conversationFactory, Verbosity verbosity)
Create a chatbot that will use all actions available on the platform, with utility-based planning.
- Parameters:
agentPlatform- the agent platformconversationFactory- factory for creating conversations.verbosity- verbosity settings for debugging
-
utilityFromPlatform
@JvmOverloads() final static Chatbot utilityFromPlatform(AgentPlatform agentPlatform, ConversationFactory conversationFactory)
Create a chatbot that will use all actions available on the platform, with utility-based planning.
- Parameters:
agentPlatform- the agent platformconversationFactory- factory for creating conversations.
-
utilityFromPlatform
@JvmOverloads() final static Chatbot utilityFromPlatform(AgentPlatform agentPlatform)
Create a chatbot that will use all actions available on the platform, with utility-based planning.
- Parameters:
agentPlatform- the agent platform
-
-
-
-