aiter.py — langchain Source File
Architecture documentation for aiter.py, a python file in the langchain codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR b33566b6_8971_bdf8_5db2_dd5a13740a1f["aiter.py"] efd68536_3a44_76e4_ec2a_0ec171774703["collections"] b33566b6_8971_bdf8_5db2_dd5a13740a1f --> efd68536_3a44_76e4_ec2a_0ec171774703 cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"] b33566b6_8971_bdf8_5db2_dd5a13740a1f --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7 69e1d8cc_6173_dcd0_bfdf_2132d8e1ce56["contextlib"] b33566b6_8971_bdf8_5db2_dd5a13740a1f --> 69e1d8cc_6173_dcd0_bfdf_2132d8e1ce56 05bcd40b_a309_8a05_c2c6_59e32e113cf5["types"] b33566b6_8971_bdf8_5db2_dd5a13740a1f --> 05bcd40b_a309_8a05_c2c6_59e32e113cf5 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] b33566b6_8971_bdf8_5db2_dd5a13740a1f --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 91721f45_4909_e489_8c1f_084f8bd87145["typing_extensions"] b33566b6_8971_bdf8_5db2_dd5a13740a1f --> 91721f45_4909_e489_8c1f_084f8bd87145 2d1edd36_20be_d887_f834_7b58c1b5a50f["langchain_core._api.deprecation"] b33566b6_8971_bdf8_5db2_dd5a13740a1f --> 2d1edd36_20be_d887_f834_7b58c1b5a50f style b33566b6_8971_bdf8_5db2_dd5a13740a1f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Asynchronous iterator utilities.
Adapted from
https://github.com/maxfischer2781/asyncstdlib/blob/master/asyncstdlib/itertools.py
MIT License.
"""
from collections import deque
from collections.abc import (
AsyncGenerator,
AsyncIterable,
AsyncIterator,
Awaitable,
Callable,
Iterator,
)
from contextlib import AbstractAsyncContextManager
from types import TracebackType
from typing import (
Any,
Generic,
TypeVar,
cast,
overload,
)
from typing_extensions import override
from langchain_core._api.deprecation import deprecated
T = TypeVar("T")
_no_default = object()
# https://github.com/python/cpython/blob/main/Lib/test/test_asyncgen.py#L54
@deprecated(since="1.1.2", removal="2.0.0")
def py_anext(
iterator: AsyncIterator[T], default: T | Any = _no_default
) -> Awaitable[T | Any | None]:
"""Pure-Python implementation of `anext()` for testing purposes.
Closely matches the builtin `anext()` C implementation.
Can be used to compare the built-in implementation of the inner coroutines machinery
to C-implementation of `__anext__()` and `send()` or `throw()` on the returned
generator.
Args:
iterator: The async iterator to advance.
default: The value to return if the iterator is exhausted.
If not provided, a `StopAsyncIteration` exception is raised.
Returns:
The next value from the iterator, or the default value if the iterator is
exhausted.
Raises:
TypeError: If the iterator is not an async iterator.
// ... (288 more lines)
Domain
Subdomains
Functions
Dependencies
- collections
- collections.abc
- contextlib
- langchain_core._api.deprecation
- types
- typing
- typing_extensions
Source
Frequently Asked Questions
What does aiter.py do?
aiter.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in aiter.py?
aiter.py defines 3 function(s): abatch_iterate, py_anext, tee_peer.
What does aiter.py depend on?
aiter.py imports 7 module(s): collections, collections.abc, contextlib, langchain_core._api.deprecation, types, typing, typing_extensions.
Where is aiter.py in the architecture?
aiter.py is located at libs/core/langchain_core/utils/aiter.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/core/langchain_core/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free