-
Notifications
You must be signed in to change notification settings - Fork 791
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
fix(stream): streaming enable to work with proxy #4330
Conversation
@jianshen92 I think might be worth merging this to 1.2 |
@bojiang should I be merging to 1.2 instead? |
@aarnphm This is a bug fix. It's affecting the deployment of openllm under certain circumstances. There's still some time for 1.2 to release. Let's merge to main first? |
By the way, I think what Aaron meant might not be that we don't offer these utils, but rather that we provide utils which then return SSE objects. @jianshen92
|
b9970e7
to
c7d2706
Compare
@bojiang @jianshen92 what is the status of this PR? |
@aarnphm Jianshen is still working on the utils. |
Usage: runner class Runner(bentoml.Runnable):
...
@bentoml.Runnable.method()
async def raw_text_streaming():
yield "this is valid"
@bentoml.Runnable.method()
async def sse_streaming():
yield SSE(data="my data", event="my event", id="a123cbx", retry=123) api-server # if we expect raw text, nothing changes. we dont care if they get chunked
# if we expect a SSE text stream, we can use the `from_chunks` method to reconstruct the chunked data
async for event in SSE.from_chunks(runner_iterator):
yield event.to_str()
yield event.data |
84cbc29
to
083ea80
Compare
Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
For more information, see https://pre-commit.ci
083ea80
to
9ac3bc3
Compare
* Stream raw text without data container and pickling * Helper function to and from sse * Update src/bentoml/_internal/server/runner_app.py Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * remove utilities function * misc * Update src/bentoml/_internal/server/runner_app.py Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * misc * fix: add unit test for sse utils * ci: auto fixes from pre-commit.ci For more information, see https://pre-commit.ci * Bring back utilities function! * Catching invalid SSE message * comments * Update test cases * Remove coupling of implementation * update test * Using String IO over string concat --------- Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Co-authored-by: bojiang <bojiang_@outlook.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
* Stream raw text without data container and pickling * Helper function to and from sse * Update src/bentoml/_internal/server/runner_app.py Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * remove utilities function * misc * Update src/bentoml/_internal/server/runner_app.py Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * misc * fix: add unit test for sse utils * ci: auto fixes from pre-commit.ci For more information, see https://pre-commit.ci * Bring back utilities function! * Catching invalid SSE message * comments * Update test cases * Remove coupling of implementation * update test * Using String IO over string concat --------- Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Co-authored-by: bojiang <bojiang_@outlook.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
* Stream raw text without data container and pickling * Helper function to and from sse * Update src/bentoml/_internal/server/runner_app.py Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * remove utilities function * misc * Update src/bentoml/_internal/server/runner_app.py Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * misc * fix: add unit test for sse utils * ci: auto fixes from pre-commit.ci For more information, see https://pre-commit.ci * Bring back utilities function! * Catching invalid SSE message * comments * Update test cases * Remove coupling of implementation * update test * Using String IO over string concat --------- Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Co-authored-by: bojiang <bojiang_@outlook.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
What does this PR address?
Relates to #4310
to_sse
andfrom_sse
to be used at boundaries (api server and runner) if user wants to stream text in SSE formatFixes #(issue)
Before submitting:
guide on how to create a pull request.
pre-commit run -a
script has passed (instructions)?those accordingly? Here are documentation guidelines and tips on writting docs.