From 9730935002eb91abb3e5ab28730600d0d1072282 Mon Sep 17 00:00:00 2001 From: Vladimir Blagojevic Date: Tue, 9 Jul 2024 10:09:35 +0200 Subject: [PATCH 1/2] Add legacy filter deprecation warning --- haystack/utils/filters.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/haystack/utils/filters.py b/haystack/utils/filters.py index fe2f7530b2..41eca57277 100644 --- a/haystack/utils/filters.py +++ b/haystack/utils/filters.py @@ -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 @@ -214,6 +215,12 @@ def convert(filters: Dict[str, Any]) -> Dict[str, Any]: } ``` """ + warnings.warn( + "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) From 5d5b1d5b926df34793c8520001b58d2775f58be9 Mon Sep 17 00:00:00 2001 From: Vladimir Blagojevic Date: Tue, 9 Jul 2024 10:15:01 +0200 Subject: [PATCH 2/2] Add release note --- ...ecation-warning-legacy-filter-syntax-2fe61cab5e14ad8e.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 releasenotes/notes/deprecation-warning-legacy-filter-syntax-2fe61cab5e14ad8e.yaml diff --git a/releasenotes/notes/deprecation-warning-legacy-filter-syntax-2fe61cab5e14ad8e.yaml b/releasenotes/notes/deprecation-warning-legacy-filter-syntax-2fe61cab5e14ad8e.yaml new file mode 100644 index 0000000000..65e271e107 --- /dev/null +++ b/releasenotes/notes/deprecation-warning-legacy-filter-syntax-2fe61cab5e14ad8e.yaml @@ -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.