mirror of
https://github.com/deepset-ai/haystack.git
synced 2026-01-24 12:43:22 +08:00
chore: Deprecate deserialize_document_store_in_init_params_inplace (#10442)
* add release note * Apply suggestion from @anakin87 Co-authored-by: Stefano Fiorucci <stefanofiorucci@gmail.com> * mention 2.24 in release note * mention version 2.24 in deprecation warning --------- Co-authored-by: Stefano Fiorucci <stefanofiorucci@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import warnings
|
||||
from typing import Any
|
||||
|
||||
from haystack.core.errors import DeserializationError
|
||||
@@ -12,6 +13,10 @@ def deserialize_document_store_in_init_params_inplace(data: dict[str, Any], key:
|
||||
"""
|
||||
Deserializes a generic document store from the init_parameters of a serialized component in place.
|
||||
|
||||
.. deprecated:: 2.23.0
|
||||
This function is deprecated and will be removed in Haystack version 2.24.
|
||||
It is no longer used internally and should not be used in new code.
|
||||
|
||||
:param data:
|
||||
The dictionary to deserialize from.
|
||||
:param key:
|
||||
@@ -22,6 +27,13 @@ def deserialize_document_store_in_init_params_inplace(data: dict[str, Any], key:
|
||||
:raises DeserializationError:
|
||||
If the document store is not properly specified in the serialization data or its type cannot be imported.
|
||||
"""
|
||||
warnings.warn(
|
||||
"`deserialize_document_store_in_init_params_inplace` is deprecated. "
|
||||
"It will be removed in Haystack version 2.24. "
|
||||
"It is no longer used internally and should not be used in new code.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
init_params = data.get("init_parameters", {})
|
||||
if key not in init_params:
|
||||
raise DeserializationError(f"Missing '{key}' in serialization data")
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
``deserialize_document_store_in_init_params_inplace`` is deprecated and will be removed in Haystack version 2.24.
|
||||
It is no longer used internally and should not be used in new code. The deserialization of DocumentStores is handled automatically now by default_from_dict.
|
||||
Reference in New Issue
Block a user