_call_with_config() — langchain Function Reference
Architecture documentation for the _call_with_config() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 424a7613_4cfe_67c7_0e4e_df9c17b111eb["_call_with_config()"] 4a62481c_02cb_a5de_1833_50669d5351a6["Runnable"] 424a7613_4cfe_67c7_0e4e_df9c17b111eb -->|defined in| 4a62481c_02cb_a5de_1833_50669d5351a6 85609be6_cbc7_0689_ac1a_dce4dde514b5["invoke()"] 85609be6_cbc7_0689_ac1a_dce4dde514b5 -->|calls| 424a7613_4cfe_67c7_0e4e_df9c17b111eb 6c985726_494e_e996_1fc3_70630ec9ef85["invoke()"] 6c985726_494e_e996_1fc3_70630ec9ef85 -->|calls| 424a7613_4cfe_67c7_0e4e_df9c17b111eb 255c479b_b9fa_44d8_4de5_2562051e06b5["get_name()"] 424a7613_4cfe_67c7_0e4e_df9c17b111eb -->|calls| 255c479b_b9fa_44d8_4de5_2562051e06b5 style 424a7613_4cfe_67c7_0e4e_df9c17b111eb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/runnables/base.py lines 2027–2074
def _call_with_config(
self,
func: Callable[[Input], Output]
| Callable[[Input, CallbackManagerForChainRun], Output]
| Callable[[Input, CallbackManagerForChainRun, RunnableConfig], Output],
input_: Input,
config: RunnableConfig | None,
run_type: str | None = None,
serialized: dict[str, Any] | None = None,
**kwargs: Any | None,
) -> Output:
"""Call with config.
Helper method to transform an `Input` value to an `Output` value,
with callbacks.
Use this method to implement `invoke` in subclasses.
"""
config = ensure_config(config)
callback_manager = get_callback_manager_for_config(config)
run_manager = callback_manager.on_chain_start(
serialized,
input_,
run_type=run_type,
name=config.get("run_name") or self.get_name(),
run_id=config.pop("run_id", None),
)
try:
child_config = patch_config(config, callbacks=run_manager.get_child())
with set_config_context(child_config) as context:
output = cast(
"Output",
context.run(
call_func_with_variable_args, # type: ignore[arg-type]
func,
input_,
config,
run_manager,
**kwargs,
),
)
except BaseException as e:
run_manager.on_chain_error(e)
raise
else:
run_manager.on_chain_end(output)
return output
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does _call_with_config() do?
_call_with_config() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/base.py.
Where is _call_with_config() defined?
_call_with_config() is defined in libs/core/langchain_core/runnables/base.py at line 2027.
What does _call_with_config() call?
_call_with_config() calls 1 function(s): get_name.
What calls _call_with_config()?
_call_with_config() is called by 2 function(s): invoke, invoke.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free