quivr/backend/models/chat.py
Mamadou DICKO 59fe7b089b
feat(chat): use openai function for answer (#354)
* feat(chat): use openai function for answer (backend)

* feat(chat): use openai function for answer (frontend)

* chore: refacto BrainPicking

* feat: update chat creation logic

* feat: simplify chat system logic

* feat: set default method to gpt-3.5-turbo-0613

* feat: use user own openai key

* feat(chat): slightly improve prompts

* feat: add global error interceptor

* feat: remove unused endpoints

* docs: update chat system doc

* chore(linter): add unused import remove config

* feat: improve dx

* feat: improve OpenAiFunctionBasedAnswerGenerator prompt
2023-06-22 17:50:06 +02:00

32 lines
829 B
Python

from dataclasses import dataclass
@dataclass
class Chat:
chat_id: str
user_id: str
creation_time: str
chat_name: str
def __init__(self, chat_dict: dict):
self.chat_id = chat_dict.get("chat_id")
self.user_id = chat_dict.get("user_id")
self.creation_time = chat_dict.get("creation_time")
self.chat_name = chat_dict.get("chat_name")
@dataclass
class ChatHistory:
chat_id: str
message_id: str
user_message: str
assistant: str
message_time: str
def __init__(self, chat_dict: dict):
self.chat_id = chat_dict.get("chat_id")
self.message_id = chat_dict.get("message_id")
self.user_message = chat_dict.get("user_message")
self.assistant = chat_dict.get("assistant")
self.message_time = chat_dict.get("message_time")