mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-13 04:45:19 +00:00
Merge pull request #16344 from Rain6435/fix-openapi-array-parameters
fix: include items property in OpenAPI array parameters for OpenAI function calling
This commit is contained in:
commit
67dcef5e9a
1 changed files with 7 additions and 1 deletions
|
|
@ -398,10 +398,16 @@ def convert_openapi_to_tool_payload(openapi_spec):
|
|||
description += (
|
||||
f". Possible values: {', '.join(param_schema.get('enum'))}"
|
||||
)
|
||||
tool["parameters"]["properties"][param_name] = {
|
||||
param_property = {
|
||||
"type": param_schema.get("type"),
|
||||
"description": description,
|
||||
}
|
||||
|
||||
# Include items property for array types (required by OpenAI)
|
||||
if param_schema.get("type") == "array" and "items" in param_schema:
|
||||
param_property["items"] = param_schema["items"]
|
||||
|
||||
tool["parameters"]["properties"][param_name] = param_property
|
||||
if param.get("required"):
|
||||
tool["parameters"]["required"].append(param_name)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue