Skip to content

Commit

Permalink
fix problems w meta and dataframe
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 committed Nov 6, 2023
1 parent 6c44b9d commit 0d4a403
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _deserialize_document(self, hit: Dict[str, Any]) -> Document:
dataframe=data["dataframe"],
blob=data["blob"],
mime_type=data["mime_type"],
meta=data["meta"],
meta=data.get("meta", {}),
score=data["score"],
embedding=data["embedding"],
)
Expand All @@ -237,9 +237,6 @@ def _serialize_document(self, doc: Document) -> Dict[str, Any]:
# Otherwise we'd have to filter out the fields that are not part of the
# Document dataclass and keep them as metadata. This is faster and easier.
res = {**doc.to_dict(), **doc.meta}
if res["dataframe"] is not None:
# Convert dataframe to a json string
res["dataframe"] = res["dataframe"].to_json()
# if res["embedding"] is not None:
# res["embedding"] = res["embedding"].tolist()
return res
Expand Down

0 comments on commit 0d4a403

Please sign in to comment.