Skip to content

Commit

Permalink
fix: treat instances with __aiter__ as async iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
CNSeniorious000 committed May 15, 2024
1 parent e057123 commit ff8bfaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions python/promplate/chain/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from inspect import Parameter, isasyncgen, isawaitable, signature
from inspect import Parameter, isawaitable, signature
from itertools import accumulate
from typing import AsyncIterable, Awaitable, Callable, Iterable, TypeVar, cast

Expand Down Expand Up @@ -37,8 +37,8 @@ async def async_accumulate(async_iterable: AsyncIterable[str]):


def accumulate_any(any_iterable: Iterable[str] | AsyncIterable[str]):
if isasyncgen(any_iterable):
return async_accumulate(any_iterable)
if "__aiter__" in dir(any_iterable):
return async_accumulate(any_iterable) # type: ignore

async def _():
for i in accumulate(cast(Iterable[str], any_iterable)):
Expand Down
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "promplate"
version = "0.3.4.4"
version = "0.3.4.5"
description = "Prompt engineering framework for humans"
homepage = "https://promplate.dev/"
documentation = "https://docs.py.promplate.dev/"
Expand Down

0 comments on commit ff8bfaa

Please sign in to comment.