Skip to content

Commit

Permalink
Add missing "self" in function call
Browse files Browse the repository at this point in the history
  • Loading branch information
BeibinLi committed Aug 4, 2023
1 parent aec518c commit 9218808
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions flaml/autogen/agentchat/responsive_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
def colored(x, *args, **kwargs):
return x


def register_auto_reply(class_type, position=0):
"""Register a class-specific reply function.
We achieve this by decorate the function with _regster_for and _insert_pos attributes.
Expand All @@ -26,12 +27,15 @@ def register_auto_reply(class_type, position=0):
class_type (Class): the class type.
position (int): the position of the reply function in the reply function list.
"""

def decorator(reply_func):
reply_func._registered_for = class_type
reply_func._insert_pos = position
return reply_func

return decorator


class ResponsiveAgent(Agent):
"""(Experimental) A class for generic responsive agents which can be configured as assistant or user proxy.
Expand Down Expand Up @@ -132,13 +136,9 @@ def __init__(

# Handle class-specific reply defined in the "register_auto_reply" decorator.
for name, method in vars(type(self)).items():
if hasattr(method, '_registered_for') and hasattr(method, '_insert_pos'):
if hasattr(method, "_registered_for") and hasattr(method, "_insert_pos"):
self._class_specific_reply.insert(method._insert_pos, (method._registered_for, method))





@property
def system_message(self):
"""Return the system message."""
Expand Down Expand Up @@ -556,7 +556,7 @@ def generate_reply(
if isinstance(sender, class_specifc_reply[0]) and (
not exclude or class_specifc_reply[1] not in exclude
):
final, reply = class_specifc_reply[1](messages, sender)
final, reply = class_specifc_reply[1](self, messages, sender)
if final:
return reply
return self._default_auto_reply
Expand Down

0 comments on commit 9218808

Please sign in to comment.