I have read and followed all the instructions provided in the README.md.
I am on 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 provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.
Expected Behavior:
The tool classes should allow helper functions (only called by tool functions, not the LLM) that take a dict as a parameter.
Actual Behavior:
Tool classes that have helper functions that take a dict as a parameter raise and error resulting in the tools in that class not working.
Description
I have a tool class that was working in v0.3.12 of Open WebUI that has been broken since v0.3.15 I believe. In addition to functions that the LLM can call, I have some helper functions that are only used inside of the tool functions. Some of those helper functions take a dict as a parameter, which in the current version of Open WebUI results in the error shown below.
Bug Summary:
Tool class functions that take dict parameters break tool usage if if they aren't used.
Reproduction Details
Steps to Reproduce:
Create a tool class with a helper function (not to be called by the LLM) that takes a dict paramer:
defformat_status(self,status:dict)->str:"""
helper function, do not call
"""formatted_status=[]cpu_info=status.get("CPU Information",{})formatted_status.append("CPU Information:")formatted_status.append(f"Model: {cpu_info.get('Model','N/A')}")formatted_status.append(f"Cores: {cpu_info.get('Cores','N/A')}")formatted_status.append(f"Frequency: {cpu_info.get('Frequency','N/A')}")formatted_status.append("")# more code follows...#...
Originally created by @robert-mcdermott on GitHub (Aug 30, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/5047
# Bug Report
## Installation Method
Git clone, docker build
## Environment
- **Open WebUI Version:**: v0.3.16
- **Ollama Version**: v0.3.8
- **Operating System:**: Docker/Ubuntu 22.04]
- **Browser**: Latest Chrome
**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:
The tool classes should allow helper functions (only called by tool functions, not the LLM) that take a dict as a parameter.
## Actual Behavior:
Tool classes that have helper functions that take a dict as a parameter raise and error resulting in the tools in that class not working.
## Description
I have a tool class that was working in v0.3.12 of Open WebUI that has been broken since v0.3.15 I believe. In addition to functions that the LLM can call, I have some helper functions that are only used inside of the tool functions. Some of those helper functions take a dict as a parameter, which in the current version of Open WebUI results in the error shown below.
**Bug Summary:**
Tool class functions that take dict parameters break tool usage if if they aren't used.
## Reproduction Details
**Steps to Reproduce:**
Create a tool class with a helper function (not to be called by the LLM) that takes a dict paramer:
```python
def format_status(self, status: dict) -> str:
"""
helper function, do not call
"""
formatted_status = []
cpu_info = status.get("CPU Information", {})
formatted_status.append("CPU Information:")
formatted_status.append(f"Model: {cpu_info.get('Model', 'N/A')}")
formatted_status.append(f"Cores: {cpu_info.get('Cores', 'N/A')}")
formatted_status.append(f"Frequency: {cpu_info.get('Frequency', 'N/A')}")
formatted_status.append("")
# more code follows...
#...
```
## Logs and Screenshots
**Docker Container Logs:**
```python
ERROR [main] Unsupported JSON schema type: dict
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: dict
```
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 @robert-mcdermott on GitHub (Aug 30, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/5047
Bug Report
Installation Method
Git clone, docker build
Environment
Open WebUI Version:: v0.3.16
Ollama Version: v0.3.8
Operating System:: Docker/Ubuntu 22.04]
Browser: Latest Chrome
Confirmation:
Expected Behavior:
The tool classes should allow helper functions (only called by tool functions, not the LLM) that take a dict as a parameter.
Actual Behavior:
Tool classes that have helper functions that take a dict as a parameter raise and error resulting in the tools in that class not working.
Description
I have a tool class that was working in v0.3.12 of Open WebUI that has been broken since v0.3.15 I believe. In addition to functions that the LLM can call, I have some helper functions that are only used inside of the tool functions. Some of those helper functions take a dict as a parameter, which in the current version of Open WebUI results in the error shown below.
Bug Summary:
Tool class functions that take dict parameters break tool usage if if they aren't used.
Reproduction Details
Steps to Reproduce:
Create a tool class with a helper function (not to be called by the LLM) that takes a dict paramer:
Logs and Screenshots
Docker Container Logs: