RolePlaying
- assistant_role_name (str): The name of the role played by the assistant.
- user_role_name (str): The name of the role played by the user.
- critic_role_name (str, optional): The name of the role played by the critic. Role name with :obj:
"human"will set critic as a :obj:Humanagent, else will create a :obj:CriticAgent. (default: :obj:"critic") - task_prompt (str, optional): A prompt for the task to be performed. (default: :obj:
"") - with_task_specify (bool, optional): Whether to use a task specify agent. (default: :obj:
True) - with_task_planner (bool, optional): Whether to use a task planner agent. (default: :obj:
False) - with_critic_in_the_loop (bool, optional): Whether to include a critic in the loop. (default: :obj:
False) - critic_criteria (str, optional): Critic criteria for the critic agent. If not specified, set the criteria to improve task performance.
- model (BaseModelBackend, optional): The model backend to use for generating responses. If specified, it will override the model in all agents if not specified in agent-specific kwargs. (default: :obj:
OpenAIModelwithGPT_4O_MINI) - task_type (TaskType, optional): The type of task to perform. (default: :obj:
TaskType.AI_SOCIETY) - assistant_agent_kwargs (Dict, optional): Additional arguments to pass to the assistant agent. (default: :obj:
None) - user_agent_kwargs (Dict, optional): Additional arguments to pass to the user agent. (default: :obj:
None) - task_specify_agent_kwargs (Dict, optional): Additional arguments to pass to the task specify agent. (default: :obj:
None) - task_planner_agent_kwargs (Dict, optional): Additional arguments to pass to the task planner agent. (default: :obj:
None) - critic_kwargs (Dict, optional): Additional arguments to pass to the critic. (default: :obj:
None) - sys_msg_generator_kwargs (Dict, optional): Additional arguments to pass to the system message generator. (default: :obj:
None) - extend_sys_msg_meta_dicts (List[Dict], optional): A list of dicts to extend the system message meta dicts with. (default: :obj:
None) - extend_task_specify_meta_dict (Dict, optional): A dict to extend the task specify meta dict with. (default: :obj:
None) - output_language (str, optional): The language to be output by the agents. (default: :obj:
None) - stop_event (Optional[threading.Event], optional): Event to signal termination of the agent’s operation. When set, the agent will terminate its execution. (default: :obj:
None)
init
_init_specified_task_prompt
- assistant_role_name (str): The name of the role played by the assistant.
- user_role_name (str): The name of the role played by the user.
- task_specify_agent_kwargs (Dict, optional): Additional arguments to pass to the task specify agent. (default: :obj:
None) - extend_task_specify_meta_dict (Dict, optional): A dict to extend the task specify meta dict with. (default: :obj:
None) - output_language (str, optional): The language to be output by the agents. (default: :obj:
None)
_init_planned_task_prompt
- task_planner_agent_kwargs (Dict, optional): Additional arguments to pass to the task planner agent. (default: :obj:
None) - output_language (str, optional): The language to be output by the agents. (default: :obj:
None)
_get_sys_message_info
- assistant_role_name (str): The name of the role played by the assistant.
- user_role_name (str): The name of the role played by the user.
- sys_msg_generator (SystemMessageGenerator): A system message generator for agents.
- extend_sys_msg_meta_dicts (List[Dict], optional): A list of dicts to extend the system message meta dicts with. (default: :obj:
None)
BaseMessage representing the assistant’s initial system
message, a BaseMessage representing the user’s initial system
message, and a list of system message meta dicts.
_init_agents
- init_assistant_sys_msg (BaseMessage): Assistant agent’s initial system message.
- init_user_sys_msg (BaseMessage): User agent’s initial system message.
- assistant_agent_kwargs (Dict, optional): Additional arguments to pass to the assistant agent. (default: :obj:
None) - user_agent_kwargs (Dict, optional): Additional arguments to pass to the user agent. (default: :obj:
None) - output_language (str, optional): The language to be output by the agents. (default: :obj:
None) - stop_event (Optional[threading.Event], optional): Event to signal termination of the agent’s operation. When set, the agent will terminate its execution. (default: :obj:
None)
_init_critic
"human",
create a :obj:Human critic agent. Else, create a :obj:CriticAgent
critic agent with specified critic criteria. If the critic criteria
is not specified, set it to improve task performance.
Parameters:
- sys_msg_generator (SystemMessageGenerator): A system message generator for agents.
- sys_msg_meta_dicts (list): A list of system message meta dicts.
- critic_role_name (str): The name of the role played by the critic.
- critic_criteria (str, optional): Critic criteria for the critic agent. If not specified, set the criteria to improve task performance. (default: :obj:
None) - critic_kwargs (Dict, optional): Additional arguments to pass to the critic. (default: :obj:
None)
_reduce_message_options
with_critic_in_the_loop is False, raises a ValueError.
If no messages are provided, a ValueError will be raised.
Parameters:
- messages (Sequence[BaseMessage]): A sequence of
BaseMessageobjects to process.
BaseMessage representing the processed
message.
init_chat
- init_msg_content (str, optional): A user-specified initial message. Will be sent to the role-playing session as the initial message. (default: :obj:
None)
BaseMessage representing the initial
message.
step
- assistant_msg: A
BaseMessagerepresenting the message from the assistant.
clone
- task_prompt (str): The task prompt to be used by the new instance.
- with_memory (bool, optional): Whether to copy the memory (conversation history) to the new instance. If True, the new instance will have the same conversation history. If False, the new instance will have a fresh memory. (default: :obj:
False)
_is_multi_response
- agent (ChatAgent): The agent to check for multi-response support.