user-feedback / db /schema.py
Ashmi Banerjee
somewhat works with the new data
29cc4c5
raw
history blame
770 Bytes
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