From 6a590e4430c0ae4587e1d559cac821f0e05872a5 Mon Sep 17 00:00:00 2001 From: Hk669 Date: Tue, 25 Jun 2024 10:41:55 +0530 Subject: [PATCH] fix log_function_use warning --- autogen/agentchat/conversable_agent.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py index b434fc648eb..81c666de022 100644 --- a/autogen/agentchat/conversable_agent.py +++ b/autogen/agentchat/conversable_agent.py @@ -2526,14 +2526,16 @@ def _wrap_function(self, func: F) -> F: @functools.wraps(func) def _wrapped_func(*args, **kwargs): retval = func(*args, **kwargs) - log_function_use(self, func, kwargs, retval) + if logging_enabled(): + log_function_use(self, func, kwargs, retval) return serialize_to_str(retval) @load_basemodels_if_needed @functools.wraps(func) async def _a_wrapped_func(*args, **kwargs): retval = await func(*args, **kwargs) - log_function_use(self, func, kwargs, retval) + if logging_enabled(): + log_function_use(self, func, kwargs, retval) return serialize_to_str(retval) wrapped_func = _a_wrapped_func if inspect.iscoroutinefunction(func) else _wrapped_func