Closed peilongchencc closed 8 months ago
Refer to this for response streaming: https://sanic.dev/en/guide/advanced/streaming.html#response-streaming
Closing. Please address support questions to Sanic community forums or to our Discord #support group.
See this for help. https://sanic.dev/en/help.html
Community support is in Discord or our forum.
@ahopkins
I apologize for asking about the issue #2730 you've already marked as "Closed as not planned," but I really need your assistance.
Hello, I would like to fetch user's historical chat data through the
post
method and then pass this chat data to a large language model's API.The large language model returns content via streaming output. I will then process the results returned by the large language model and subsequently stream out the processed results.
My code structure is as follows:
I would like to return
rtn
in a streaming manner. I referred to the code on your website (https://gist.github.com/ahopkins/9cdf98147da863a0c1c5b0b8581d6980), but due to my limited understanding of web communications, I'm not sure how to use theResponse streaming
technique within thepost
method.Could you help me with an example of a
post
method that usesResponse streaming
?I hope to get your assistance with this.
Ps: My Sanic version is 23.12.1.