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 05ff15a0_d0e7_0677_7cd8_d872844c3ecf["on_custom_event()"] f2c19eb2_a092_16e7_b693_b7ae35a0bc8c["CallbackManager"] 05ff15a0_d0e7_0677_7cd8_d872844c3ecf -->|defined in| f2c19eb2_a092_16e7_b693_b7ae35a0bc8c 1425c66d_ea29_8195_679d_7f9b37f666b9["on_custom_event()"] 1425c66d_ea29_8195_679d_7f9b37f666b9 -->|calls| 05ff15a0_d0e7_0677_7cd8_d872844c3ecf 9f52a023_85aa_fa39_8b66_72ced51fd606["adispatch_custom_event()"] 9f52a023_85aa_fa39_8b66_72ced51fd606 -->|calls| 05ff15a0_d0e7_0677_7cd8_d872844c3ecf 6dee0e47_1e3d_3513_da55_1e22d2ec7ce1["dispatch_custom_event()"] 6dee0e47_1e3d_3513_da55_1e22d2ec7ce1 -->|calls| 05ff15a0_d0e7_0677_7cd8_d872844c3ecf 1425c66d_ea29_8195_679d_7f9b37f666b9["on_custom_event()"] 05ff15a0_d0e7_0677_7cd8_d872844c3ecf -->|calls| 1425c66d_ea29_8195_679d_7f9b37f666b9 8964b4e9_440e_18a7_2a15_a54a0b2b733c["handle_event()"] 05ff15a0_d0e7_0677_7cd8_d872844c3ecf -->|calls| 8964b4e9_440e_18a7_2a15_a54a0b2b733c style 05ff15a0_d0e7_0677_7cd8_d872844c3ecf fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/callbacks/manager.py lines 1565–1607
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 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)
if run_id is None:
run_id = uuid7()
handle_event(
self.handlers,
"on_custom_event",
"ignore_custom_event",
name,
data,
run_id=run_id,
tags=self.tags,
metadata=self.metadata,
)
Domain
Subdomains
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 1565.
What does on_custom_event() call?
on_custom_event() calls 2 function(s): handle_event, on_custom_event.
What calls on_custom_event()?
on_custom_event() is called by 3 function(s): adispatch_custom_event, dispatch_custom_event, on_custom_event.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free