-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathcommon.py
52 lines (38 loc) · 1.07 KB
/
common.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from enum import Enum
from typing import (
Dict,
List,
Optional,
)
from pydantic import BaseModel
class CodegateFunction(BaseModel):
name: Optional[str] = None
arguments: Optional[str] = None
class CodegateChatCompletionDeltaToolCall(BaseModel):
id: Optional[str] = None
function: CodegateFunction
type: str
index: Optional[int] = None
class CodegateDelta(BaseModel):
role: str
content: Optional[str] = None
tool_calls: Optional[List[CodegateChatCompletionDeltaToolCall]] = None
class CodegateStreamingChoices(BaseModel):
delta: CodegateDelta
index: Optional[int] = None
finish_reason: Optional[str] = None
class CodegateModelResponseStream(BaseModel):
id: Optional[str] = None
created: Optional[int] = None
model: str
object: str
choices: Optional[List[CodegateStreamingChoices]] = None
payload: Optional[Dict] = None
class MessageTypeFilter(Enum):
"""
Enum of supported message type filters
"""
ASSISTANT = "assistant"
SYSTEM = "system"
TOOL = "tool"
USER = "user"