class_docstr: Class for a person that can act in a ParlAI world via websockets.
docstr: Send an agent a message through the websocket manager.
  
  Only attachments of type `image` are currently supported. In the case of
  images, the resultant message will have a `text` field which will be a
  base 64 encoded image and `mime_type` which will be an image mime type.
  
  Args:
      act: dict. If act contain an `payload` key, then a dict should be
          provided for the value in `payload`. Otherwise, act should be
          a dict with the key `text` for the message.
          For the `pyaload` dict, this agent expects a `type` key, which
          specifies whether or not the attachment is an image. If the
          attachment is an image, a `data` key must be specified with a
          base 64 encoded image.
          A `quick_replies` key can be provided with a list of string quick
          replies for any message
docstr_tok: ["Send","an","agent","a","message","through","the","websocket","manager",".","Only","attachments","of","type","`","image","`","are","currently","supported",".","In","the","case","of","images",",","the","resultant","message","will","have","a","`","text","`","field","which","will","be","a","base","64","encoded","image","and","`","mime_type","`","which","will","be","an","image","mime","type",".","Args",":","act",":","dict",".","If","act","contain","an","`","payload","`","key",",","then","a","dict","should","be","provided","for","the","value","in","`","payload","`",".","Otherwise",",","act","should","be","a","dict","with","the","key","`","text","`","for","the","message",".","For","the","`","pyaload","`","dict",",","this","agent","expects","a","`","type","`","key",",","which","specifies","whether","or","not","the","attachment","is","an","image",".","If","the","attachment","is","an","image",",","a","`","data","`","key","must","be","specified","with","a","base","64","encoded","image",".","A","`","quick_replies","`","key","can","be","provided","with","a","list","of","string","quick","replies","for","any","message"]
code: def observe(self, act):
      """
      Send an agent a message through the websocket manager.
  
      Only attachments of type `image` are currently supported. In the case of
      images, the resultant message will have a `text` field which will be a
      base 64 encoded image and `mime_type` which will be an image mime type.
  
      Args:
          act: dict. If act contain an `payload` key, then a dict should be
              provided for the value in `payload`. Otherwise, act should be
              a dict with the key `text` for the message.
              For the `pyaload` dict, this agent expects a `type` key, which
              specifies whether or not the attachment is an image. If the
              attachment is an image, a `data` key must be specified with a
              base 64 encoded image.
              A `quick_replies` key can be provided with a list of string quick
              replies for any message
      """
      logging.info(f"Sending new message: {act}")
      quick_replies = act.get("quick_replies", None)
      if act.get("payload", None):
          self.manager.observe_payload(
              self.id, act["payload"], quick_replies
          )
      else:
          self.manager.observe_message(
              self.id, act["text"], quick_replies
          )
  
imports: import logging
  from parlai.chat_service.core.agents import ChatServiceAgent
label_desc: Use image node_id 2 for calling the WebsocketAgent obj's underlying member method code with example usage: obj.observe(act) without return types