Skip to content

Commit

Permalink
Fix mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanazeljkovic committed Oct 16, 2023
1 parent 85fbe82 commit 5fff01b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions haystack/document_stores/pinecone.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,8 @@ def _get_vector_count(

def _delete_vectors(self, index: str, ids: List[str], namespace: Optional[str]) -> None:
batch_size = self.top_k_limit_vectors
[
for id_batch in get_batches_from_generator(ids, batch_size):
self.pinecone_indexes[index].delete(ids=list(id_batch), namespace=namespace)
for id_batch in get_batches_from_generator(ids, batch_size)
]

def get_document_count(
self,
Expand Down Expand Up @@ -444,10 +442,10 @@ def get_document_count(
# otherwise add default `doc_type` value which is related to documents without embeddings,
# but only if `doc_type` doesn't already exist in filters
elif TYPE_METADATA_FIELD not in str(filters):
types_metadata = {DOCUMENT_WITHOUT_EMBEDDING}
types_metadata = {DOCUMENT_WITHOUT_EMBEDDING} # type: ignore
if not only_documents_without_embedding:
# add `doc_type` related to documents with embeddings
types_metadata.add(DOCUMENT_WITH_EMBEDDING)
types_metadata.add(DOCUMENT_WITH_EMBEDDING) # type: ignore
else:
types_metadata = set()

Expand Down Expand Up @@ -489,7 +487,7 @@ def get_embedding_count(
"""
# drop filter for `doc_type` if exists
if TYPE_METADATA_FIELD in str(filters):
filters = self._remove_type_metadata_filter(filters)
filters = self._remove_type_metadata_filter(filters) # type: ignore
return self._get_vector_count(
index, filters=filters, namespace=namespace, types_metadata={DOCUMENT_WITH_EMBEDDING} # type: ignore
)
Expand Down Expand Up @@ -1807,7 +1805,7 @@ def get_all_labels(
self._index_connection_exists(index)

documents = self.get_all_documents(
index=index, filters=filters, headers=headers, namespace=namespace, type_metadata=LABEL
index=index, filters=filters, headers=headers, namespace=namespace, type_metadata=LABEL # type: ignore
)
for doc in documents:
doc.meta = self._pinecone_meta_format(doc.meta, labels=True)
Expand Down

0 comments on commit 5fff01b

Please sign in to comment.