File size: 763 Bytes
5a2b2d3
9c7476c
5a2b2d3
 
 
 
9c7476c
5a2b2d3
9c7476c
 
5a2b2d3
9c7476c
5a2b2d3
 
 
9c7476c
5a2b2d3
8dbef5d
5a2b2d3
 
6f96ca2
 
9c7476c
 
6f96ca2
 
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
from pydantic import BaseModel
from datetime import datetime

class UserQuestion(BaseModel):
    question: str

# create a HistoryInput data model with a chat_history and question attributes.
class HistoryInput(BaseModel):
    chat_history: str
    question: str

# let's create a UserRequest data model with a question and username attribute. 
# This will be used to parse the input request.
class UserRequest(BaseModel):
    username: str
    question: str

# implement MessageBase as a schema mapping from the database model to the 
# FastAPI data model. Basically MessageBase should have the same attributes as models.Message
class MessageBase(BaseModel):
    # id: int
    # user_id: int
    message: str
    type: str
    timestamp: datetime
    # user: str