Skip to content

Commit

Permalink
copy metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 committed Dec 22, 2023
1 parent c4f5079 commit 54646e8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions integrations/pinecone/src/pinecone_haystack/document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
import os
from typing import Any, Dict, List, Optional
from copy import copy

import pandas as pd
import pinecone
Expand Down Expand Up @@ -241,14 +242,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 Down

0 comments on commit 54646e8

Please sign in to comment.