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

feat: telegram vectorize, added field schema option for getting the latest document! #308

Merged
merged 1 commit into from
Oct 22, 2024
Merged
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
12 changes: 10 additions & 2 deletions dags/hivemind_etl_helpers/ingestion_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ def _create_payload_index(

return operation_result

def get_latest_document_date(self, field_name: str) -> datetime | None:
def get_latest_document_date(
self,
field_name: str,
field_schema: qdrant_types.PayloadSchemaType = models.PayloadSchemaType.FLOAT,
) -> datetime | None:
amindadgar marked this conversation as resolved.
Show resolved Hide resolved
"""
get the latest date for the most recent available document

Expand All @@ -129,6 +133,10 @@ def get_latest_document_date(self, field_name: str) -> datetime | None:
------------
field_name : str
the datetime field name in qdrant points' payload
field_schema : qdrant_client.conversions.common_types.PayloadSchemaType
the date field schema
for default we're assuming it is a float timestamp
but it also could be DATETIME

Returns
---------
Expand All @@ -140,7 +148,7 @@ def get_latest_document_date(self, field_name: str) -> datetime | None:
try:
result = self._create_payload_index(
field_name=field_name,
field_schema=models.PayloadSchemaType.DATETIME,
field_schema=field_schema,
)
if result.status.name == "COMPLETED":
latest_document = self.qdrant_client.scroll(
Expand Down
Loading