Skip to content

Commit

Permalink
schemas.py fix to support image input with latest open webui version
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenlin88 committed Jul 23, 2024
1 parent 90fa1cc commit 2da26de
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions schemas.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
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]
from typing import List, Optional
from pydantic import BaseModel, ConfigDict

class OpenAIChatMessage(BaseModel):
role: str
content: Union[str, List[MessageContent]]
content: str | List

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
Expand Down

0 comments on commit 2da26de

Please sign in to comment.