Skip to content

Commit

Permalink
Merge pull request #309 from TogetherCrew/feat/302-telegram-raw-vecto…
Browse files Browse the repository at this point in the history
…rize

fix: Qdrant get_latest_point, added timestamp conversion support!
  • Loading branch information
amindadgar authored Oct 22, 2024
2 parents 6ab0726 + 439ca37 commit 4e8fea8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
10 changes: 9 additions & 1 deletion dags/hivemind_etl_helpers/ingestion_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,15 @@ def get_latest_document_date(
logging.info("No documents found in the collection.")
latest_date = None
else:
latest_date = parse(latest_document[0][0].payload[field_name])
date_field = latest_document[0][0].payload[field_name]

# if it was float timestamp
if field_schema == models.PayloadSchemaType.FLOAT:
latest_date = datetime.fromtimestamp(date_field)

# it should be datetime in any other case
else:
latest_date = parse(date_field)

else:
raise ValueError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ def test_extract_chats_multiple_chats(self):
)

chat_ids = self.tc_chats.extract_chats()
self.assertEqual(
chat_ids,
[
(100001, "test chat"),
(100002, "test chat 2"),
(100003, "test chat 3"),
],
)

self.assertEqual(len(chat_ids), 3)
expected_chats = [
(100001, "test chat"),
(100002, "test chat 2"),
(100003, "test chat 3"),
]
for id in chat_ids:
self.assertIn(id, expected_chats)

0 comments on commit 4e8fea8

Please sign in to comment.