From 953402180b88b988e2ad35873ab4a0f37474c1ae Mon Sep 17 00:00:00 2001 From: Diego Colombo Date: Mon, 3 Jun 2024 15:55:37 +0100 Subject: [PATCH] Refactor hook_lists initialization and add type hints - 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. --- autogen/agentchat/conversable_agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py index ac72e832ea6c..732a7fb31689 100644 --- a/autogen/agentchat/conversable_agent.py +++ b/autogen/agentchat/conversable_agent.py @@ -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": [], @@ -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.