Since updating to today's release, my tools stopped working. If the commit from 2 days ago is in the release, I'm guessing line 86 breaks list parameters in tools. changing "array" to "list" and restarting the backend fixes it for me.
Reproduction Details
Steps to Reproduce:
use "list" or "List[str]" as the type of a param in a tool.
e.g.
ERROR [main] Unsupported JSON schema type: list
Traceback (most recent call last):
File "/app/backend/main.py", line 564, in dispatch
body, flags = await chat_completion_tools_handler(body, user, extra_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/main.py", line 393, in chat_completion_tools_handler
tools = get_tools(webui_app, tool_ids, user, custom_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/tools.py", line 75, in get_tools
"pydantic_model": json_schema_to_model(spec),
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/schemas.py", line 21, in json_schema_to_model
field_definitions = {
^
File "/app/backend/utils/schemas.py", line 22, in <dictcomp>
name: json_schema_to_pydantic_field(name, prop, schema.get("required", []))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/schemas.py", line 45, in json_schema_to_pydantic_field
type_ = json_schema_to_pydantic_type(json_schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/schemas.py", line 104, in json_schema_to_pydantic_type
raise ValueError(f"Unsupported JSON schema type: {type_}")
ValueError: Unsupported JSON schema type: list
Docker Container Logs:
See above
Additional Information
Originally created by @gkns1 on GitHub (Aug 21, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/4793
# Bug Report
## Installation Method
docker
## Environment
Open WebUI v0.3.14
**Confirmation:**
- [x] I have read and followed all the instructions provided in the README.md.
- [x] I am on the latest version of both Open WebUI and Ollama.
- [ ] I have included the browser console logs.
- [x] I have included the Docker container logs.
- [x] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.
## Expected Behavior:
Tools work as before.
## Actual Behavior:
Tool errors out with list parameter type.
## Description
**Bug Summary:**
This might be related to this file.
https://github.com/open-webui/open-webui/blame/50d53c6f8db70f8325663ac3b7142428dc8dec22/backend/utils/schemas.py#L86
Since updating to today's release, my tools stopped working. If the commit from 2 days ago is in the release, I'm guessing line 86 breaks list parameters in tools. changing "array" to "list" and restarting the backend fixes it for me.
## Reproduction Details
**Steps to Reproduce:**
use "list" or "List[str]" as the type of a param in a tool.
e.g.
```
async def send_data(
self,
filename: str,
models: List[str],
system: str,
__event_emitter__: Callable[[dict], Awaitable[None]],)
```
## Logs and Screenshots
```
ERROR [main] Unsupported JSON schema type: list
Traceback (most recent call last):
File "/app/backend/main.py", line 564, in dispatch
body, flags = await chat_completion_tools_handler(body, user, extra_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/main.py", line 393, in chat_completion_tools_handler
tools = get_tools(webui_app, tool_ids, user, custom_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/tools.py", line 75, in get_tools
"pydantic_model": json_schema_to_model(spec),
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/schemas.py", line 21, in json_schema_to_model
field_definitions = {
^
File "/app/backend/utils/schemas.py", line 22, in <dictcomp>
name: json_schema_to_pydantic_field(name, prop, schema.get("required", []))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/schemas.py", line 45, in json_schema_to_pydantic_field
type_ = json_schema_to_pydantic_type(json_schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/schemas.py", line 104, in json_schema_to_pydantic_type
raise ValueError(f"Unsupported JSON schema type: {type_}")
ValueError: Unsupported JSON schema type: list
```
**Docker Container Logs:**
See above
## Additional Information
@justinh-rahb Still getting the error after updating to v0.3.15 with watchtower. My modification makes it go away.
<!-- gh-comment-id:2310681383 -->
@gkns1 commented on GitHub (Aug 26, 2024):
@justinh-rahb Still getting the error after updating to v0.3.15 with watchtower. My modification makes it go away.
Tools are generally working on my end. Git commit hash e2b7296
<!-- gh-comment-id:2311008191 -->
@justinh-rahb commented on GitHub (Aug 26, 2024):
Tools are generally working on my end. Git commit hash [e2b7296](https://github.com/open-webui/open-webui/commit/e2b7296786053dfc77f6ae0205a1b195e05a712c)

Watchtower updated to 0.3.16 today and the error came back. The tools where I don't use list/List[str] work fine.
I made a simple example that triggers the error for me.
What I didn't mention and it may matter - I'm testing this with 4o mini through litellm proxy connection.
"""
title: list test
author: KG
author_url:
funding_url:
version: 0.1.0
"""
from typing import List
class Tools:
async def print_list(
self,
to_print: List[str],
) -> str:
"""
Print back a list of strings.
:param to_print: A list of words to print.
:return: A list of words to return to the user.
"""
return f"{to_print}"
prompt with the tool manually selected: Print back a list of those strings: 1, 2, something, whatever
log:
ERROR [main] Unsupported JSON schema type: list
Traceback (most recent call last):
File "/app/backend/main.py", line 562, in dispatch
body, flags = await chat_completion_tools_handler(body, user, extra_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/main.py", line 377, in chat_completion_tools_handler
tools = get_tools(
^^^^^^^^^^
File "/app/backend/utils/tools.py", line 75, in get_tools
"pydantic_model": json_schema_to_model(spec),
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/schemas.py", line 21, in json_schema_to_model
field_definitions = {
^
File "/app/backend/utils/schemas.py", line 22, in <dictcomp>
name: json_schema_to_pydantic_field(name, prop, schema.get("required", []))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/schemas.py", line 45, in json_schema_to_pydantic_field
type_ = json_schema_to_pydantic_type(json_schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/schemas.py", line 104, in json_schema_to_pydantic_type
raise ValueError(f"Unsupported JSON schema type: {type_}")
ValueError: Unsupported JSON schema type: list
The log after modification, restart and using the same tool+prompt:
INFO [main] tools={'print_list': {'toolkit_id': 'list_test', 'callable': <function apply_extra_params_to_tool_function.<locals>.new_function at 0x7f241716d1c0>, 'spec': {'name': 'print_list', 'description': 'Sends activity data from a specified file to an API.', 'parameters': {'type': 'object', 'properties': {'to_print': {'type': 'list', 'enum': "(<class 'str'>,)", 'description': 'A list of words to print.'}}, 'required': ['to_print']}}, 'pydantic_model': <class 'utils.schemas.print_list'>, 'file_handler': False, 'citation': False}}
INFO [main] tools_function_calling_prompt='Tools: [{"name": "print_list", "description": "Sends activity data from a specified file to an API.", "parameters": {"type": "object", "properties": {"to_print": {"type": "list", "enum": "(<class \'str\'>,)", "description": "A list of words to print."}}, "required": ["to_print"]}}]\nIf a function tool doesn\'t match the query, return an empty string. Else, pick a function tool, fill in the parameters from the function tool\'s schema, and return it in the format { "name": "functionName", "parameters": { "key": "value" } }. Only pick a function if the user asks. Only return the object. Do not return any other text.'
response
edit: Worth mentioning maybe - I also have the context clip filter turned on globally. (from the community functions)
<!-- gh-comment-id:2313408739 -->
@gkns1 commented on GitHub (Aug 27, 2024):
Watchtower updated to 0.3.16 today and the error came back. The tools where I don't use list/List[str] work fine.
I made a simple example that triggers the error for me.
What I didn't mention and it may matter - I'm testing this with 4o mini through litellm proxy connection.
```
"""
title: list test
author: KG
author_url:
funding_url:
version: 0.1.0
"""
from typing import List
class Tools:
async def print_list(
self,
to_print: List[str],
) -> str:
"""
Print back a list of strings.
:param to_print: A list of words to print.
:return: A list of words to return to the user.
"""
return f"{to_print}"
```
prompt with the tool manually selected:
`Print back a list of those strings: 1, 2, something, whatever`
log:
```
ERROR [main] Unsupported JSON schema type: list
Traceback (most recent call last):
File "/app/backend/main.py", line 562, in dispatch
body, flags = await chat_completion_tools_handler(body, user, extra_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/main.py", line 377, in chat_completion_tools_handler
tools = get_tools(
^^^^^^^^^^
File "/app/backend/utils/tools.py", line 75, in get_tools
"pydantic_model": json_schema_to_model(spec),
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/schemas.py", line 21, in json_schema_to_model
field_definitions = {
^
File "/app/backend/utils/schemas.py", line 22, in <dictcomp>
name: json_schema_to_pydantic_field(name, prop, schema.get("required", []))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/schemas.py", line 45, in json_schema_to_pydantic_field
type_ = json_schema_to_pydantic_type(json_schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/utils/schemas.py", line 104, in json_schema_to_pydantic_type
raise ValueError(f"Unsupported JSON schema type: {type_}")
ValueError: Unsupported JSON schema type: list
```
The log after modification, restart and using the same tool+prompt:
```
INFO [main] tools={'print_list': {'toolkit_id': 'list_test', 'callable': <function apply_extra_params_to_tool_function.<locals>.new_function at 0x7f241716d1c0>, 'spec': {'name': 'print_list', 'description': 'Sends activity data from a specified file to an API.', 'parameters': {'type': 'object', 'properties': {'to_print': {'type': 'list', 'enum': "(<class 'str'>,)", 'description': 'A list of words to print.'}}, 'required': ['to_print']}}, 'pydantic_model': <class 'utils.schemas.print_list'>, 'file_handler': False, 'citation': False}}
INFO [main] tools_function_calling_prompt='Tools: [{"name": "print_list", "description": "Sends activity data from a specified file to an API.", "parameters": {"type": "object", "properties": {"to_print": {"type": "list", "enum": "(<class \'str\'>,)", "description": "A list of words to print."}}, "required": ["to_print"]}}]\nIf a function tool doesn\'t match the query, return an empty string. Else, pick a function tool, fill in the parameters from the function tool\'s schema, and return it in the format { "name": "functionName", "parameters": { "key": "value" } }. Only pick a function if the user asks. Only return the object. Do not return any other text.'
```
response

edit: Worth mentioning maybe - I also have the context clip filter turned on globally. (from the community functions)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @gkns1 on GitHub (Aug 21, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/4793
Bug Report
Installation Method
docker
Environment
Open WebUI v0.3.14
Confirmation:
Expected Behavior:
Tools work as before.
Actual Behavior:
Tool errors out with list parameter type.
Description
Bug Summary:
This might be related to this file.
https://github.com/open-webui/open-webui/blame/50d53c6f8db70f8325663ac3b7142428dc8dec22/backend/utils/schemas.py#L86
Since updating to today's release, my tools stopped working. If the commit from 2 days ago is in the release, I'm guessing line 86 breaks list parameters in tools. changing "array" to "list" and restarting the backend fixes it for me.
Reproduction Details
Steps to Reproduce:
use "list" or "List[str]" as the type of a param in a tool.
e.g.
Logs and Screenshots
Docker Container Logs:
See above
Additional Information
@justinh-rahb commented on GitHub (Aug 21, 2024):
Duplicate:
@gkns1 commented on GitHub (Aug 26, 2024):
@justinh-rahb Still getting the error after updating to v0.3.15 with watchtower. My modification makes it go away.
@justinh-rahb commented on GitHub (Aug 26, 2024):
Tools are generally working on my end. Git commit hash e2b7296
@gkns1 commented on GitHub (Aug 27, 2024):
Watchtower updated to 0.3.16 today and the error came back. The tools where I don't use list/List[str] work fine.
I made a simple example that triggers the error for me.
What I didn't mention and it may matter - I'm testing this with 4o mini through litellm proxy connection.
prompt with the tool manually selected:
Print back a list of those strings: 1, 2, something, whateverlog:
The log after modification, restart and using the same tool+prompt:
response

edit: Worth mentioning maybe - I also have the context clip filter turned on globally. (from the community functions)
@robert-mcdermott commented on GitHub (Aug 27, 2024):
I'm having this exact error, my functions stopped working, running v0.3.15