Skip to content

Commit

Permalink
deprecate dataframe and ExtractedTableAnswer (#8789)
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 authored Jan 31, 2025
1 parent 3ef609a commit 80575a7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions haystack/dataclasses/answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0

import io
import warnings
from dataclasses import asdict, dataclass, field
from typing import Any, Dict, List, Optional, Protocol, runtime_checkable

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

def __post_init__(self):
msg = "The `ExtractedTableAnswer` dataclass is deprecated and will be removed in Haystack 2.11.0."
warnings.warn(msg, DeprecationWarning)

@dataclass
class Cell:
row: int
Expand Down
5 changes: 5 additions & 0 deletions haystack/dataclasses/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import hashlib
import io
import warnings
from dataclasses import asdict, dataclass, field, fields
from typing import Any, Dict, List, Optional

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

if self.dataframe is not None:
msg = "The `dataframe` field is deprecated and will be removed in Haystack 2.11.0."
warnings.warn(msg, DeprecationWarning)

def _create_id(self):
"""
Creates a hash of the given content that acts as the document's ID.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
deprecations:
- |
The `ExtractedTableAnswer` dataclass and the `dataframe` field in the `Document` dataclass are deprecated and
will be removed in Haystack 2.11.0.
Check out the GitHub discussion for motivation and details: https://github.com/deepset-ai/haystack/discussions/8688

0 comments on commit 80575a7

Please sign in to comment.