Skip to content

Event handlers

BaseEventHandler #

Bases: BaseModel

Base callback handler that can be used to track event starts and ends.

Source code in llama-index-core/llama_index/core/instrumentation/event_handlers/base.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
class BaseEventHandler(BaseModel):
    """Base callback handler that can be used to track event starts and ends."""

    model_config = ConfigDict(arbitrary_types_allowed=True)

    @classmethod
    def class_name(cls) -> str:
        """Class name."""
        return "BaseEventHandler"

    @abstractmethod
    def handle(self, event: BaseEvent, **kwargs: Any) -> Any:
        """Logic for handling event."""

class_name classmethod #

class_name() -> str

Class name.

Source code in llama-index-core/llama_index/core/instrumentation/event_handlers/base.py
12
13
14
15
@classmethod
def class_name(cls) -> str:
    """Class name."""
    return "BaseEventHandler"

handle abstractmethod #

handle(event: BaseEvent, **kwargs: Any) -> Any

Logic for handling event.

Source code in llama-index-core/llama_index/core/instrumentation/event_handlers/base.py
17
18
19
@abstractmethod
def handle(self, event: BaseEvent, **kwargs: Any) -> Any:
    """Logic for handling event."""