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

[Core] Throw an error when the OAI_CONFIG_LIST is missing. #1082

Merged
merged 8 commits into from
Jan 3, 2024

Conversation

afourney
Copy link
Member

Why are these changes needed?

We silently return an empty list when someone explicitly asks for an OAI_CONFIG_LIST and it can't be found. Paired with other default behavior (e.g, #1077) this can lead to costly calls to GPT-4.

Tackling this was actually one of the very first commits I pushed to autogen in #174. At the time, I was advised that changing default behavior was unwise and that I should perhaps just output an warning message.

Given #1077, and countless other issue since (maybe, #1025), I think it's about time that I go with my original instinct, and correct this unexpected and potentially dangerous behavior.

Related issue number

#1077, #1076, #1025, #174, #178, and so so many other.

Checks

@codecov-commenter
Copy link

codecov-commenter commented Dec 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b26e659) 30.81% compared to head (57d11fe) 60.89%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1082       +/-   ##
===========================================
+ Coverage   30.81%   60.89%   +30.08%     
===========================================
  Files          30       30               
  Lines        4037     4033        -4     
  Branches      915      964       +49     
===========================================
+ Hits         1244     2456     +1212     
+ Misses       2714     1322     -1392     
- Partials       79      255      +176     
Flag Coverage Δ
unittests 60.77% <100.00%> (+30.00%) ⬆️

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.

@afourney
Copy link
Member Author

All those errors are also from misconfigured tests.... they should have been detected long ago, but were masked by this very issue I am correcting here.

Copy link
Collaborator

@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.

To pass the tests with this change, need to move the failing line into the try...except block above it.

test/oai/test_utils.py Outdated Show resolved Hide resolved
autogen/oai/openai_utils.py Show resolved Hide resolved
…not try to load the config_list when skipping OAI tests.
@afourney
Copy link
Member Author

afourney commented Jan 2, 2024

The test failure should be fixed by #1110 Unfortunately it causes conflicts that need to be resolved.

Ok, I think I fixed the merge conflict. Please take a look.

@sonichi
Copy link
Collaborator

sonichi commented Jan 2, 2024

Sorry for another conflict. Hopefully not difficult to resolve.

@afourney
Copy link
Member Author

afourney commented Jan 2, 2024

Sorry for another conflict. Hopefully not difficult to resolve.

Ok, that one was easier :)

Copy link
Contributor

@rickyloynd-microsoft rickyloynd-microsoft left a comment

Choose a reason for hiding this comment

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

Looks great!

@qingyun-wu qingyun-wu added this pull request to the merge queue Jan 3, 2024
Merged via the queue into main with commit 4fcc45f Jan 3, 2024
84 checks passed
@afourney afourney deleted the throw_error_when_no_oai_config branch January 3, 2024 17:40
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* update openai model support

* new gpt3.5

* docstr

* function_call and content may co-exist

* test function call

---------

Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
…#1082)

* Throw an explicit and proper error when someone asks to load the OAI_CONFIG_LIST, and it is missing.

* Updated to use pytest.raises. Added docstring. Updated some tests to not try to load the config_list when skipping OAI tests.

* Fixed wrong indentation in config_list_from_json, and updated test_utils to work with non-empty lists.

* Read key location from global constants.

* Added missingpath.

* Moved config_list_from_json to inside a skip check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants