From 08c52dd98dbae284b3fbe18855f766984ff158e0 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Wed, 6 Nov 2024 14:51:00 +0330 Subject: [PATCH] feat: saving datetime instead of date for Qdrant db! Qdrant db, doesn't support python date --- .../src/db/telegram/transform/summary.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dags/hivemind_etl_helpers/src/db/telegram/transform/summary.py b/dags/hivemind_etl_helpers/src/db/telegram/transform/summary.py index 9bd387e2..bf934b9d 100644 --- a/dags/hivemind_etl_helpers/src/db/telegram/transform/summary.py +++ b/dags/hivemind_etl_helpers/src/db/telegram/transform/summary.py @@ -1,4 +1,4 @@ -from datetime import date, timedelta +from datetime import date, datetime, timedelta, timezone from llama_index.core import Document @@ -32,7 +32,9 @@ def transform(self, summaries: dict[date, str]) -> list[Document]: + (day + timedelta(days=1)).strftime("%Y-%m-%d"), text=summary, metadata={ - "date": day, + "date": datetime.combine( + day, datetime.min.time(), tzinfo=timezone.utc + ), }, ) summary_docs.append(document)