/ haystack / __init__.py
__init__.py
 1  # SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
 2  #
 3  # SPDX-License-Identifier: Apache-2.0
 4  
 5  # We avoid lazy imports here because:
 6  # - they create potential static type checking issues which are hard to debug
 7  # - they make this module more complicated and hard to maintain
 8  # - they offer minimal performance gains in this case.
 9  
10  import haystack.logging
11  import haystack.tracing
12  from haystack.core.component import component
13  from haystack.core.errors import ComponentError, DeserializationError
14  from haystack.core.pipeline import AsyncPipeline, Pipeline
15  from haystack.core.serialization import default_from_dict, default_to_dict
16  from haystack.core.super_component.super_component import SuperComponent, super_component
17  from haystack.dataclasses import Answer, Document, ExtractedAnswer, GeneratedAnswer
18  from haystack.version import __version__  # noqa: F401
19  
20  # Initialize the logging configuration
21  # This is a no-op unless `structlog` is installed
22  haystack.logging.configure_logging()
23  
24  # Same for tracing (no op if `opentelemetry` or `ddtrace` is not installed)
25  haystack.tracing.auto_enable_tracing()
26  
27  __all__ = [
28      "Answer",
29      "AsyncPipeline",
30      "ComponentError",
31      "DeserializationError",
32      "Document",
33      "ExtractedAnswer",
34      "GeneratedAnswer",
35      "Pipeline",
36      "SuperComponent",
37      "super_component",
38      "component",
39      "default_from_dict",
40      "default_to_dict",
41  ]