-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Missing default value to logprobs in openai.types.chat.chat_completion.Choice #1006
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
Comments
Why are you instantiating |
ah, it seems you're doing this for tests, is that right? Hmm, we didn't intend for these models to be instantiated this way, so we haven't considered this sort of change to be breaking, but of course in cases like yours, it is. If we do this we'll want to add This is something we'll have to think about and likely won't be actioned until after the new year. Thank you for raising this! |
Thank you the reply. The main reason I raised the issue is that it broke AutoGen (microsoft/autogen#1043). I made a PR there, but until the new version is released everyone has to downgrade openai lib as remedy. i understand your argument and agree with it in general. The thing that was puzzling me was that the default value was not set it in openai.types.chat.chat_completion.Choice, but it was set in openai.types.chat.chat_completion_chunk.Choice. I could not understand why and I assumed it was an oversight. |
Thank you @davorrunje ! The use-case of needing to build up a full object from chunks makes sense. We plan to bake that into this library in the coming weeks, but we should support that. We do plan to add |
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
#980 added token
logprobs
to chat completions of typeOptional[ChoiceLogprobs]
inopenai.types.chat.chat_completion.Choice
andopenai.types.chat.chat_completion_chunk.Choice
. In the latter, the default value is set toNone
, while in the former it is not set. This causes backward compatibility problems with code written for versions prior to 1.5.0.To Reproduce
Execution of the following code fails:
The output
Setting
logprobs
toNone
fixes the problem.Code snippets
OS
Linux
Python version
Python 3.10.13
Library version
openai 1.6.0
The text was updated successfully, but these errors were encountered: