Skip to content

Rewrite the parser by more closely following spec #316

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

Merged
merged 3 commits into from
Apr 13, 2025

Conversation

nezhyborets
Copy link
Collaborator

What

Rewrite Server Sent Events parser

Why

Our parser doesn't follow the spec closely which may lead to bugs like in the connected issue

Affected Areas

Streaming Interpreter

@nezhyborets nezhyborets linked an issue Apr 12, 2025 that may be closed by this pull request
@nezhyborets
Copy link
Collaborator Author

nezhyborets commented Apr 12, 2025

@JackuXL could you try to switch package to this branch to see if it works for you?

315-streaming-session-is-ended-before-any-output

@JackuXL
Copy link
Contributor

JackuXL commented Apr 12, 2025

@JackuXL could you try to switch package to this branch to see if it works for you?

315-streaming-session-is-ended-before-any-output

I have tried, but it still does not work. The output is the same as before.

@nezhyborets
Copy link
Collaborator Author

Omg, crazy. Thanks for trying. Will try to find how to configure Volcano on my side to reproduce

@nezhyborets
Copy link
Collaborator Author

It could be very helpful if you'd put a breakpoint in StreamingSession and print the raw response data. It returns data so you'd have to print String(data: data, encoding: .utf8). The response may come multiple times, the first one may be enough

@nezhyborets
Copy link
Collaborator Author

nezhyborets commented Apr 12, 2025

On line 62 or 63 should work, at the start of the delegate method that provides response data

image

@JackuXL
Copy link
Contributor

JackuXL commented Apr 12, 2025

On line 62 or 63 should work, at the start of the delegate method that provides response data

image

(lldb) po String(data:data, encoding: .utf8)
▿ Optional<String>
  - some : "data: [DONE]\n\n"

@nezhyborets
Copy link
Collaborator Author

Is it the first and the only response in streaming session? If so, then there would basically be nothing to parse. I am not sure why a platform would respond in such a manner 🤔 interesting

@nezhyborets
Copy link
Collaborator Author

nezhyborets commented Apr 12, 2025

Can you print the query?

UPD: sorry you've already printed it, no need

@JackuXL
Copy link
Contributor

JackuXL commented Apr 12, 2025

Is it the first and the only response in streaming session? If so, then there would basically be nothing to parse. I am not sure why a platform would respond in such a manner 🤔 interesting

The platform enables developers to bring websearch to any LLM, and use it through standard OpenAI API.

Later I would try to stream using official OpenAI Python SDK and see if it could work.

@nezhyborets
Copy link
Collaborator Author

It would be great, thanks!

@JackuXL
Copy link
Contributor

JackuXL commented Apr 13, 2025

It seems that the latest version works, and the previous error is due to volcengine itself. Thanks!

@nezhyborets
Copy link
Collaborator Author

Yay! Thanks for checking!

@nezhyborets nezhyborets merged commit 0da7b83 into main Apr 13, 2025
5 checks passed
@nezhyborets nezhyborets deleted the 315-streaming-session-is-ended-before-any-output branch April 13, 2025 12:15
@nezhyborets
Copy link
Collaborator Author

Hi @JackuXL, it turned out that there had been multiple issues with the new parser. I've release the fixes in 0.4.1. So maybe it will work better for you too

@JackuXL
Copy link
Contributor

JackuXL commented Apr 14, 2025

Hi @JackuXL, it turned out that there had been multiple issues with the new parser. I've release the fixes in 0.4.1. So maybe it will work better for you too

Ok, thanks for the reminder!

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.

streaming session is ended before any output
3 participants