From 70a3c4b99e144238cbe021c63cd2641538ea1746 Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Wed, 31 Jul 2024 09:11:27 -0400 Subject: [PATCH] anext() was introduced in py3.10, use __anext__ to support 3.8 --- libs/ai-endpoints/tests/integration_tests/test_chat_models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/ai-endpoints/tests/integration_tests/test_chat_models.py b/libs/ai-endpoints/tests/integration_tests/test_chat_models.py index b3952a3e..a0b24432 100644 --- a/libs/ai-endpoints/tests/integration_tests/test_chat_models.py +++ b/libs/ai-endpoints/tests/integration_tests/test_chat_models.py @@ -172,7 +172,9 @@ async def test_ai_endpoints_astream(chat_model: str, mode: dict) -> None: llm = ChatNVIDIA(model=chat_model, max_tokens=35, **mode) generator = llm.astream("Count to 100, e.g. 1 2 3 4") - response = await anext(generator) + response = ( + await generator.__anext__() + ) # todo: use anext(generator) when py3.8 is dropped cnt = 0 async for chunk in generator: assert isinstance(chunk.content, str)