From 6f6f2357fdef9e98850a7ffcd80f18b05aa7cfaf Mon Sep 17 00:00:00 2001 From: Sara Zan Date: Tue, 26 Oct 2021 11:47:25 +0200 Subject: [PATCH] Fix import in Milvus2DocumentStore to import directly from the file and remove circular import with retriever (#1646) --- haystack/document_stores/milvus2x.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/haystack/document_stores/milvus2x.py b/haystack/document_stores/milvus2x.py index 205ea8052..773968448 100644 --- a/haystack/document_stores/milvus2x.py +++ b/haystack/document_stores/milvus2x.py @@ -1,5 +1,8 @@ import logging -from typing import Any, Dict, Generator, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, Generator, List, Optional, Union + +if TYPE_CHECKING: + from haystack.nodes.retriever.base import BaseRetriever import numpy import numpy as np @@ -8,8 +11,7 @@ from scipy.special import expit from tqdm import tqdm from haystack.schema import Document -from haystack.document_stores import SQLDocumentStore -from haystack.nodes.retriever.base import BaseRetriever +from haystack.document_stores.sql import SQLDocumentStore from haystack.document_stores.base import get_batches_from_generator @@ -341,7 +343,7 @@ class Milvus2DocumentStore(SQLDocumentStore): def update_embeddings( self, - retriever: BaseRetriever, + retriever: 'BaseRetriever', index: Optional[str] = None, batch_size: int = 10_000, update_existing_embeddings: bool = True,