From 56e7eb79ff7ae0b277c6fcfaa517770382acccd3 Mon Sep 17 00:00:00 2001 From: jstzwj <1103870790@qq.com> Date: Mon, 1 Jul 2024 21:42:46 +0800 Subject: [PATCH] AsyncGenerator typing bug fix --- langport/routers/gateway/openai_compatible.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/langport/routers/gateway/openai_compatible.py b/langport/routers/gateway/openai_compatible.py index 425cc61..0498043 100644 --- a/langport/routers/gateway/openai_compatible.py +++ b/langport/routers/gateway/openai_compatible.py @@ -198,7 +198,7 @@ async def generate_completion_stream_generator(app_settings: AppSettings, payloa yield "data: [DONE]\n\n" -async def generate_completion_stream(app_settings: AppSettings, url: str, payload: Dict[str, Any]) -> AsyncGenerator[GenerationWorkerResult, Any, None]: +async def generate_completion_stream(app_settings: AppSettings, url: str, payload: Dict[str, Any]) -> AsyncGenerator[GenerationWorkerResult, None]: async with httpx.AsyncClient() as client: try: worker_addr = await _get_worker_address(app_settings, payload["model"], "generation", client, DispatchMethod.LOTTERY) @@ -252,7 +252,7 @@ async def single_completions_non_stream(app_settings: AppSettings, payload: Dict async def chat_completion_stream_generator( app_settings: AppSettings, payload: Dict[str, Any], n: int -) -> AsyncGenerator[str, Any, None]: +) -> AsyncGenerator[str, None]: """ Event stream format: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format