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

Stream occasionally skips words #24

Open
PallavAg opened this issue Jun 1, 2023 · 8 comments
Open

Stream occasionally skips words #24

PallavAg opened this issue Jun 1, 2023 · 8 comments

Comments

@PallavAg
Copy link

PallavAg commented Jun 1, 2023

I am not exactly sure what changed, but after updating the package from version 1.3.3 to 1.4.0 I noticed that while streaming the response, words were occasionally being skipped. Downgrading to 1.3.3 resolved this issue. Might be worth looking into.

I don't have a reproducible example but about every 100 words I notice a missing word.
It's much more noticeable while generating code since the syntax error becomes evident.

@andrewconlan
Copy link

Yep seeing the same thing

@matthiasbuchetics-aaa
Copy link

Yes, same issue here.

@Vk12
Copy link

Vk12 commented Jun 28, 2023

I'm seeing this issue as well. Anyone find a fix?

@tylerstillwater
Copy link

I noticed this issue as well. I moved to https://github.com/MacPaw/OpenAI

The transition was pretty simple, only took a few minutes, and it seems to be better overall.

@PallavAg
Copy link
Author

PallavAg commented Jul 1, 2023

Downgrading to version 1.3.3 or using the MacPaw library seems to be the best solution for now

@roimulia2
Copy link

Same here

@finales101
Copy link

I debugged this a bit today and it seems that always the first token is disappearing from the URLsession.bytes stream in the sendMessageStream function in ChatGPTAPI.swift. When I put "for try await line in result.lines" before the "return AsyncThrowingStream ..." section all tokens are there. Only inside the "return AsyncThrowingStream closure", the first token is missing and replaced by a "delta":{"content":","}. Does anyone with more understanding of this code have any idea? Thx!

@PallavAg
Copy link
Author

I wonder if the issue is similar to the one fixed here: MacPaw/OpenAI#104
The MacPaw library would end the stream when a partial json object was received in the chunk.
This library may be simply skipping the json objects that come in partially - hence the seemingly random missing tokens.

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

No branches or pull requests

7 participants