Home / Function/ _transform() — langchain Function Reference

_transform() — langchain Function Reference

Architecture documentation for the _transform() function in base.py from the langchain codebase.

Function python LangChainCore Runnables calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  87d3d0f0_cf29_e59f_63c9_a28e3dff7138["_transform()"]
  c4bf8d59_69f9_f8e5_efba_837c20df2360["RunnableSequence"]
  87d3d0f0_cf29_e59f_63c9_a28e3dff7138 -->|defined in| c4bf8d59_69f9_f8e5_efba_837c20df2360
  f54efa31_1266_16ec_54f7_0adda8cb6619["_transform()"]
  f54efa31_1266_16ec_54f7_0adda8cb6619 -->|calls| 87d3d0f0_cf29_e59f_63c9_a28e3dff7138
  b67c5f0f_1c9e_c943_1c09_d8d8f8f5b97f["_transform()"]
  b67c5f0f_1c9e_c943_1c09_d8d8f8f5b97f -->|calls| 87d3d0f0_cf29_e59f_63c9_a28e3dff7138
  f54efa31_1266_16ec_54f7_0adda8cb6619["_transform()"]
  87d3d0f0_cf29_e59f_63c9_a28e3dff7138 -->|calls| f54efa31_1266_16ec_54f7_0adda8cb6619
  style 87d3d0f0_cf29_e59f_63c9_a28e3dff7138 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 3465–3486

    def _transform(
        self,
        inputs: Iterator[Input],
        run_manager: CallbackManagerForChainRun,
        config: RunnableConfig,
        **kwargs: Any,
    ) -> Iterator[Output]:
        steps = [self.first, *self.middle, self.last]
        # transform the input stream of each step with the next
        # steps that don't natively support transforming an input stream will
        # buffer input in memory until all available, and then start emitting output
        final_pipeline = cast("Iterator[Output]", inputs)
        for idx, step in enumerate(steps):
            config = patch_config(
                config, callbacks=run_manager.get_child(f"seq:step:{idx + 1}")
            )
            if idx == 0:
                final_pipeline = step.transform(final_pipeline, config, **kwargs)
            else:
                final_pipeline = step.transform(final_pipeline, config)

        yield from final_pipeline

Domain

Subdomains

Calls

Frequently Asked Questions

What does _transform() do?
_transform() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/base.py.
Where is _transform() defined?
_transform() is defined in libs/core/langchain_core/runnables/base.py at line 3465.
What does _transform() call?
_transform() calls 1 function(s): _transform.
What calls _transform()?
_transform() is called by 2 function(s): _transform, _transform.

Analyze Your Own Codebase

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

Try Supermodel Free