streaming #28926
Unanswered
navaneethstabilix
asked this question in
Ask Dosu
streaming
#28926
Replies: 1 comment 2 replies
-
Yes, the code is streaming the response. The To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
async def stream_to_websocket(prompt:str):
async for chunk in llm.astream(prompt):
yield chunk.content
@app.get('/streaming/ask')
async def main(query: str):
return StreamingResponse(stream_to_websocket(query), media_type='text/event-stream')
Beta Was this translation helpful? Give feedback.
All reactions