Skip to content

Event handlers

BaseEventHandler #

Bases: BaseModel

用于跟踪事件开始和结束的基本回调处理程序。

Source code in llama_index/core/instrumentation/event_handlers/base.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
class BaseEventHandler(BaseModel):
    """用于跟踪事件开始和结束的基本回调处理程序。"""

    @classmethod
    def class_name(cls) -> str:
        """类名。"""
        return "BaseEventHandler"

    @abstractmethod
    def handle(self, event: BaseEvent, **kwargs) -> Any:
        """处理事件的逻辑。"""

    class Config:
        arbitrary_types_allowed = True

class_name classmethod #

class_name() -> str

类名。

Source code in llama_index/core/instrumentation/event_handlers/base.py
10
11
12
13
@classmethod
def class_name(cls) -> str:
    """类名。"""
    return "BaseEventHandler"

handle abstractmethod #

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

处理事件的逻辑。

Source code in llama_index/core/instrumentation/event_handlers/base.py
15
16
17
@abstractmethod
def handle(self, event: BaseEvent, **kwargs) -> Any:
    """处理事件的逻辑。"""