Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Qdrant get_latest_point, added timestamp conversion support! #309

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading