From d63dd47cad166b0e289b9569c528b2750cfce64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ml=C4=8Doch?= <32368160+mlcocdav@users.noreply.github.com> Date: Mon, 1 Apr 2024 10:59:20 -0700 Subject: [PATCH] Deserialize secrets inplace for api_keys in PineconeEmbeddingRetriever Loading serialised pipeline which includes PineconeEmbeddingRetriever with PineconeDocumentStore currently fails because loading of api keys is not correctly deserialised into Secret class. I propose changes to fix this. --- .../components/retrievers/pinecone/embedding_retriever.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/integrations/pinecone/src/haystack_integrations/components/retrievers/pinecone/embedding_retriever.py b/integrations/pinecone/src/haystack_integrations/components/retrievers/pinecone/embedding_retriever.py index 02c4a3a87..fa4ec831c 100644 --- a/integrations/pinecone/src/haystack_integrations/components/retrievers/pinecone/embedding_retriever.py +++ b/integrations/pinecone/src/haystack_integrations/components/retrievers/pinecone/embedding_retriever.py @@ -7,7 +7,7 @@ from haystack.dataclasses import Document from haystack_integrations.document_stores.pinecone import PineconeDocumentStore - +from haystack.utils import deserialize_secrets_inplace @component class PineconeEmbeddingRetriever: @@ -93,6 +93,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "PineconeEmbeddingRetriever": :returns: Deserialized component. """ + deserialize_secrets_inplace(data["init_parameters"]['document_store']['init_parameters'], keys=["api_key"]) data["init_parameters"]["document_store"] = default_from_dict( PineconeDocumentStore, data["init_parameters"]["document_store"] )