Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: deprecate dataframe field in Document and ExtractedTableAnswer #8789

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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