Skip to content

Commit

Permalink
Merge branch 'pinecone-filters' of https://github.com/deepset-ai/hays…
Browse files Browse the repository at this point in the history
…tack-core-integrations into pinecone-filters
  • Loading branch information
anakin87 committed Dec 22, 2023
2 parents a8bb599 + f8da8a9 commit 39bde7e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions integrations/pinecone/src/pinecone_haystack/document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io
import logging
import os
from copy import copy
from typing import Any, Dict, List, Optional

import pandas as pd
Expand Down Expand Up @@ -249,14 +250,14 @@ def _convert_query_result_to_documents(self, query_result: Dict[str, Any]) -> Li
def _convert_documents_to_pinecone_format(self, documents: List[Document]) -> List[Dict[str, Any]]:
documents_for_pinecone = []
for document in documents:
embedding = document.embedding
embedding = copy(document.embedding)
if embedding is None:
logger.warning(
f"Document {document.id} has no embedding. Pinecone is a purely vector database. "
"A dummy embedding will be used, but this can affect the search results. "
)
embedding = self._dummy_vector
doc_for_pinecone = {"id": document.id, "values": embedding, "metadata": document.meta}
doc_for_pinecone = {"id": document.id, "values": embedding, "metadata": dict(document.meta)}

# we save content/dataframe as metadata
# currently, storing blob in Pinecone is not supported
Expand All @@ -272,4 +273,4 @@ def _convert_documents_to_pinecone_format(self, documents: List[Document]) -> Li
)

documents_for_pinecone.append(doc_for_pinecone)
return documents_for_pinecone
return documents_for_pinecone

0 comments on commit 39bde7e

Please sign in to comment.