From 9334852a3e81556cc5c8bcbc7c26cc8acca1baaf Mon Sep 17 00:00:00 2001 From: adavyas Date: Fri, 24 Jul 2026 11:37:57 -0400 Subject: [PATCH] fix: type SSE stream wrapper as AsyncIterator (basedpyright) Co-Authored-By: Claude Fable 5 --- src/routers/workspaces.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routers/workspaces.py b/src/routers/workspaces.py index 86d9dbf2..e2512107 100644 --- a/src/routers/workspaces.py +++ b/src/routers/workspaces.py @@ -281,7 +281,7 @@ async def chat( workspace-wide questions ("what themes are common across users?", "which peers discussed X?"). """ - from typing import Any as _Any + from collections.abc import AsyncIterator from pydantic import BaseModel as _BaseModel @@ -300,7 +300,7 @@ async def chat( if options.stream: - async def format_sse_stream(chunks: _Any) -> _Any: + async def format_sse_stream(chunks: AsyncIterator[str]) -> AsyncIterator[str]: async for chunk in chunks: yield f"data: {json.dumps({'delta': {'content': chunk}, 'done': False})}\n\n" yield f"data: {json.dumps({'done': True})}\n\n"