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 Detail

      • AgentProcessChatbot

        AgentProcessChatbot(AgentPlatform agentPlatform, AgentSource agentSource, ListenerProvider listenerProvider)
        Parameters:
        agentPlatform - the agent platform to create and manage agent processes
        agentSource - 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 anonymous
        outputChannel - the output channel to send messages to
        systemMessage - optional system message to set the context for the session
      • 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 processes
        agentName - the name of the agent to
        listenerProvider - 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 processes
        agentName - the name of the agent to