mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-13 04:45:19 +00:00
feat: pass structured output format through to ollama
This commit is contained in:
parent
18fd3db3d5
commit
16d900247a
2 changed files with 4 additions and 1 deletions
|
|
@ -917,7 +917,7 @@ class ChatMessage(BaseModel):
|
||||||
class GenerateChatCompletionForm(BaseModel):
|
class GenerateChatCompletionForm(BaseModel):
|
||||||
model: str
|
model: str
|
||||||
messages: list[ChatMessage]
|
messages: list[ChatMessage]
|
||||||
format: Optional[str] = None
|
format: Optional[dict] = None
|
||||||
options: Optional[dict] = None
|
options: Optional[dict] = None
|
||||||
template: Optional[str] = None
|
template: Optional[str] = None
|
||||||
stream: Optional[bool] = True
|
stream: Optional[bool] = True
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,9 @@ def convert_payload_openai_to_ollama(openai_payload: dict) -> dict:
|
||||||
)
|
)
|
||||||
ollama_payload["stream"] = openai_payload.get("stream", False)
|
ollama_payload["stream"] = openai_payload.get("stream", False)
|
||||||
|
|
||||||
|
if "format" in openai_payload:
|
||||||
|
ollama_payload["format"] = openai_payload["format"]
|
||||||
|
|
||||||
# If there are advanced parameters in the payload, format them in Ollama's options field
|
# If there are advanced parameters in the payload, format them in Ollama's options field
|
||||||
ollama_options = {}
|
ollama_options = {}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue