Implement AsyncTextIteratorStreamer for asynchronous streaming (#34931)

* Add AsyncTextIteratorStreamer class

* export AsyncTextIteratorStreamer

* export AsyncTextIteratorStreamer

* improve docs

* missing import

* missing import

* doc example fix

* doc example output fix

* add pytest-asyncio

* first attempt at tests

* missing import

* add pytest-asyncio

* fallback to wait_for and raise TimeoutError on timeout

* check for TimeoutError

* autodoc

* reorder imports

* fix style

---------

Co-authored-by: Arthur Zucker <arthur.zucker@gmail.com>
Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
This commit is contained in:
Sigbjørn Skjæret
2024-12-20 12:08:12 +01:00
committed by GitHub
parent b5a557e5fe
commit eafbb0eca7
7 changed files with 154 additions and 4 deletions

View File

@@ -148,6 +148,7 @@ _deps = [
"pyyaml>=5.1",
"pydantic",
"pytest>=7.2.0,<8.0.0",
"pytest-asyncio",
"pytest-timeout",
"pytest-xdist",
"python>=3.9.0",
@@ -319,6 +320,7 @@ extras["tiktoken"] = deps_list("tiktoken", "blobfile")
extras["testing"] = (
deps_list(
"pytest",
"pytest-asyncio",
"pytest-rich",
"pytest-xdist",
"timeout-decorator",