Coverage for haystack/hooks/__init__.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-21 13:53 +0000

1# SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai> 

2# 

3# SPDX-License-Identifier: Apache-2.0 

4 

5import sys 

6from typing import TYPE_CHECKING 

7 

8from lazy_imports import LazyImporter 

9 

10_import_structure = { 

11 "protocol": [ 

12 "Hook", 

13 "HookPoint", 

14 "BEFORE_RUN", 

15 "BEFORE_LLM", 

16 "BEFORE_TOOL", 

17 "AFTER_TOOL", 

18 "ON_EXIT", 

19 "AFTER_RUN", 

20 "VALID_HOOK_POINTS", 

21 ], 

22 "from_function": ["FunctionHook", "hook"], 

23} 

24 

25if TYPE_CHECKING: 

26 from .from_function import FunctionHook as FunctionHook 

27 from .from_function import hook as hook 

28 from .protocol import AFTER_RUN as AFTER_RUN 

29 from .protocol import AFTER_TOOL as AFTER_TOOL 

30 from .protocol import BEFORE_LLM as BEFORE_LLM 

31 from .protocol import BEFORE_RUN as BEFORE_RUN 

32 from .protocol import BEFORE_TOOL as BEFORE_TOOL 

33 from .protocol import ON_EXIT as ON_EXIT 

34 from .protocol import VALID_HOOK_POINTS as VALID_HOOK_POINTS 

35 from .protocol import Hook as Hook 

36 from .protocol import HookPoint as HookPoint 

37else: 

38 sys.modules[__name__] = LazyImporter(name=__name__, module_file=__file__, import_structure=_import_structure)