Skip to content

Commit 80575a7

Browse files
authored
deprecate dataframe and ExtractedTableAnswer (#8789)
1 parent 3ef609a commit 80575a7

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Diff for: haystack/dataclasses/answer.py

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
import io
6+
import warnings
67
from dataclasses import asdict, dataclass, field
78
from typing import Any, Dict, List, Optional, Protocol, runtime_checkable
89

@@ -98,6 +99,10 @@ class ExtractedTableAnswer:
9899
context_cells: List["Cell"] = field(default_factory=list)
99100
meta: Dict[str, Any] = field(default_factory=dict)
100101

102+
def __post_init__(self):
103+
msg = "The `ExtractedTableAnswer` dataclass is deprecated and will be removed in Haystack 2.11.0."
104+
warnings.warn(msg, DeprecationWarning)
105+
101106
@dataclass
102107
class Cell:
103108
row: int

Diff for: haystack/dataclasses/document.py

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import hashlib
66
import io
7+
import warnings
78
from dataclasses import asdict, dataclass, field, fields
89
from typing import Any, Dict, List, Optional
910

@@ -114,6 +115,10 @@ def __post_init__(self):
114115
# Generate an id only if not explicitly set
115116
self.id = self.id or self._create_id()
116117

118+
if self.dataframe is not None:
119+
msg = "The `dataframe` field is deprecated and will be removed in Haystack 2.11.0."
120+
warnings.warn(msg, DeprecationWarning)
121+
117122
def _create_id(self):
118123
"""
119124
Creates a hash of the given content that acts as the document's ID.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
deprecations:
3+
- |
4+
The `ExtractedTableAnswer` dataclass and the `dataframe` field in the `Document` dataclass are deprecated and
5+
will be removed in Haystack 2.11.0.
6+
Check out the GitHub discussion for motivation and details: https://github.com/deepset-ai/haystack/discussions/8688

0 commit comments

Comments
 (0)