forked from HSE_team/BetterCallPraskovia
29 lines
712 B
Python
29 lines
712 B
Python
"""
|
|
Доменная сущность чанка
|
|
"""
|
|
from datetime import datetime
|
|
from uuid import UUID, uuid4
|
|
from typing import Any
|
|
|
|
|
|
class DocumentChunk:
|
|
|
|
def __init__(
|
|
self,
|
|
document_id: UUID,
|
|
collection_id: UUID,
|
|
content: str,
|
|
chunk_id: UUID | None = None,
|
|
order: int = 0,
|
|
metadata: dict[str, Any] | None = None,
|
|
created_at: datetime | None = None,
|
|
):
|
|
self.chunk_id = chunk_id or uuid4()
|
|
self.document_id = document_id
|
|
self.collection_id = collection_id
|
|
self.content = content
|
|
self.order = order
|
|
self.metadata = metadata or {}
|
|
self.created_at = created_at or datetime.utcnow()
|
|
|