-
Notifications
You must be signed in to change notification settings - Fork 736
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
ChatCompletionStream.fromReadableStream errors due to missing finish_reason for choice #499
Comments
I'm seeing this only when using the Here is a workaround patch: petrgazarov@093fcbd. I'm happy to send a PR if the maintainers are interested. |
@petrgazarov thanks for looking into this, I am also getting this issue when using gpt-4-vision-preview, didn't think it was relevant so wasn't mentioned initially I have not got this issue before so I guess that's the key difference |
Thanks for reporting, we're investigating. |
Is this something that openai needs to fix upstream? This is causing streamed responses using gpt-4-vision-preview and vercel/ai to break |
Hey @jonluca ! Yes, this needs to be fixed on the backend. Let me check with the team about this, I'm sorry that's still happening. |
I'm still receiving the error when using the openai package |
@vitorfdl what is the error you're getting? |
const messages = [
{ role: 'user', content:
[
{
type: 'image_url',
image_url: 'bla',
}
]
}
];
const stream = await openai.beta.chat.completions.stream({
model,
messages,
stream: true,
});
stream.on('content', (delta, snapshot) => {
console.log(delta)
});
stream.finalChatCompletion().then( () => {
} ); I got an error
|
Thanks! Great news, this has been fixed in the API. Please file a new issue if you see any further problems. |
Confirm this is a Node library issue and not an underlying OpenAI API issue
Describe the bug
When trying to use the API described here https://github.com/openai/openai-node/blob/2242688f14d5ab7dbf312d92a99fa4a7394907dc/examples/stream-to-client-browser.ts
I'm getting the following an error at the following point:
where the actual choices look like this:
Looks like the code expects
finish_reason
to be populated but the finish details are now in a property calledfinish_details
?To Reproduce
Setup a server that responds with chat completion streams
Then in the client try to use the
ChatCompletionStream.fromReadableStream
API, e.g.:Code snippets
No response
OS
Windows
Node version
18.12.1
Library version
4.16.1
The text was updated successfully, but these errors were encountered: