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 legacy filter #8001

Closed
wants to merge 2 commits into from
Closed
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
7 changes: 7 additions & 0 deletions haystack/utils/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: Apache-2.0

import warnings
from dataclasses import fields
from datetime import datetime
from typing import Any, Dict, List, Union
Expand Down Expand Up @@ -214,6 +215,12 @@ def convert(filters: Dict[str, Any]) -> Dict[str, Any]:
}
```
"""
warnings.warn(
Copy link
Contributor

@davidsbatista davidsbatista Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could link to the doc/api with the new syntax

"You are using deprecated filter syntax. Please use the new filter syntax as described "
"in the documentation. We will attempt to convert your old filter syntax to the new one. The old syntax "
"support will be removed in Haystack 2.5",
DeprecationWarning,
)
if not isinstance(filters, dict):
msg = f"Can't convert filters from type '{type(filters)}'"
raise ValueError(msg)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
deprecations:
- |
Added deprecation warning for using old filter syntax. Users are advised to switch to the new filter syntax as the old syntax will be removed 2.5 Haystack release.