client.beta.chat.completions.parse
returns tool_calls
with empty array, which is invalid for message history
#2061
Labels
bug
Something isn't working
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
When using
client.beta.chat.completions.parse
, and with no tools involved, theParsedChatCompletionMessage
response will include atool_calls
with the empty array[]
instead ofNone
. This is invalid when including that in the message history you pass to subsequent calls toclient.beta.chat.completions.parse
orclient.chat.completions.create
, and will blow up with:To Reproduce
Run any
client.beta.chat.completions.parse
call and append that message to a message history of a subsequent request.Code snippets
OS
macOS
Python version
Python 3.12.5
Library version
openai==1.60.2
The text was updated successfully, but these errors were encountered: