[GH-ISSUE #13325] issue: Unnecessary type parameter added during OpenAPI to tool spec conversion #55553

Closed
opened 2026-05-05 17:38:46 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @YorhaL on GitHub (Apr 29, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/13325

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

v0.6.5

Ollama Version (if applicable)

No response

Operating System

macOS

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have listed steps to reproduce the bug in detail.

Expected Behavior

The function definition within the generated tool spec should not contain a type parameter. When the API is called based on OpenAI spec, no type parameter should be passed under function.

Actual Behavior

When converting an OpenAPI specification to a tool spec, an unnecessary type parameter is being added under the function definition in the resulting tool spec.

Steps to Reproduce

  1. Enable native function calling
  2. Use OpenAPI Tool Server
  3. Send request

Logs & Screenshots

tools[0] from Open WebUI, tools[1] and tools[2] from OpenAPI Tool Server,

{
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "search",
                "description": "\n        Perform a Google search and return the results.\n\n        Args:\n            query: The search query string\n            num_results: Optional number of results to return (defaults to max_results valve)\n\n        Returns:\n            A formatted string containing the search results\n        ",
                "parameters": {
                    "properties": {
                        "query": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "query"
                    ],
                    "type": "object"
                }
            }
        },
        {
            "type": "function",
            "function": {
                "type": "function",
                "name": "tool_get_current_time_post",
                "description": "Get current time in a specific timezones",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "timezone": {
                            "type": "string",
                            "title": "Timezone",
                            "description": "IANA timezone name (e.g., 'America/New_York', 'Europe/London'). Use 'Asia/Shanghai' as local timezone if no timezone provided by the user."
                        }
                    },
                    "required": [
                        "timezone"
                    ]
                }
            }
        },
        {
            "type": "function",
            "function": {
                "type": "function",
                "name": "tool_convert_time_post",
                "description": "Convert time between timezones",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "source_timezone": {
                            "type": "string",
                            "title": "Source Timezone",
                            "description": "Source IANA timezone name (e.g., 'America/New_York', 'Europe/London'). Use 'Asia/Shanghai' as local timezone if no source timezone provided by the user."
                        },
                        "time": {
                            "type": "string",
                            "title": "Time",
                            "description": "Time to convert in 24-hour format (HH:MM)"
                        },
                        "target_timezone": {
                            "type": "string",
                            "title": "Target Timezone",
                            "description": "Target IANA timezone name (e.g., 'Asia/Tokyo', 'America/San_Francisco'). Use 'Asia/Shanghai' as local timezone if no target timezone provided by the user."
                        }
                    },
                    "required": [
                        "time",
                        "target_timezone",
                        "source_timezone"
                    ]
                }
            }
        }
    ]
}

Additional Information

I think the problem is in the following code:
852d9dcbe9/backend/open_webui/utils/tools.py (L360-L420)

Originally created by @YorhaL on GitHub (Apr 29, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/13325 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.6.5 ### Ollama Version (if applicable) _No response_ ### Operating System macOS ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have listed steps to reproduce the bug in detail. ### Expected Behavior The `function` definition within the generated tool spec should not contain a `type` parameter. When the API is called based on OpenAI spec, no `type` parameter should be passed under `function`. ### Actual Behavior When converting an OpenAPI specification to a tool spec, an unnecessary `type` parameter is being added under the `function` definition in the resulting tool spec. ### Steps to Reproduce 1. Enable native function calling 2. Use OpenAPI Tool Server 3. Send request ### Logs & Screenshots `tools[0]` from Open WebUI, `tools[1]` and `tools[2]` from OpenAPI Tool Server, ``` { "tools": [ { "type": "function", "function": { "name": "search", "description": "\n Perform a Google search and return the results.\n\n Args:\n query: The search query string\n num_results: Optional number of results to return (defaults to max_results valve)\n\n Returns:\n A formatted string containing the search results\n ", "parameters": { "properties": { "query": { "type": "string" } }, "required": [ "query" ], "type": "object" } } }, { "type": "function", "function": { "type": "function", "name": "tool_get_current_time_post", "description": "Get current time in a specific timezones", "parameters": { "type": "object", "properties": { "timezone": { "type": "string", "title": "Timezone", "description": "IANA timezone name (e.g., 'America/New_York', 'Europe/London'). Use 'Asia/Shanghai' as local timezone if no timezone provided by the user." } }, "required": [ "timezone" ] } } }, { "type": "function", "function": { "type": "function", "name": "tool_convert_time_post", "description": "Convert time between timezones", "parameters": { "type": "object", "properties": { "source_timezone": { "type": "string", "title": "Source Timezone", "description": "Source IANA timezone name (e.g., 'America/New_York', 'Europe/London'). Use 'Asia/Shanghai' as local timezone if no source timezone provided by the user." }, "time": { "type": "string", "title": "Time", "description": "Time to convert in 24-hour format (HH:MM)" }, "target_timezone": { "type": "string", "title": "Target Timezone", "description": "Target IANA timezone name (e.g., 'Asia/Tokyo', 'America/San_Francisco'). Use 'Asia/Shanghai' as local timezone if no target timezone provided by the user." } }, "required": [ "time", "target_timezone", "source_timezone" ] } } } ] } ``` ### Additional Information I think the problem is in the following code: https://github.com/open-webui/open-webui/blob/852d9dcbe9b4406e1da230a14642f35ac7bb0d2b/backend/open_webui/utils/tools.py#L360-L420
GiteaMirror added the bug label 2026-05-05 17:38:46 -05:00
Author
Owner

@tjbck commented on GitHub (Apr 29, 2025):

How is this a bug? Correct me if i'm wrong but this should be the intended behaviour.

<!-- gh-comment-id:2839340342 --> @tjbck commented on GitHub (Apr 29, 2025): How is this a bug? Correct me if i'm wrong but this should be the intended behaviour.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#55553