• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

deepset-ai / haystack / 13453333627

21 Feb 2025 08:55AM UTC coverage: 90.155% (-1.0%) from 91.142%
13453333627

push

github

web-flow
perf: Optimize import times (#8878)

* initial experiments

* progress

* draft

* fix header

* fix linting

* lot more lazy inits

* fixes to main init

* linting

* small refinements

* header fix

* release note

* improve consistency

* test: make sure no extra modules are being imported due to `__init__` definitions

* extend release note with an example

* refactoring import test

* updating release notes

* casting .keys() to list

* reverting to list

* Update haystack/__init__.py

Co-authored-by: Julian Risch <julian.risch@deepset.ai>

* fixing ident problem

* better comments

---------

Co-authored-by: David S. Batista <dsbatista@gmail.com>
Co-authored-by: Julian Risch <julian.risch@deepset.ai>

9496 of 10533 relevant lines covered (90.15%)

0.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

40.0
haystack/components/evaluators/__init__.py
1
# SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
2
#
3
# SPDX-License-Identifier: Apache-2.0
4

5
import sys
1✔
6
from typing import TYPE_CHECKING
1✔
7

8
from lazy_imports import LazyImporter
1✔
9

10
_import_structure = {
1✔
11
    "answer_exact_match": ["AnswerExactMatchEvaluator"],
12
    "context_relevance": ["ContextRelevanceEvaluator"],
13
    "document_map": ["DocumentMAPEvaluator"],
14
    "document_mrr": ["DocumentMRREvaluator"],
15
    "document_ndcg": ["DocumentNDCGEvaluator"],
16
    "document_recall": ["DocumentRecallEvaluator"],
17
    "faithfulness": ["FaithfulnessEvaluator"],
18
    "llm_evaluator": ["LLMEvaluator"],
19
    "sas_evaluator": ["SASEvaluator"],
20
}
21

22
if TYPE_CHECKING:
1✔
23
    from .answer_exact_match import AnswerExactMatchEvaluator
×
24
    from .context_relevance import ContextRelevanceEvaluator
×
25
    from .document_map import DocumentMAPEvaluator
×
26
    from .document_mrr import DocumentMRREvaluator
×
27
    from .document_ndcg import DocumentNDCGEvaluator
×
28
    from .document_recall import DocumentRecallEvaluator
×
29
    from .faithfulness import FaithfulnessEvaluator
×
30
    from .llm_evaluator import LLMEvaluator
×
31
    from .sas_evaluator import SASEvaluator
×
32

33
else:
34
    sys.modules[__name__] = LazyImporter(name=__name__, module_file=__file__, import_structure=_import_structure)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc