fix: type SSE stream wrapper as AsyncIterator (basedpyright)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
fc9de0f0d9
commit
9334852a3e
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue