rasa/core/agent.py
async def handle_text(
        self,
        text_message: Union[Text, Dict[Text, Any]],
        message_preprocessor: Optional[Callable[[Text], Text]] = None,
        output_channel: Optional[OutputChannel] = None,
        sender_id: Optional[Text] = UserMessage.DEFAULT_SENDER_ID
    ) -> Optional[List[Dict[Text, Any]]]:
        """Handle a single message.

        If a message preprocessor is passed, the message will be passed to that
        function first and the return value is then used as the
        input for the dialogue engine.

        The return value of this function depends on the ``output_channel``. If
        the output channel is not set, set to ``None``, or set
        to ``CollectingOutputChannel`` this function will return the messages
        the bot wants to respond.

        :Example:

            >>> from rasa.core.agent import Agent
            >>> from rasa.core.interpreter import RasaNLUInterpreter
            >>> interpreter = RasaNLUInterpreter(
            ... "examples/restaurantbot/models/nlu/current")
            >>> agent = Agent.load("examples/restaurantbot/models/dialogue",
            ... interpreter=interpreter)
            >>> await agent.handle_text("hello")
            [u'how can I help you?']

        """

        if isinstance(text_message, str):
            text_message = {"text": text_message}

        msg = UserMessage(text_message.get("text"),
                          output_channel,
                          sender_id)

        return await self.handle_message(msg, message_preprocessor)
Handle a single message.

        If a message preprocessor is passed, the message will be passed to that
        function first and the return value is then used as the
        input for the dialogue engine.

        The return value of this function depends on the ``output_channel``. If
        the output channel is not set, set to ``None``, or set
        to ``CollectingOutputChannel`` this function will return the messages
        the bot wants to respond.

        :Example:

            >>> from rasa.core.agent import Agent
            >>> from rasa.core.interpreter import RasaNLUInterpreter
            >>> interpreter = RasaNLUInterpreter(
            ... "examples/restaurantbot/models/nlu/current")
            >>> agent = Agent.load("examples/restaurantbot/models/dialogue",
            ... interpreter=interpreter)
            >>> await agent.handle_text("hello")
            [u'how can I help you?']

        
Handle a single message.
If a message preprocessor is passed, the message will be passed to that
function first and the return value is then used as the
input for the dialogue engine.

The return value of this function depends on the ``output_channel``.
Handle a single message . If a message preprocessor is passed the message will be passed to that function first and the return value is then used as the input for the dialogue engine . The return value of this function depends on the ` ` output_channel ` ` .
async def handle_text(
        self,
        text_message: Union[Text, Dict[Text, Any]],
        message_preprocessor: Optional[Callable[[Text], Text]] = None,
        output_channel: Optional[OutputChannel] = None,
        sender_id: Optional[Text] = UserMessage.DEFAULT_SENDER_ID
    ) -> Optional[List[Dict[Text, Any]]]:
        if isinstance(text_message, str):
            text_message = {"text": text_message}
        msg = UserMessage(text_message.get("text"),
                          output_channel,
                          sender_id)
        return await self.handle_message(msg, message_preprocessor)
async def handle_text ( self , text_message : Union [ Text , Dict [ Text , Any ] ] , message_preprocessor : Optional [ Callable [ [ Text ] , Text ] ] = None , output_channel : Optional [ OutputChannel ] = None , sender_id : Optional [ Text ] = UserMessage . DEFAULT_SENDER_ID ) -> Optional [ List [ Dict [ Text , Any ] ] ] : if isinstance ( text_message , str ) : text_message = { "text" : text_message } msg = UserMessage ( text_message . get ( "text" ) , output_channel , sender_id ) return await self . handle_message ( msg , message_preprocessor )
Handle a single message.
Handle a single message .
"""Handle a single message.

        If a message preprocessor is passed, the message will be passed to that
        function first and the return value is then used as the
        input for the dialogue engine.

        The return value of this function depends on the ``output_channel``. If
        the output channel is not set, set to ``None``, or set
        to ``CollectingOutputChannel`` this function will return the messages
        the bot wants to respond.

        :Example:

            >>> from rasa.core.agent import Agent
            >>> from rasa.core.interpreter import RasaNLUInterpreter
            >>> interpreter = RasaNLUInterpreter(
            ... "examples/restaurantbot/models/nlu/current")
            >>> agent = Agent.load("examples/restaurantbot/models/dialogue",
            ... interpreter=interpreter)
            >>> await agent.handle_text("hello")
            [u'how can I help you?']

        """
self
text_message
Union[Text, Dict[Text, Any]]
message_preprocessor
Optional[Callable[[Text], Text]]
output_channel
Optional[OutputChannel]
sender_id
Optional[Text]
Example
>>> from rasa.core.agent import Agent
>>> from rasa.core.interpreter import RasaNLUInterpreter
>>> interpreter = RasaNLUInterpreter(
"examples/restaurantbot/models/nlu/current")
>>> agent = Agent.load("examples/restaurantbot/models/dialogue",
interpreter=interpreter)
>>> await agent.handle_text("hello")
[u'how can I help you?']
>>> from rasa . core . agent import Agent >>> from rasa . core . interpreter import RasaNLUInterpreter >>> interpreter = RasaNLUInterpreter ( " examples / restaurantbot / models / nlu / current " ) >>> agent = Agent . load ( " examples / restaurantbot / models / dialogue " interpreter = interpreter ) >>> await agent . handle_text ( " hello " ) [ u ' how can I help you? ' ]