-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_model.py
36 lines (29 loc) · 897 Bytes
/
data_model.py
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
31
32
33
34
35
36
from dataclasses import dataclass, field
from typing import Literal
from enum import Enum
import mesop as me
Role = Literal["user", "model"]
@dataclass(kw_only=True)
class ChatMessage:
role: Role = "user"
content: str = ""
in_progress: bool = False
class Models(Enum):
GEMINI_1_5_FLASH = "Gemini 1.5 Flash"
GEMINI_1_5_PRO = "Gemini 1.5 Pro"
CLAUDE_3_5_SONNET = "Claude 3.5 Sonnet"
@dataclass
class Conversation:
model: str = ""
messages: list[ChatMessage] = field(default_factory=list)
@me.stateclass
class State:
is_model_picker_dialog_open: bool = False
input: str = ""
conversations: list[Conversation] = field(default_factory=list)
models: list[str] = field(default_factory=list)
gemini_api_key: str = ""
claude_api_key: str = ""
@me.stateclass
class ModelDialogState:
selected_models: list[str] = field(default_factory=list)