From ecc4113a7e04ac5136d6d012949081359944be71 Mon Sep 17 00:00:00 2001 From: Rob Date: Mon, 6 May 2024 14:51:45 -0400 Subject: [PATCH] fix: event logging with nested chats (#2600) Co-authored-by: Chi Wang --- autogen/agentchat/conversable_agent.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py index a997b9151428..bfd38a54d609 100644 --- a/autogen/agentchat/conversable_agent.py +++ b/autogen/agentchat/conversable_agent.py @@ -7,7 +7,6 @@ import re import warnings from collections import defaultdict -from functools import partial from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Type, TypeVar, Union from openai import BadRequestError @@ -434,10 +433,15 @@ def reply_func_from_nested_chats( reply_func_from_nested_chats = self._summary_from_nested_chats if not callable(reply_func_from_nested_chats): raise ValueError("reply_func_from_nested_chats must be a callable") - reply_func = partial(reply_func_from_nested_chats, chat_queue) + + def wrapped_reply_func(recipient, messages=None, sender=None, config=None): + return reply_func_from_nested_chats(chat_queue, recipient, messages, sender, config) + + functools.update_wrapper(wrapped_reply_func, reply_func_from_nested_chats) + self.register_reply( trigger, - reply_func, + wrapped_reply_func, position, kwargs.get("config"), kwargs.get("reset_config"),