Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add warning if duplicate function is registered #2159

Merged
merged 20 commits into from
May 22, 2024
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions autogen/agentchat/conversable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2579,6 +2579,9 @@ def _decorator(func: F) -> F:
elif not hasattr(func, "_name"):
func._name = func.__name__

if (func._name in self._function_map) or (self.llm_config and "tools" in self.llm_config.keys() and func._name in [tool["function"]["name"] for tool in self.llm_config["tools"]]):
jtoy marked this conversation as resolved.
Show resolved Hide resolved
warnings.warn(f"Function '{func._name}' is being overridden.", UserWarning)

self.register_function({func._name: self._wrap_function(func)})

return func
Expand Down