Skip to content

Commit

Permalink
Merge pull request #172 from Wenlin88/schemas.py-fix
Browse files Browse the repository at this point in the history
schemas.py fix to support image input with latest open WebUI version
  • Loading branch information
tjbck authored Oct 19, 2024
2 parents 0a08564 + 2da26de commit 52ffa64
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 52ffa64

Please sign in to comment.