muryshev's picture
init
57cf043
raw
history blame
785 Bytes
from pydantic import BaseModel, field_validator
from exceptions import InvalidEstimateException, InvalidUserScoreException
class FeedbackCreate(BaseModel):
log_id: int
userComment: str
userScore: int
manualEstimate: int
llmEstimate: int
@field_validator("userScore")
def check_user_score(cls, value):
if not (1 <= value <= 5):
raise InvalidUserScoreException(value)
return value
@field_validator("manualEstimate")
def check_manual_estimate(cls, value):
if value < 1:
raise InvalidEstimateException(value)
return value
@field_validator("llmEstimate")
def check_llm_estimate(cls, value):
if value < 1:
raise InvalidEstimateException(value)
return value