-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
31 lines (28 loc) · 940 Bytes
/
models.py
File metadata and controls
31 lines (28 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from datetime import datetime
from typing import Dict, Optional
from pydantic import BaseModel
class Document:
def __init__(self, id: str, content: str, metadata: Dict, created_at: Optional[datetime] = None):
self.id = id
self.content = content
self.metadata = metadata
self.created_at = created_at or datetime.utcnow()
class VectorSearchResult(BaseModel):
document_id: str
content: str
similarity_score: float
metadata: Dict
model_config = {
"json_schema_extra": {
"examples": [{
"document_id": "123e4567-e89b-12d3-a456-426614174000",
"content": "Sample document content",
"similarity_score": 0.95,
"metadata": {
"filename": "example.pdf",
"content_type": "application/pdf",
"size": 1024
}
}]
}
}