class_docstr: (In preview) A class for generic conversable agents which can be configured as assistant or user proxy.
  
  After receiving each message, the agent will send a reply to the sender unless the msg is a termination msg.
  For example, AssistantAgent and UserProxyAgent are subclasses of this class,
  configured with different default settings.
  
  To modify auto reply, override `generate_reply` method.
  To disable/enable human response in every turn, set `human_input_mode` to "NEVER" or "ALWAYS".
  To modify the way to get human input, override `get_human_input` method.
  To modify the way to execute code blocks, single code block, or function call, override `execute_code_blocks`,
  `run_code`, and `execute_function` methods respectively.
  To customize the initial message when a conversation starts, override `generate_init_message` method.
class_docstr_tok: ["(","In","preview",")","A","class","for","generic","conversable","agents","which","can","be","configured","as","assistant","or","user","proxy",".","After","receiving","each","message",",","the","agent","will","send","a","reply","to","the","sender","unless","the","msg","is","a","termination","msg",".","For","example",",","AssistantAgent","and","UserProxyAgent","are","subclasses","of","this","class",",","configured","with","different","default","settings",".","To","modify","auto","reply",",","override","`","generate_reply","`","method",".","To","disable\/enable","human","response","in","every","turn",",","set","`","human_input_mode","`","to","``","NEVER","''","or","``","ALWAYS","''",".","To","modify","the","way","to","get","human","input",",","override","`","get_human_input","`","method",".","To","modify","the","way","to","execute","code","blocks",",","single","code","block",",","or","function","call",",","override","`","execute_code_blocks","`",",","`","run_code","`",",","and","`","execute_function","`","methods","respectively",".","To","customize","the","initial","message","when","a","conversation","starts",",","override","`","generate_init_message","`","method","."]
docstr: Receive a message from another agent.
  
  Once a message is received, this function sends a reply to the sender or stop.
  The reply can be generated automatically or entered manually by a human.
  
  Args:
      message (dict or str): message from the sender. If the type is dict, it may contain the following reserved fields (either content or function_call need to be provided).
          1. "content": content of the message, can be None.
          2. "function_call": a dictionary containing the function name and arguments. (deprecated in favor of "tool_calls")
          3. "tool_calls": a list of dictionaries containing the function name and arguments.
          4. "role": role of the message, can be "assistant", "user", "function", "tool".
              This field is only needed to distinguish between "function" or "assistant"/"user".
          5. "name": In most cases, this field is not needed. When the role is "function", this field is needed to indicate the function name.
          6. "context" (dict): the context of the message, which will be passed to
              [OpenAIWrapper.create](../oai/client#create).
      sender: sender of an Agent instance.
      request_reply (bool or None): whether a reply is requested from the sender.
          If None, the value is determined by `self.reply_at_receive[sender]`.
      silent (bool or None): (Experimental) whether to print the message received.
  
  Raises:
      ValueError: if the message can't be converted into a valid ChatCompletion message.
docstr_tok: ["Receive","a","message","from","another","agent",".","Once","a","message","is","received",",","this","function","sends","a","reply","to","the","sender","or","stop",".","The","reply","can","be","generated","automatically","or","entered","manually","by","a","human",".","Args",":","message","(","dict","or","str",")",":","message","from","the","sender",".","If","the","type","is","dict",",","it","may","contain","the","following","reserved","fields","(","either","content","or","function_call","need","to","be","provided",")",".","1",".","``","content","''",":","content","of","the","message",",","can","be","None",".","2",".","``","function_call","''",":","a","dictionary","containing","the","function","name","and","arguments",".","(","deprecated","in","favor","of","``","tool_calls","''",")","3",".","``","tool_calls","''",":","a","list","of","dictionaries","containing","the","function","name","and","arguments",".","4",".","``","role","''",":","role","of","the","message",",","can","be","``","assistant","''",",","``","user","''",",","``","function","''",",","``","tool","''",".","This","field","is","only","needed","to","distinguish","between","``","function","''","or","``","assistant","''","\/","''","user","''",".","5",".","``","name","''",":","In","most","cases",",","this","field","is","not","needed",".","When","the","role","is","``","function","''",",","this","field","is","needed","to","indicate","the","function","name",".","6",".","``","context","''","(","dict",")",":","the","context","of","the","message",",","which","will","be","passed","to","[","OpenAIWrapper.create","]","(","..","\/oai\/client","#","create",")",".","sender",":","sender","of","an","Agent","instance",".","request_reply","(","bool","or","None",")",":","whether","a","reply","is","requested","from","the","sender",".","If","None",",","the","value","is","determined","by","`","self.reply_at_receive","[","sender","]","`",".","silent","(","bool","or","None",")",":","(","Experimental",")","whether","to","print","the","message","received",".","Raises",":","ValueError",":","if","the","message","ca","n't","be","converted","into","a","valid","ChatCompletion","message","."]
code: def receive(
      self,
      message: Union[Dict, str],
      sender: Agent,
      request_reply: Optional[bool] = None,
      silent: Optional[bool] = False,
  ):
      """Receive a message from another agent.
  
      Once a message is received, this function sends a reply to the sender or stop.
      The reply can be generated automatically or entered manually by a human.
  
      Args:
          message (dict or str): message from the sender. If the type is dict, it may contain the following reserved fields (either content or function_call need to be provided).
              1. "content": content of the message, can be None.
              2. "function_call": a dictionary containing the function name and arguments. (deprecated in favor of "tool_calls")
              3. "tool_calls": a list of dictionaries containing the function name and arguments.
              4. "role": role of the message, can be "assistant", "user", "function", "tool".
                  This field is only needed to distinguish between "function" or "assistant"/"user".
              5. "name": In most cases, this field is not needed. When the role is "function", this field is needed to indicate the function name.
              6. "context" (dict): the context of the message, which will be passed to
                  [OpenAIWrapper.create](../oai/client#create).
          sender: sender of an Agent instance.
          request_reply (bool or None): whether a reply is requested from the sender.
              If None, the value is determined by `self.reply_at_receive[sender]`.
          silent (bool or None): (Experimental) whether to print the message received.
  
      Raises:
          ValueError: if the message can't be converted into a valid ChatCompletion message.
      """
      self._process_received_message(message, sender, silent)
      if (
          request_reply is False
          or request_reply is None
          and self.reply_at_receive[sender] is False
      ):
          return
      reply = self.generate_reply(
          messages=self.chat_messages[sender], sender=sender
      )
      if reply is not None:
          self.send(reply, sender, silent=silent)
  
imports: import asyncio
  import copy
  import functools
  import inspect
  import json
  import logging
  import re
  from collections import defaultdict
  from typing import Any, Awaitable, Callable, Dict, List, Literal, Optional, Tuple, Type, TypeVar, Union
  from ..None import OpenAIWrapper
  from ..code_utils import DEFAULT_MODEL, UNKNOWN, content_str, execute_code, extract_code, infer_lang
  from ..function_utils import get_function_schema, load_basemodels_if_needed, serialize_to_str
  from .agent import Agent
  from .._pydantic import model_dump
label_desc: Use image node_id 17 for calling the ConversableAgent obj's underlying member method code with example usage: obj.receive(message, sender, request_reply, silent) without return types