Class AgentProcessChatbot
-
- All Implemented Interfaces:
-
com.embabel.chat.Chatbot
public final class AgentProcessChatbot implements Chatbot
Chatbot implementation backed by an 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, ListenerProvider listenerProvider)
-
Method Summary
Modifier and Type Method Description ChatSessioncreateSession(User user, OutputChannel outputChannel, String systemMessage)Create a new chat session. ChatSessionfindSession(String conversationId)Get a chat session by conversation id. final static ChatbotwithAgentByName(AgentPlatform agentPlatform, String agentName, ListenerProvider listenerProvider)Create a chatbot with the given agent. final static ChatbotwithAgentByName(AgentPlatform agentPlatform, String agentName)Create a chatbot with the given agent. -
-
Constructor Detail
-
AgentProcessChatbot
AgentProcessChatbot(AgentPlatform agentPlatform, AgentSource agentSource, ListenerProvider listenerProvider)
- Parameters:
agentPlatform- the agent platform to create and manage agent processesagentSource- factory for agents.
-
-
Method Detail
-
createSession
ChatSession createSession(User user, OutputChannel outputChannel, String systemMessage)
Create a new chat session. If user is provided, the session will be associated with that user. Optionally, a system message can be provided to set the context for the session.
- Parameters:
user- the user to associate the session with, or null for anonymousoutputChannel- the output channel to send messages tosystemMessage- optional system message to set the context for the session
-
findSession
ChatSession findSession(String conversationId)
Get a chat session by conversation id.
-
withAgentByName
@JvmOverloads() final static Chatbot withAgentByName(AgentPlatform agentPlatform, String agentName, ListenerProvider listenerProvider)
Create a chatbot with the given agent. The agent is looked up by name from the agent platform.
- Parameters:
agentPlatform- the agent platform to create and manage agent processesagentName- the name of the agent tolistenerProvider- provider for contextual event listeners
-
withAgentByName
@JvmOverloads() final static Chatbot withAgentByName(AgentPlatform agentPlatform, String agentName)
Create a chatbot with the given agent. The agent is looked up by name from the agent platform.
- Parameters:
agentPlatform- the agent platform to create and manage agent processesagentName- the name of the agent to
-
-
-
-