Skip to content

Commit

Permalink
Refactor hook_lists initialization and add type hints
Browse files Browse the repository at this point in the history
- Refactored the initialization of `hook_lists` to use a colon instead of an equal sign.
- Added type hints for the parameters and return types of `process_last_received_message` method.
  • Loading branch information
colombod committed Jun 3, 2024
1 parent 9c17e76 commit 9534021
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autogen/agentchat/conversable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def __init__(

# Registered hooks are kept in lists, indexed by hookable method, to be called in their order of registration.
# New hookable methods should be added to this list as required to support new agent capabilities.
self.hook_lists : Dict[str, List[Callable[[List[Dict]], List[Dict]]]] = {
self.hook_lists: Dict[str, List[Callable[[List[Dict]], List[Dict]]]] = {
"process_last_received_message": [],
"process_all_messages_before_reply": [],
"process_message_before_send": [],
Expand Down Expand Up @@ -2724,7 +2724,7 @@ def process_all_messages_before_reply(self, messages: List[Dict]) -> List[Dict]:
processed_messages = hook(processed_messages)
return processed_messages

def process_last_received_message(self, messages:List[Dict]) -> List[Dict]:
def process_last_received_message(self, messages: List[Dict]) -> List[Dict]:
"""
Calls any registered capability hooks to use and potentially modify the text of the last message,
as long as the last message is not a function call or exit command.
Expand Down

0 comments on commit 9534021

Please sign in to comment.