OutputType() — langchain Function Reference
Architecture documentation for the OutputType() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 9dbb01d7_59af_5975_c185_c4947c0f4e22["OutputType()"] 4a62481c_02cb_a5de_1833_50669d5351a6["Runnable"] 9dbb01d7_59af_5975_c185_c4947c0f4e22 -->|defined in| 4a62481c_02cb_a5de_1833_50669d5351a6 469f1d08_001e_fe69_baa4_2d0cd44d0902["OutputType()"] 469f1d08_001e_fe69_baa4_2d0cd44d0902 -->|calls| 9dbb01d7_59af_5975_c185_c4947c0f4e22 0218d516_e05e_7abb_bf3e_d2bc7c61365e["OutputType()"] 0218d516_e05e_7abb_bf3e_d2bc7c61365e -->|calls| 9dbb01d7_59af_5975_c185_c4947c0f4e22 255c479b_b9fa_44d8_4de5_2562051e06b5["get_name()"] 9dbb01d7_59af_5975_c185_c4947c0f4e22 -->|calls| 255c479b_b9fa_44d8_4de5_2562051e06b5 0218d516_e05e_7abb_bf3e_d2bc7c61365e["OutputType()"] 9dbb01d7_59af_5975_c185_c4947c0f4e22 -->|calls| 0218d516_e05e_7abb_bf3e_d2bc7c61365e style 9dbb01d7_59af_5975_c185_c4947c0f4e22 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/runnables/base.py lines 335–363
def OutputType(self) -> type[Output]: # noqa: N802
"""Output Type.
The type of output this `Runnable` produces specified as a type annotation.
Raises:
TypeError: If the output type cannot be inferred.
"""
# First loop through bases -- this will help generic
# any pydantic models.
for base in self.__class__.mro():
if hasattr(base, "__pydantic_generic_metadata__"):
metadata = base.__pydantic_generic_metadata__
if (
"args" in metadata
and len(metadata["args"]) == _RUNNABLE_GENERIC_NUM_ARGS
):
return cast("type[Output]", metadata["args"][1])
for cls in self.__class__.__orig_bases__: # type: ignore[attr-defined]
type_args = get_args(cls)
if type_args and len(type_args) == _RUNNABLE_GENERIC_NUM_ARGS:
return cast("type[Output]", type_args[1])
msg = (
f"Runnable {self.get_name()} doesn't have an inferable OutputType. "
"Override the OutputType property to specify the output type."
)
raise TypeError(msg)
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does OutputType() do?
OutputType() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/base.py.
Where is OutputType() defined?
OutputType() is defined in libs/core/langchain_core/runnables/base.py at line 335.
What does OutputType() call?
OutputType() calls 2 function(s): OutputType, get_name.
What calls OutputType()?
OutputType() is called by 2 function(s): OutputType, OutputType.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free