File tree 1 file changed +5
-14
lines changed
1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change 1
- from typing import List , Union , Optional
2
- from pydantic import BaseModel , RootModel , ConfigDict
3
-
4
- class ImageContent (BaseModel ):
5
- type : str
6
- image_url : dict
7
-
8
- class TextContent (BaseModel ):
9
- type : str
10
- text : str
11
-
12
- class MessageContent (RootModel ):
13
- root : Union [TextContent , ImageContent ]
1
+ from typing import List , Optional
2
+ from pydantic import BaseModel , ConfigDict
14
3
15
4
class OpenAIChatMessage (BaseModel ):
16
5
role : str
17
- content : Union [ str , List [ MessageContent ]]
6
+ content : str | List
18
7
19
8
model_config = ConfigDict (extra = "allow" )
20
9
10
+
21
11
class OpenAIChatCompletionForm (BaseModel ):
22
12
stream : bool = True
23
13
model : str
24
14
messages : List [OpenAIChatMessage ]
25
15
26
16
model_config = ConfigDict (extra = "allow" )
27
17
18
+
28
19
class FilterForm (BaseModel ):
29
20
body : dict
30
21
user : Optional [dict ] = None
You can’t perform that action at this time.
0 commit comments