Home / Function/ atransform() — langchain Function Reference

atransform() — langchain Function Reference

Architecture documentation for the atransform() function in passthrough.py from the langchain codebase.

Function python LangChainCore Runnables calls 1 called by 5

Entity Profile

Dependency Diagram

graph TD
  68f322b4_1349_271a_408d_e2eb04ed643e["atransform()"]
  915f0e72_2130_6a8d_6929_3a7528446033["RunnablePassthrough"]
  68f322b4_1349_271a_408d_e2eb04ed643e -->|defined in| 915f0e72_2130_6a8d_6929_3a7528446033
  89892239_3bd4_deee_84cd_ee93929f64ad["astream()"]
  89892239_3bd4_deee_84cd_ee93929f64ad -->|calls| 68f322b4_1349_271a_408d_e2eb04ed643e
  eb798efb_a553_9e1b_0bc9_415bcf874209["atransform()"]
  eb798efb_a553_9e1b_0bc9_415bcf874209 -->|calls| 68f322b4_1349_271a_408d_e2eb04ed643e
  792ae3d8_8499_60c2_cf08_c723693f4e67["_atransform()"]
  792ae3d8_8499_60c2_cf08_c723693f4e67 -->|calls| 68f322b4_1349_271a_408d_e2eb04ed643e
  29e5a61e_3192_fcb1_8408_ac325ae0e3cd["astream()"]
  29e5a61e_3192_fcb1_8408_ac325ae0e3cd -->|calls| 68f322b4_1349_271a_408d_e2eb04ed643e
  62530ed9_3d20_a587_0e13_a04ed805b3c4["astream()"]
  62530ed9_3d20_a587_0e13_a04ed805b3c4 -->|calls| 68f322b4_1349_271a_408d_e2eb04ed643e
  eb798efb_a553_9e1b_0bc9_415bcf874209["atransform()"]
  68f322b4_1349_271a_408d_e2eb04ed643e -->|calls| eb798efb_a553_9e1b_0bc9_415bcf874209
  style 68f322b4_1349_271a_408d_e2eb04ed643e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/passthrough.py lines 284–324

    async def atransform(
        self,
        input: AsyncIterator[Other],
        config: RunnableConfig | None = None,
        **kwargs: Any,
    ) -> AsyncIterator[Other]:
        if self.afunc is None and self.func is None:
            async for chunk in self._atransform_stream_with_config(
                input, identity, config
            ):
                yield chunk
        else:
            got_first_chunk = False

            async for chunk in self._atransform_stream_with_config(
                input, identity, config
            ):
                yield chunk

                # By definitions, a function will operate on the aggregated
                # input. So we'll aggregate the input until we get to the last
                # chunk.
                # If the input is not addable, then we'll assume that we can
                # only operate on the last chunk.
                if not got_first_chunk:
                    final = chunk
                    got_first_chunk = True
                else:
                    try:
                        final = final + chunk  # type: ignore[operator]
                    except TypeError:
                        final = chunk

            if got_first_chunk:
                config = ensure_config(config)
                if self.afunc is not None:
                    await acall_func_with_variable_args(
                        self.afunc, final, config, **kwargs
                    )
                elif self.func is not None:
                    call_func_with_variable_args(self.func, final, config, **kwargs)

Domain

Subdomains

Calls

Frequently Asked Questions

What does atransform() do?
atransform() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/passthrough.py.
Where is atransform() defined?
atransform() is defined in libs/core/langchain_core/runnables/passthrough.py at line 284.
What does atransform() call?
atransform() calls 1 function(s): atransform.
What calls atransform()?
atransform() is called by 5 function(s): _atransform, astream, astream, astream, atransform.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free