mirror of
https://github.com/open-webui/open-webui
synced 2024-11-07 00:59:52 +00:00
fix: Unsupported JSON schema type {type_}
This commit is contained in:
parent
d353ea449a
commit
bdb2ce9448
@ -104,5 +104,9 @@ def json_schema_to_pydantic_type(json_schema: dict[str, Any]) -> Any:
|
|||||||
return Optional[Any] # Use Optional[Any] for nullable fields
|
return Optional[Any] # Use Optional[Any] for nullable fields
|
||||||
elif type_ == "literal":
|
elif type_ == "literal":
|
||||||
return Literal[literal_eval(json_schema.get("enum"))]
|
return Literal[literal_eval(json_schema.get("enum"))]
|
||||||
|
elif type_ == "optional":
|
||||||
|
inner_schema = json_schema.get("items", {"type": "string"})
|
||||||
|
inner_type = json_schema_to_pydantic_type(inner_schema)
|
||||||
|
return Optional[inner_type]
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unsupported JSON schema type: {type_}")
|
raise ValueError(f"Unsupported JSON schema type: {type_}")
|
||||||
|
Loading…
Reference in New Issue
Block a user