astream() — langchain Function Reference
Architecture documentation for the astream() function in fake.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD bdc304b3_0b00_e5f1_6cc0_8c00c3778256["astream()"] e7a8ec35_0102_1c07_7999_79d89f0901d2["FakeStreamingListLLM"] bdc304b3_0b00_e5f1_6cc0_8c00c3778256 -->|defined in| e7a8ec35_0102_1c07_7999_79d89f0901d2 style bdc304b3_0b00_e5f1_6cc0_8c00c3778256 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/language_models/fake.py lines 119–137
async def astream(
self,
input: LanguageModelInput,
config: RunnableConfig | None = None,
*,
stop: list[str] | None = None,
**kwargs: Any,
) -> AsyncIterator[str]:
result = await self.ainvoke(input, config)
for i_c, c in enumerate(result):
if self.sleep is not None:
await asyncio.sleep(self.sleep)
if (
self.error_on_chunk_number is not None
and i_c == self.error_on_chunk_number
):
raise FakeListLLMError
yield c
Domain
Subdomains
Source
Frequently Asked Questions
What does astream() do?
astream() is a function in the langchain codebase, defined in libs/core/langchain_core/language_models/fake.py.
Where is astream() defined?
astream() is defined in libs/core/langchain_core/language_models/fake.py at line 119.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free