_atransform() — langchain Function Reference
Architecture documentation for the _atransform() function in list.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD b097eaed_4e00_ba36_ebba_08b481d535ef["_atransform()"] e5899f8c_6bbb_d54c_7feb_0e84452b07a6["ListOutputParser"] b097eaed_4e00_ba36_ebba_08b481d535ef -->|defined in| e5899f8c_6bbb_d54c_7feb_0e84452b07a6 41224df8_3d8a_1c21_05f0_c201fe6698b9["parse_iter()"] b097eaed_4e00_ba36_ebba_08b481d535ef -->|calls| 41224df8_3d8a_1c21_05f0_c201fe6698b9 3a830584_5655_fbe4_4957_e28246de484b["parse()"] b097eaed_4e00_ba36_ebba_08b481d535ef -->|calls| 3a830584_5655_fbe4_4957_e28246de484b 210e3778_c98c_3076_17cc_1cfe00a3431b["droplastn()"] b097eaed_4e00_ba36_ebba_08b481d535ef -->|calls| 210e3778_c98c_3076_17cc_1cfe00a3431b 1eb4fd5c_34b6_cb12_859d_1d2144dce96b["parse()"] b097eaed_4e00_ba36_ebba_08b481d535ef -->|calls| 1eb4fd5c_34b6_cb12_859d_1d2144dce96b style b097eaed_4e00_ba36_ebba_08b481d535ef fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/output_parsers/list.py lines 105–136
async def _atransform(
self, input: AsyncIterator[str | BaseMessage]
) -> AsyncIterator[list[str]]:
buffer = ""
async for chunk in input:
if isinstance(chunk, BaseMessage):
# Extract text
chunk_content = chunk.content
if not isinstance(chunk_content, str):
continue
buffer += chunk_content
else:
# Add current chunk to buffer
buffer += chunk
# Parse buffer into a list of parts
try:
done_idx = 0
# Yield only complete parts
for m in droplastn(self.parse_iter(buffer), 1):
done_idx = m.end()
yield [m.group(1)]
buffer = buffer[done_idx:]
except NotImplementedError:
parts = self.parse(buffer)
# Yield only complete parts
if len(parts) > 1:
for part in parts[:-1]:
yield [part]
buffer = parts[-1]
# Yield the last part
for part in self.parse(buffer):
yield [part]
Domain
Subdomains
Source
Frequently Asked Questions
What does _atransform() do?
_atransform() is a function in the langchain codebase, defined in libs/core/langchain_core/output_parsers/list.py.
Where is _atransform() defined?
_atransform() is defined in libs/core/langchain_core/output_parsers/list.py at line 105.
What does _atransform() call?
_atransform() calls 4 function(s): droplastn, parse, parse, parse_iter.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free