diff --git a/examples/logging/openai_async_stream_logging.py b/examples/logging/openai_async_stream_logging.py index 526cbebf..4d96faf5 100644 --- a/examples/logging/openai_async_stream_logging.py +++ b/examples/logging/openai_async_stream_logging.py @@ -3,7 +3,7 @@ import openai from openai import AsyncOpenAI -from log10._httpx_utils import gather_pending_async_tasks +from log10._httpx_utils import finalize from log10.load import log10 @@ -20,7 +20,7 @@ async def main(): ) async for chunk in stream: print(chunk.choices[0].delta.content or "", end="", flush=True) - await gather_pending_async_tasks() + await finalize() asyncio.run(main()) diff --git a/log10/_httpx_utils.py b/log10/_httpx_utils.py index dc191d55..50a4b246 100644 --- a/log10/_httpx_utils.py +++ b/log10/_httpx_utils.py @@ -523,7 +523,7 @@ async def handle_async_request(self, request: httpx.Request) -> httpx.Response: return response -async def gather_pending_async_tasks(): +async def finalize(): pending = asyncio.all_tasks() pending.remove(asyncio.current_task()) await asyncio.gather(*pending)