Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type and default value of the code_execution_config parameter in UserProxyAgent #1996

Merged
merged 7 commits into from
Mar 13, 2024

Conversation

davorrunje
Copy link
Collaborator

Why are these changes needed?

UserProxyAgent declares code_execution_config to be an optional parameter and sets its default value for to None

code_execution_config: Optional[Union[Dict, Literal[False]]] = None,
, while ConversableAgent deprecated use of None
code_execution_config: Union[Dict, Literal[False]] = False,

Instantiating a user proxy results in a deprecating warning. E.g. by running the following test:

pytest test/agentchat/test_agent_setup_with_use_docker_settings.py -k test_agent_setup_with_env_variable_false_and_docker_running

we get the following warning

============================================== warnings summary ===============================================
test/agentchat/test_agent_setup_with_use_docker_settings.py::test_agent_setup_with_env_variable_false_and_docker_running
  /workspaces/autogen/autogen/agentchat/user_proxy_agent.py:83: UserWarning: Using None to signal a default code_execution_config is deprecated. Use {} to use default or False to disable code execution.
    super().__init__(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

This PR changes the type and the default value as follows:

code_execution_config: Union[Dict, Literal[False]] = {},

This resolves warnings and it behaves identically as before the change.

Related issue number

Closes #1995

Checks

@codecov-commenter
Copy link

codecov-commenter commented Mar 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.96%. Comparing base (24418bd) to head (60253d3).

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1996       +/-   ##
===========================================
+ Coverage   37.57%   47.96%   +10.39%     
===========================================
  Files          65       65               
  Lines        6912     6913        +1     
  Branches     1521     1648      +127     
===========================================
+ Hits         2597     3316      +719     
+ Misses       4090     3319      -771     
- Partials      225      278       +53     
Flag Coverage Δ
unittests 47.83% <100.00%> (+10.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@sonichi sonichi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test failures need to be fixed before merging.

@davorrunje
Copy link
Collaborator Author

The test failures need to be fixed before merging.

I'll do it today

@sonichi sonichi added this pull request to the merge queue Mar 13, 2024
Merged via the queue into main with commit bf08856 Mar 13, 2024
60 of 67 checks passed
@davorrunje davorrunje deleted the fix-user-proxy-code-execution-default branch March 14, 2024 06:52
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
…UserProxyAgent (microsoft#1996)

* fix type and default value of the code_execution_config of UserProxAgent

* fix type and default value of the code_execution_config of UserProxAgent

* set default value of llm_config in UserProxyAgent to None

* fixed tests

* revert llm_config to False

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue]: Fix type and default value of the code_execution_config parameter in UserProxyAgent
4 participants