code: def chat(
      model_path: Optional[Text] = None,
      endpoints: Optional[Text] = None,
      agent: Optional["Agent"] = None,
  ) -> None:
      """Chat to the bot within a Jupyter notebook.
  
      Args:
          model_path: Path to a combined Rasa model.
          endpoints: Path to a yaml with the action server is custom actions are defined.
          agent: Rasa Core agent (used if no Rasa model given).
      """
      if model_path:
          agent = asyncio.run(
              rasa.core.agent.load_agent(
                  model_path=model_path, endpoints=endpoints
              )
          )
  
      if agent is None:
          raise RasaException(
              "Either the provided model path could not load the agent "
              "or no core agent was provided."
          )
  
      print(
          "Your bot is ready to talk! Type your messages here or send '/stop'."
      )
      while True:
          message = input()
          if message == "/stop":
              break
  
          responses = asyncio.run(agent.handle_text(message))
          for response in responses:
              _display_bot_response(response)
  
file_path: rasa/rasa/jupyter.py
imports: import asyncio
  import pprint
  import typing
  from typing import Any, Dict, Optional, Text
  from rasa.shared.exceptions import RasaException
  from rasa.shared.utils.cli import print_success
  import rasa.core.agent
  import rasa.utils.common
label_desc: Use image node_id 2 for calling a global function with example usage: chat(model_path, endpoints, agent) without return types