-
Notifications
You must be signed in to change notification settings - Fork 0
/
response_body.py
66 lines (46 loc) · 1.08 KB
/
response_body.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from typing import Literal
from pydantic import BaseModel
class Message(BaseModel):
"""_summary_
Args:
BaseModel (_type_): message in choice
"""
role: Literal["system", "user", "assistant"]
content: str
class Choice(BaseModel):
"""_summary_
Args:
BaseModel (_type_): choice in completion response
"""
index: int
text: str
logprobs: None
finish_reason: str
class CompletionResponseBody(BaseModel):
"""_summary_
Args:
BaseModel (_type_): response body for /chat/completions
"""
id: str
object: str
created: int
choices: list[Choice]
usage: dict[str, int]
class ChatChoice(BaseModel):
"""_summary_
Args:
BaseModel (_type_): choice in completion response
"""
index: int
message: Message
finish_reason: str
class ChatCompletionResponseBody(BaseModel):
"""_summary_
Args:
BaseModel (_type_): response body for /chat/completions
"""
id: str
object: str
created: int
choices: list[ChatChoice]
usage: dict[str, int]