forked from open-webui/pipelines
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.py
More file actions
31 lines (23 loc) · 728 Bytes
/
schemas.py
File metadata and controls
31 lines (23 loc) · 728 Bytes
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
from typing import List, Union, Optional
from pydantic import BaseModel, RootModel, ConfigDict
class ImageContent(BaseModel):
type: str
image_url: dict
class TextContent(BaseModel):
type: str
text: str
class MessageContent(RootModel):
root: Union[TextContent, ImageContent]
class OpenAIChatMessage(BaseModel):
role: str
content: Union[str, List[MessageContent]]
model_config = ConfigDict(extra="allow")
class OpenAIChatCompletionForm(BaseModel):
stream: bool = True
model: str
messages: List[OpenAIChatMessage]
model_config = ConfigDict(extra="allow")
class FilterForm(BaseModel):
body: dict
user: Optional[dict] = None
model_config = ConfigDict(extra="allow")