A programming framework for agentic AI
fix: forward kwargs to conversable agent + fix typing (#1193)
Josef Erben44260934f34b
diff --git a/autogen/agentchat/contrib/compressible_agent.py b/autogen/agentchat/contrib/compressible_agent.pyindex 72f31b6f3..a8a186edc 100644--- a/autogen/agentchat/contrib/compressible_agent.py+++ b/autogen/agentchat/contrib/compressible_agent.py@@ -63,6 +63,8 @@ Reply "TERMINATE" in the end when everything is done.llm_config: Optional[Union[Dict, bool]] = None,default_auto_reply: Optional[Union[str, Dict, None]] = "",compress_config: Optional[Dict] = False,+ description: Optional[str] = None,+ **kwargs,):"""Args:@@ -93,6 +95,8 @@ Reply "TERMINATE" in the end when everything is done.- "broadcast" (Optional, bool, default to True): whether to update the compressed message history to sender.- "verbose" (Optional, bool, default to False): Whether to print the content before and after compression. Used when mode="COMPRESS".- "leave_last_n" (Optional, int, default to 0): If provided, the last n messages will not be compressed. Used when mode="COMPRESS".+ description (str): a short description of the agent. This description is used by other agents+ (e.g. the GroupChatManager) to decide when to call upon this agent. (Default: system_message)**kwargs (dict): Please refer to other kwargs in[ConversableAgent](../conversable_agent#__init__)."""@@ -106,6 +110,8 @@ Reply "TERMINATE" in the end when everything is done.code_execution_config=code_execution_config,llm_config=llm_config,default_auto_reply=default_auto_reply,+ description=description,+ **kwargs,)self._set_compress_config(compress_config)diff --git a/test/agentchat/contrib/test_compressible_agent.py b/test/agentchat/contrib/test_compressible_agent.pyindex 4682e0420..c5ef784f6 100644--- a/test/agentchat/contrib/test_compressible_agent.py+++ b/test/agentchat/contrib/test_compressible_agent.py@@ -211,8 +211,19 @@ def test_mode_terminate():assert final, "Terminating the conversation at max token limit is not working."+ sys.platform in ["darwin", "win32"] or skip,+ reason="do not run on MacOS or windows OR dependency is not installed OR requested to skip",+)+def test_new_compressible_agent_description():+ assistant = CompressibleAgent(name="assistant", description="this is a description")++ assert assistant.description == "this is a description", "description is not set correctly"++if __name__ == "__main__":test_mode_compress()test_mode_customized()test_compress_message()test_mode_terminate()+ test_new_compressible_agent_description()