Skip to content

Add default value to the logprobs parameter - #1044

Merged
Eric Zhu (ekzhu) merged 11 commits into
microsoft:mainfrom
davorrunje:add-default_value-to-logprobs
Dec 25, 2023
Merged

Add default value to the logprobs parameter#1044
Eric Zhu (ekzhu) merged 11 commits into
microsoft:mainfrom
davorrunje:add-default_value-to-logprobs

Conversation

@davorrunje

@davorrunje Davor Runje (davorrunje) commented Dec 22, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

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

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Dec 24, 2023

Copy link
Copy Markdown

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.

Comment thread autogen/oai/client.py Outdated

@ekzhu Eric Zhu (ekzhu) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me

Comment thread setup.py

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor 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
Copy Markdown
Contributor

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 Eric Zhu (@ekzhu) and merged.

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