Fix import in Milvus2DocumentStore to import directly from the file and remove circular import with retriever (#1646)

This commit is contained in:
Sara Zan 2021-10-26 11:47:25 +02:00 committed by GitHub
parent 13510aa753
commit 6f6f2357fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,8 @@
import logging 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
import numpy as np import numpy as np
@ -8,8 +11,7 @@ from scipy.special import expit
from tqdm import tqdm from tqdm import tqdm
from haystack.schema import Document from haystack.schema import Document
from haystack.document_stores import SQLDocumentStore from haystack.document_stores.sql import SQLDocumentStore
from haystack.nodes.retriever.base import BaseRetriever
from haystack.document_stores.base import get_batches_from_generator from haystack.document_stores.base import get_batches_from_generator
@ -341,7 +343,7 @@ class Milvus2DocumentStore(SQLDocumentStore):
def update_embeddings( def update_embeddings(
self, self,
retriever: BaseRetriever, retriever: 'BaseRetriever',
index: Optional[str] = None, index: Optional[str] = None,
batch_size: int = 10_000, batch_size: int = 10_000,
update_existing_embeddings: bool = True, update_existing_embeddings: bool = True,