File size: 698 Bytes
bf41ce7
 
 
 
1fac9b0
bf41ce7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import datetime


# feedback model to manage user's feedback (thumb up and down)
from Brain.src.model.basic_model import BasicModel


class FeedbackModel:
    def __init__(
        self, uuid: str, prompt: BasicModel, completion: BasicModel, rating: int
    ):
        self.uuid = uuid
        self.prompt = prompt
        self.completion = completion
        self.rating = rating
        self.timestamp = datetime.datetime.now().timestamp()

    def to_json(self):
        return {
            "uuid": self.uuid,
            "prompt": self.prompt.to_json(),
            "completion": self.completion.to_json(),
            "rating": self.rating,
            "timestamp": self.timestamp,
        }