We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 702b035 commit 53276d3Copy full SHA for 53276d3
routers/messages.py
@@ -52,13 +52,13 @@ async def stream_response(
52
) -> StreamingResponse:
53
# Create a generator to stream the response from the assistant
54
async def event_generator():
55
- stream: AsyncAssistantStreamManager = client.beta.threads.runs.stream(
+ stream_manager: AsyncAssistantStreamManager = client.beta.threads.runs.stream(
56
assistant_id=assistant_id,
57
thread_id=thread_id
58
)
59
60
- async with stream as stream_manager:
61
- async for text in stream_manager.text_deltas:
+ async with stream_manager as event_handler:
+ async for text in event_handler.text_deltas:
62
yield f"data: {text.replace('\n', '<br>')}\n\n"
63
64
# Send a done event when the stream is complete
0 commit comments