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] Improve config_list_from_json #1026

Merged
merged 11 commits into from
Jan 2, 2024
Merged

Conversation

BeibinLi
Copy link
Collaborator

@BeibinLi BeibinLi commented Dec 19, 2023

UPDATE

The env_or_file variabe can point to an environment variable of file path now.
In this new update, we check if the variable is a file or a json string. If it is a file, then it will load from the file.

Why are these changes needed?

It is a little bit confusing to the previous config_list_from_json function, where the environment variable would store a JSON string. It is usually more intuitive such that an environment variable points to a file location.

Related issue number

Checks

The `env_or_file` variabe can point to an
environment variable of file path.
@codecov-commenter
Copy link

codecov-commenter commented Dec 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c80df8a) 30.74% compared to head (361e90d) 40.54%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1026      +/-   ##
==========================================
+ Coverage   30.74%   40.54%   +9.80%     
==========================================
  Files          30       30              
  Lines        4033     4037       +4     
  Branches      913      964      +51     
==========================================
+ Hits         1240     1637     +397     
+ Misses       2714     2289     -425     
- Partials       79      111      +32     
Flag Coverage Δ
unittests 40.47% <100.00%> (+9.77%) ⬆️

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
Collaborator

@ekzhu ekzhu left a comment

Choose a reason for hiding this comment

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

This is helpful. It also addresses the issue with VScode's Jupyter notebook environment persisting old environment variables.

Updating this example notebook too? https://github.com/microsoft/autogen/blob/main/notebook/oai_openai_utils.ipynb

@ekzhu ekzhu changed the title Improve config_list_from_json [Core] Improve config_list_from_json Dec 26, 2023
test/oai/test_utils.py Outdated Show resolved Hide resolved
@sonichi sonichi added this pull request to the merge queue Jan 2, 2024
Merged via the queue into microsoft:main with commit b26e659 Jan 2, 2024
76 of 84 checks passed
@sonichi sonichi deleted the config_list branch January 2, 2024 21:52
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* add 1m milestone blogpost

* format issues

* update subsection title

* acknowledgement

* Update website/blog/2023-05-07-1M-milestone/index.mdx

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* Update website/blog/2023-05-07-1M-milestone/index.mdx

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* update blogpost

* collaborators

* wording

* Azure Data to Azure Synapse

* name

* Azure Synapse Analytics

* tasks and search space

* Update website/blog/2023-05-07-1M-milestone/index.mdx

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
Co-authored-by: Li Jiang <bnujli@gmail.com>
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* Improve config_list_from_json
The `env_or_file` variabe can point to an
environment variable of file path.

* Update autogen/oai/openai_utils.py

Co-authored-by: Chi Wang <wang.chi@microsoft.com>

* Use "with" to open config file

* Remove unused.

* Remove accidental added file

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
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.

None yet

4 participants