Skip to content

Commit

Permalink
fix: event logging with nested chats
Browse files Browse the repository at this point in the history
  • Loading branch information
robraux committed May 5, 2024
1 parent e878be5 commit 532e4b8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions autogen/agentchat/conversable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit 532e4b8

Please sign in to comment.