File size: 649 Bytes
40d6ead
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from pydantic import BaseModel
from typing import List, Optional

# ConGPT Models
class VectorStoreDocumentItem(BaseModel):
    page_content: str
    filename: str
    heading: str
    relevance_score: float

class ChatHistoryItem(BaseModel):
    user_message: str
    assistant_message: str

class RequestModel(BaseModel):
    user_question: str
    chat_history: Optional[List[ChatHistoryItem]] = []
    use_tool: Optional[bool] = False

class ResponseModel(BaseModel):
    answer: Optional[str] = ""
    sources_documents: Optional[List[VectorStoreDocumentItem]] = []
    chat_history: List[ChatHistoryItem]
    search_phrase: Optional[str] = ""