File size: 785 Bytes
57cf043
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, 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