on_custom_event() — langchain Function Reference
Architecture documentation for the on_custom_event() function in manager.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 1425c66d_ea29_8195_679d_7f9b37f666b9["on_custom_event()"] 90ea8982_7d84_5e8f_4b5a_533f89fc7211["AsyncCallbackManager"] 1425c66d_ea29_8195_679d_7f9b37f666b9 -->|defined in| 90ea8982_7d84_5e8f_4b5a_533f89fc7211 05ff15a0_d0e7_0677_7cd8_d872844c3ecf["on_custom_event()"] 05ff15a0_d0e7_0677_7cd8_d872844c3ecf -->|calls| 1425c66d_ea29_8195_679d_7f9b37f666b9 05ff15a0_d0e7_0677_7cd8_d872844c3ecf["on_custom_event()"] 1425c66d_ea29_8195_679d_7f9b37f666b9 -->|calls| 05ff15a0_d0e7_0677_7cd8_d872844c3ecf 3a243d21_72d1_dca9_f7be_acbb482b9f86["ahandle_event()"] 1425c66d_ea29_8195_679d_7f9b37f666b9 -->|calls| 3a243d21_72d1_dca9_f7be_acbb482b9f86 style 1425c66d_ea29_8195_679d_7f9b37f666b9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/callbacks/manager.py lines 2037–2079
async def on_custom_event(
self,
name: str,
data: Any,
run_id: UUID | None = None,
**kwargs: Any,
) -> None:
"""Dispatch an adhoc event to the handlers (async version).
This event should NOT be used in any internal LangChain code. The event is meant
specifically for users of the library to dispatch custom events that are
tailored to their application.
Args:
name: The name of the adhoc event.
data: The data for the adhoc event.
run_id: The ID of the run.
Raises:
ValueError: If additional keyword arguments are passed.
"""
if not self.handlers:
return
if run_id is None:
run_id = uuid7()
if kwargs:
msg = (
"The dispatcher API does not accept additional keyword arguments."
"Please do not pass any additional keyword arguments, instead "
"include them in the data field."
)
raise ValueError(msg)
await ahandle_event(
self.handlers,
"on_custom_event",
"ignore_custom_event",
name,
data,
run_id=run_id,
tags=self.tags,
metadata=self.metadata,
)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does on_custom_event() do?
on_custom_event() is a function in the langchain codebase, defined in libs/core/langchain_core/callbacks/manager.py.
Where is on_custom_event() defined?
on_custom_event() is defined in libs/core/langchain_core/callbacks/manager.py at line 2037.
What does on_custom_event() call?
on_custom_event() calls 2 function(s): ahandle_event, on_custom_event.
What calls on_custom_event()?
on_custom_event() is called by 1 function(s): on_custom_event.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free