Skip to main content

society_of_mind_agent

SocietyOfMindAgent

class SocietyOfMindAgent(ConversableAgent)

(预览)一个单一的代理,作为内心独白运行一个群聊。在对话结束时(无论何种原因),SocietyOfMindAgent会对整个内心独白的消息历史应用response_preparer方法,以提取回复的最终答案。

大多数参数都是从ConversableAgent继承而来的。新增的参数有: chat_manager(GroupChatManager):将运行内心独白的群聊管理器 response_preparer(可选,可调用对象或字符串):如果response_preparer是一个可调用函数,则它应该具有以下签名: f(self: SocietyOfMindAgent, messages: List[Dict]) 其中self是SocietyOfMindAgent本身,messages是内心独白消息的列表。该函数应返回一个表示从历史记录中提取或准备的最终回复的字符串。 如果response_preparer是一个字符串,则它应该是用于从内部聊天记录中提取最终消息的LLM提示。 默认的response_preparer取决于是否提供了llm_config。如果llm_config为False,则response_preparer确定性地返回内心独白中的最后一条消息。如果llm_config设置为其他任何值,则使用默认的LLM提示。

chat_manager

@property
def chat_manager() -> Union[GroupChatManager, None]

返回群聊管理器。

update_chat_manager

def update_chat_manager(chat_manager: Union[GroupChatManager, None])

更新群聊管理器。

参数

  • chat_manager GroupChatManager - 群聊管理器

generate_inner_monologue_reply

def generate_inner_monologue_reply(
messages: Optional[List[Dict]] = None,
sender: Optional[Agent] = None,
config: Optional[OpenAIWrapper] = None
) -> Tuple[bool, Union[str, Dict, None]]

通过运行群聊生成一个回复。