/ haystack / dataclasses / __init__.py
__init__.py
 1  # SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
 2  #
 3  # SPDX-License-Identifier: Apache-2.0
 4  
 5  import sys
 6  from typing import TYPE_CHECKING
 7  
 8  from lazy_imports import LazyImporter
 9  
10  _import_structure = {
11      "answer": ["Answer", "ExtractedAnswer", "GeneratedAnswer"],
12      "breakpoints": [
13          "AgentBreakpoint",
14          "AgentSnapshot",
15          "Breakpoint",
16          "PipelineSnapshot",
17          "PipelineState",
18          "ToolBreakpoint",
19      ],
20      "byte_stream": ["ByteStream"],
21      "chat_message": ["ChatMessage", "ChatRole", "ReasoningContent", "TextContent", "ToolCall", "ToolCallResult"],
22      "image_content": ["ImageContent"],
23      "file_content": ["FileContent"],
24      "document": ["Document"],
25      "sparse_embedding": ["SparseEmbedding"],
26      "state": ["State"],
27      "streaming_chunk": [
28          "AsyncStreamingCallbackT",
29          "ComponentInfo",
30          "FinishReason",
31          "StreamingCallbackT",
32          "StreamingChunk",
33          "SyncStreamingCallbackT",
34          "ToolCallDelta",
35          "select_streaming_callback",
36      ],
37  }
38  
39  if TYPE_CHECKING:
40      from .answer import Answer as Answer
41      from .answer import ExtractedAnswer as ExtractedAnswer
42      from .answer import GeneratedAnswer as GeneratedAnswer
43      from .breakpoints import AgentBreakpoint as AgentBreakpoint
44      from .breakpoints import AgentSnapshot as AgentSnapshot
45      from .breakpoints import Breakpoint as Breakpoint
46      from .breakpoints import PipelineSnapshot as PipelineSnapshot
47      from .breakpoints import PipelineState as PipelineState
48      from .breakpoints import ToolBreakpoint as ToolBreakpoint
49      from .byte_stream import ByteStream as ByteStream
50      from .chat_message import ChatMessage as ChatMessage
51      from .chat_message import ChatRole as ChatRole
52      from .chat_message import ReasoningContent as ReasoningContent
53      from .chat_message import TextContent as TextContent
54      from .chat_message import ToolCall as ToolCall
55      from .chat_message import ToolCallResult as ToolCallResult
56      from .document import Document as Document
57      from .file_content import FileContent as FileContent
58      from .image_content import ImageContent as ImageContent
59      from .sparse_embedding import SparseEmbedding as SparseEmbedding
60      from .streaming_chunk import AsyncStreamingCallbackT as AsyncStreamingCallbackT
61      from .streaming_chunk import ComponentInfo as ComponentInfo
62      from .streaming_chunk import FinishReason as FinishReason
63      from .streaming_chunk import StreamingCallbackT as StreamingCallbackT
64      from .streaming_chunk import StreamingChunk as StreamingChunk
65      from .streaming_chunk import SyncStreamingCallbackT as SyncStreamingCallbackT
66      from .streaming_chunk import ToolCallDelta as ToolCallDelta
67      from .streaming_chunk import select_streaming_callback as select_streaming_callback
68  else:
69      sys.modules[__name__] = LazyImporter(name=__name__, module_file=__file__, import_structure=_import_structure)