File size: 770 Bytes
9a6b7dc
897c1d2
9a6b7dc
 
 
29cc4c5
 
 
 
 
 
9a6b7dc
897c1d2
29cc4c5
 
897c1d2
9a6b7dc
 
 
 
 
 
 
 
 
 
 
 
 
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
from pydantic import BaseModel
from typing import List, Dict, Optional
from datetime import datetime


class ModelRatings(BaseModel):
    query_v_ratings: Dict[str, int]
    query_p0_ratings: Dict[str, int]
    query_p1_ratings: Dict[str, int]


class Response(BaseModel):
    config_id: str
    model_ratings: Dict[str, ModelRatings]
    comment: Optional[str] = None
    timestamp: str


class Feedback(BaseModel):
    id: int
    user_id: str
    time_stamp: datetime
    responses: List[Response]

    # Override the method to serialize datetime
    def dict(self, *args, **kwargs):
        feedback_data = super().dict(*args, **kwargs)
        feedback_data['time_stamp'] = self.time_stamp.isoformat()  # Convert datetime to ISO string
        return feedback_data