Skip to content

Commit 3320f80

Browse files
joseferbenjoshkyh
authored andcommitted
fix: forward kwargs to conversable agent + fix typing (#1193)
* fix: forwards kwargs to conversable agent + typing * add description unit test * add documentation for description
1 parent b7c7c0c commit 3320f80

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

autogen/agentchat/contrib/compressible_agent.py

+6
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def __init__(
6363
llm_config: Optional[Union[Dict, bool]] = None,
6464
default_auto_reply: Optional[Union[str, Dict, None]] = "",
6565
compress_config: Optional[Dict] = False,
66+
description: Optional[str] = None,
67+
**kwargs,
6668
):
6769
"""
6870
Args:
@@ -93,6 +95,8 @@ def __init__(
9395
- "broadcast" (Optional, bool, default to True): whether to update the compressed message history to sender.
9496
- "verbose" (Optional, bool, default to False): Whether to print the content before and after compression. Used when mode="COMPRESS".
9597
- "leave_last_n" (Optional, int, default to 0): If provided, the last n messages will not be compressed. Used when mode="COMPRESS".
98+
description (str): a short description of the agent. This description is used by other agents
99+
(e.g. the GroupChatManager) to decide when to call upon this agent. (Default: system_message)
96100
**kwargs (dict): Please refer to other kwargs in
97101
[ConversableAgent](../conversable_agent#__init__).
98102
"""
@@ -106,6 +110,8 @@ def __init__(
106110
code_execution_config=code_execution_config,
107111
llm_config=llm_config,
108112
default_auto_reply=default_auto_reply,
113+
description=description,
114+
**kwargs,
109115
)
110116

111117
self._set_compress_config(compress_config)

test/agentchat/contrib/test_compressible_agent.py

+11
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,19 @@ def test_mode_terminate():
211211
assert final, "Terminating the conversation at max token limit is not working."
212212

213213

214+
@pytest.mark.skipif(
215+
sys.platform in ["darwin", "win32"] or skip,
216+
reason="do not run on MacOS or windows OR dependency is not installed OR requested to skip",
217+
)
218+
def test_new_compressible_agent_description():
219+
assistant = CompressibleAgent(name="assistant", description="this is a description")
220+
221+
assert assistant.description == "this is a description", "description is not set correctly"
222+
223+
214224
if __name__ == "__main__":
215225
test_mode_compress()
216226
test_mode_customized()
217227
test_compress_message()
218228
test_mode_terminate()
229+
test_new_compressible_agent_description()

0 commit comments

Comments
 (0)