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

Add default value to the logprobs parameter #1044

Merged
merged 11 commits into from
Dec 25, 2023

Conversation

davorrunje
Copy link
Collaborator

@davorrunje davorrunje commented Dec 22, 2023

Why are these changes needed?

Describe the bug

openai/openai-python#980 added token logprobs to chat completions of type Optional[ChoiceLogprobs] in openai.types.chat.chat_completion.Choice and openai.types.chat.chat_completion_chunk.Choice. In the latter, the default value is set to None, while in the former it is not set. This causes backward compatibility problems with code written for versions prior to 1.5.0.

Steps to reproduce

Tests are failing locally and in CI (e.g. https://github.com/microsoft/autogen/actions/runs/7293999612/job/19878098426)

Additional Information

autogen version: 0.2.2
openai version: 1.5.0 and 1.6.0

Related issue number

Closes #1043

Checks

@rattrayalex
Copy link

I encourage merging this; we don't anticipate adding = None right away.

(I'm a maintainer of the openai-python library).

@codecov-commenter
Copy link

codecov-commenter commented Dec 24, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (4b5ec5a) 30.25% compared to head (d5e41f8) 40.65%.

Files Patch % Lines
autogen/oai/client.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1044       +/-   ##
===========================================
+ Coverage   30.25%   40.65%   +10.39%     
===========================================
  Files          30       30               
  Lines        3983     3980        -3     
  Branches      898      946       +48     
===========================================
+ Hits         1205     1618      +413     
+ Misses       2699     2233      -466     
- Partials       79      129       +50     
Flag Coverage Δ
unittests 40.60% <0.00%> (+10.39%) ⬆️

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.

Looks good to me

@ekzhu ekzhu enabled auto-merge December 25, 2023 16:34
@ekzhu ekzhu added this pull request to the merge queue Dec 25, 2023
Merged via the queue into microsoft:main with commit cb6512d Dec 25, 2023
76 of 84 checks passed
@@ -14,7 +14,7 @@
__version__ = version["__version__"]

install_requires = [
"openai>=1,<1.5", # a temporary fix for breaking changes in 1.5
"openai>=1.3,<1.5",
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't we remove "<1.5" if the PR is supposed to support openai>=1.5?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Correct. Somehow this might have been a merge error

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that's probably due to merge. I'll run tests again against the latest 1.6.1 and create a new PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

#1071 has been created by @ekzhu and merged.

ekzhu added a commit that referenced this pull request Dec 27, 2023
Fix dependency error introduced when merging #1044
github-merge-queue bot pushed a commit that referenced this pull request Dec 27, 2023
Fix dependency error introduced when merging #1044
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
Co-authored-by: Pratyay Roy <63900765+pratyay-roy@users.noreply.github.com>
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* added default value to logprobs param

* fixed to work withversions of openai below 1.5.0

* rebase

* fixed openai version in comments

* polishing

* limit openai version to below 1.5.0

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
Fix dependency error introduced when merging microsoft#1044
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.

[Bug]: Missing default value to logprobs in openai.types.chat.chat_completion.Choice
6 participants