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 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  b058d203_2f29_f0e0_63cd_7458a119791a["transform()"]
  c6a370e4_a02a_c56a_38eb_7ca734dcbfea["RunnableLambda"]
  b058d203_2f29_f0e0_63cd_7458a119791a -->|defined in| c6a370e4_a02a_c56a_38eb_7ca734dcbfea
  98b849a3_219d_3646_6770_861e1bddb28f["stream()"]
  98b849a3_219d_3646_6770_861e1bddb28f -->|calls| b058d203_2f29_f0e0_63cd_7458a119791a
  3b190320_b896_da9c_12ee_4d17ddfcf59e["_transform_stream_with_config()"]
  b058d203_2f29_f0e0_63cd_7458a119791a -->|calls| 3b190320_b896_da9c_12ee_4d17ddfcf59e
  c0e0035e_3d41_1681_e722_9c0a4ca8826b["transform()"]
  b058d203_2f29_f0e0_63cd_7458a119791a -->|calls| c0e0035e_3d41_1681_e722_9c0a4ca8826b
  style b058d203_2f29_f0e0_63cd_7458a119791a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 5115–5133

    def transform(
        self,
        input: Iterator[Input],
        config: RunnableConfig | None = None,
        **kwargs: Any | None,
    ) -> Iterator[Output]:
        if hasattr(self, "func"):
            yield from self._transform_stream_with_config(
                input,
                self._transform,
                ensure_config(config),
                **kwargs,
            )
        else:
            msg = (
                "Cannot stream a coroutine function synchronously."
                "Use `astream` instead."
            )
            raise TypeError(msg)

Domain

Subdomains

Called By

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 5115.
What does transform() call?
transform() calls 2 function(s): _transform_stream_with_config, transform.
What calls transform()?
transform() is called by 1 function(s): stream.

Analyze Your Own Codebase

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

Try Supermodel Free