transform() — langchain Function Reference
Architecture documentation for the transform() function in passthrough.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 8d2a37b9_a0ae_643b_9bbd_130393223126["transform()"] 915f0e72_2130_6a8d_6929_3a7528446033["RunnablePassthrough"] 8d2a37b9_a0ae_643b_9bbd_130393223126 -->|defined in| 915f0e72_2130_6a8d_6929_3a7528446033 3e9c06ec_de75_0159_daf0_82c2499729cd["stream()"] 3e9c06ec_de75_0159_daf0_82c2499729cd -->|calls| 8d2a37b9_a0ae_643b_9bbd_130393223126 6b634a0f_8373_1838_7f85_ec4585108419["transform()"] 6b634a0f_8373_1838_7f85_ec4585108419 -->|calls| 8d2a37b9_a0ae_643b_9bbd_130393223126 6b634a0f_8373_1838_7f85_ec4585108419["transform()"] 8d2a37b9_a0ae_643b_9bbd_130393223126 -->|calls| 6b634a0f_8373_1838_7f85_ec4585108419 style 8d2a37b9_a0ae_643b_9bbd_130393223126 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/runnables/passthrough.py lines 253–281
def transform(
self,
input: Iterator[Other],
config: RunnableConfig | None = None,
**kwargs: Any,
) -> Iterator[Other]:
if self.func is None:
for chunk in self._transform_stream_with_config(input, identity, config):
yield chunk
else:
final: Other
got_first_chunk = False
for chunk in self._transform_stream_with_config(input, identity, config):
yield 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:
call_func_with_variable_args(
self.func, final, ensure_config(config), **kwargs
)
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does transform() do?
transform() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/passthrough.py.
Where is transform() defined?
transform() is defined in libs/core/langchain_core/runnables/passthrough.py at line 253.
What does transform() call?
transform() calls 1 function(s): transform.
What calls transform()?
transform() is called by 2 function(s): stream, transform.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free