I have searched the existing issues and discussions.
I am using the latest version of Open WebUI.
Installation Method
Docker
Open WebUI Version
v0.6.4
Ollama Version (if applicable)
No response
Operating System
n/a
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 tool description should be the start of the docstring of the tool.
Actual Behavior
The tool description is the docstring of the last parameter
Steps to Reproduce
A tool like:
def get_aws_cost_explorer_data(self, start_date: str, end_date: str, granularity: str = 'MONTHLY',
accounts: list = None, services: list = None,
tags: dict = None, group_by: List = None) -> List[Dict]:
"""
Retrieve AWS cost and usage data with flexible filtering and grouping options, from AWS Cost Explorer.
Note:
- All costs are reported in USD.
- Data for today and yesterday may be incomplete or delayed.
- Cost data for up to one week ago may also be subject to delay or adjustment.
:param start_date: The start date (inclusive) for the query in 'YYYY-MM-DD' format.
:param end_date: The end date (exclusive) for the query in 'YYYY-MM-DD' format.
:param granularity: Time granularity for the results ('DAILY', 'MONTHLY'). Default is 'MONTHLY'. You must not get 'MONTHLY' for the current month, as the month is not complete.
:param accounts: Optional list of AWS account IDs to filter by. Use get_available_accounts() to get account IDs.
:param services: Optional list of AWS services to filter by. Use get_available_services() to get service names.
:param tags: Optional dict of AWS tags to filter by. Example: {'Environment': ['Prod', 'Dev']}.
:param group_by: Optional list of dimensions or tags to group by. Example: ['LINKED_ACCOUNT', 'SERVICE', {'TAG': 'Environment'}].
:return: A list containing filtered and grouped cost details for the specified period.
"""
params = self.__get_cost_data_args__(start_date, end_date, granularity, accounts, services, tags, group_by)
rv = self.__query_cost_data__(params)
return rv
I added a log line to figure out what was going on, in backend/open_webui/utils/tools.py:
for spec in tool.specs:
# TODO: Fix hack for OpenAI API
# Some times breaks OpenAI but others don't. Leaving the comment
log.debug(f"Tool spec: {spec}")
for val in spec.get("parameters", {}).get("properties", {}).values():
log.debug(f"Tool spec param: {val}") # Added debugging line
if val["type"] == "str":
val["type"] = "string"
The result of that log line is shown in the Logs & Screenshots box.
Logs & Screenshots
open_webui.utils.tools:get_tools:157 - Tool spec: {'name': 'get_aws_cost_explorer_data', 'description': "Optional list of dimensions or tags to group by. Example: ['LINKED_ACCOUNT', 'SERVICE', {'TAG': 'Environment'}].", 'parameters': {'properties': {'start_date': {'description': "The start date (inclusive) for the query in 'YYYY-MM-DD' format.", 'type': 'string'}, 'end_date': {'description': "The end date (exclusive) for the query in 'YYYY-MM-DD' format.", 'type': 'string'}, 'granularity': {'default': 'MONTHLY', 'description': "Time granularity for the results ('DAILY', 'MONTHLY'). Default is 'MONTHLY'. You must not get 'MONTHLY' for the current month, as the month is not complete.", 'type': 'string'}, 'accounts': {'default': None, 'description': 'Optional list of AWS account IDs to filter by. Use get_available_accounts() to get account IDs.', 'items': {}, 'type': 'array'}, 'services': {'default': None, 'description': 'Optional list of AWS services to filter by. Use get_available_services() to get service names.', 'items': {}, 'type': 'array'}, 'tags': {'default': None, 'description': "Optional dict of AWS tags to filter by. Example: {'Environment': ['Prod', 'Dev']}.", 'type': 'object'}, 'group_by': {'default': None, 'description': "Optional list of dimensions or tags to group by. Example: ['LINKED_ACCOUNT', 'SERVICE', {'TAG': 'Environment'}].", 'items': {}, 'type': 'array'}}, 'required': ['start_date', 'end_date'], 'type': 'object'}} -
Additional Information
There are no console logs, as they are not relevant; this is a back-end bug - but I can't submit without ticking the box.
Originally created by @jarrod-mg on GitHub (Apr 14, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12834
### Check Existing Issues
- [x] I have searched the existing issues and discussions.
- [x] I am using the latest version of Open WebUI.
### Installation Method
Docker
### Open WebUI Version
v0.6.4
### Ollama Version (if applicable)
_No response_
### Operating System
n/a
### 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 tool description should be the start of the docstring of the tool.
### Actual Behavior
The tool description is the docstring of the last parameter
### Steps to Reproduce
A tool like:
```
def get_aws_cost_explorer_data(self, start_date: str, end_date: str, granularity: str = 'MONTHLY',
accounts: list = None, services: list = None,
tags: dict = None, group_by: List = None) -> List[Dict]:
"""
Retrieve AWS cost and usage data with flexible filtering and grouping options, from AWS Cost Explorer.
Note:
- All costs are reported in USD.
- Data for today and yesterday may be incomplete or delayed.
- Cost data for up to one week ago may also be subject to delay or adjustment.
:param start_date: The start date (inclusive) for the query in 'YYYY-MM-DD' format.
:param end_date: The end date (exclusive) for the query in 'YYYY-MM-DD' format.
:param granularity: Time granularity for the results ('DAILY', 'MONTHLY'). Default is 'MONTHLY'. You must not get 'MONTHLY' for the current month, as the month is not complete.
:param accounts: Optional list of AWS account IDs to filter by. Use get_available_accounts() to get account IDs.
:param services: Optional list of AWS services to filter by. Use get_available_services() to get service names.
:param tags: Optional dict of AWS tags to filter by. Example: {'Environment': ['Prod', 'Dev']}.
:param group_by: Optional list of dimensions or tags to group by. Example: ['LINKED_ACCOUNT', 'SERVICE', {'TAG': 'Environment'}].
:return: A list containing filtered and grouped cost details for the specified period.
"""
params = self.__get_cost_data_args__(start_date, end_date, granularity, accounts, services, tags, group_by)
rv = self.__query_cost_data__(params)
return rv
```
I added a log line to figure out what was going on, in backend/open_webui/utils/tools.py:
```
for spec in tool.specs:
# TODO: Fix hack for OpenAI API
# Some times breaks OpenAI but others don't. Leaving the comment
log.debug(f"Tool spec: {spec}")
for val in spec.get("parameters", {}).get("properties", {}).values():
log.debug(f"Tool spec param: {val}") # Added debugging line
if val["type"] == "str":
val["type"] = "string"
```
The result of that log line is shown in the Logs & Screenshots box.
### Logs & Screenshots
open_webui.utils.tools:get_tools:157 - Tool spec: {'name': 'get_aws_cost_explorer_data', 'description': "Optional list of dimensions or tags to group by. Example: ['LINKED_ACCOUNT', 'SERVICE', {'TAG': 'Environment'}].", 'parameters': {'properties': {'start_date': {'description': "The start date (inclusive) for the query in 'YYYY-MM-DD' format.", 'type': 'string'}, 'end_date': {'description': "The end date (exclusive) for the query in 'YYYY-MM-DD' format.", 'type': 'string'}, 'granularity': {'default': 'MONTHLY', 'description': "Time granularity for the results ('DAILY', 'MONTHLY'). Default is 'MONTHLY'. You must not get 'MONTHLY' for the current month, as the month is not complete.", 'type': 'string'}, 'accounts': {'default': None, 'description': 'Optional list of AWS account IDs to filter by. Use get_available_accounts() to get account IDs.', 'items': {}, 'type': 'array'}, 'services': {'default': None, 'description': 'Optional list of AWS services to filter by. Use get_available_services() to get service names.', 'items': {}, 'type': 'array'}, 'tags': {'default': None, 'description': "Optional dict of AWS tags to filter by. Example: {'Environment': ['Prod', 'Dev']}.", 'type': 'object'}, 'group_by': {'default': None, 'description': "Optional list of dimensions or tags to group by. Example: ['LINKED_ACCOUNT', 'SERVICE', {'TAG': 'Environment'}].", 'items': {}, 'type': 'array'}}, 'required': ['start_date', 'end_date'], 'type': 'object'}} -
### Additional Information
There are no console logs, as they are not relevant; this is a back-end bug - but I can't submit without ticking the box.
GiteaMirror
added the bug label 2026-05-20 21:33:41 -05:00
I'd recommend you to use the updated convention with pydantic Field, e.g.:
defcalculator(self,equation:str=Field(...,description="The mathematical equation to calculate."),)->str:"""
Calculate the result of an equation.
"""# Avoid using eval in production code# https://nedbatchelder.com/blog/201206/eval_really_is_dangerous.htmltry:result=eval(equation)returnf"{equation} = {result}"exceptExceptionase:print(e)return"Invalid equation"
<!-- gh-comment-id:2800579115 -->
@tjbck commented on GitHub (Apr 14, 2025):
I'd recommend you to use the updated convention with pydantic Field, e.g.:
```py
def calculator(
self,
equation: str = Field(
..., description="The mathematical equation to calculate."
),
) -> str:
"""
Calculate the result of an equation.
"""
# Avoid using eval in production code
# https://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html
try:
result = eval(equation)
return f"{equation} = {result}"
except Exception as e:
print(e)
return "Invalid equation"
```
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 @jarrod-mg on GitHub (Apr 14, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12834
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.4
Ollama Version (if applicable)
No response
Operating System
n/a
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
The tool description should be the start of the docstring of the tool.
Actual Behavior
The tool description is the docstring of the last parameter
Steps to Reproduce
A tool like:
I added a log line to figure out what was going on, in backend/open_webui/utils/tools.py:
The result of that log line is shown in the Logs & Screenshots box.
Logs & Screenshots
open_webui.utils.tools:get_tools:157 - Tool spec: {'name': 'get_aws_cost_explorer_data', 'description': "Optional list of dimensions or tags to group by. Example: ['LINKED_ACCOUNT', 'SERVICE', {'TAG': 'Environment'}].", 'parameters': {'properties': {'start_date': {'description': "The start date (inclusive) for the query in 'YYYY-MM-DD' format.", 'type': 'string'}, 'end_date': {'description': "The end date (exclusive) for the query in 'YYYY-MM-DD' format.", 'type': 'string'}, 'granularity': {'default': 'MONTHLY', 'description': "Time granularity for the results ('DAILY', 'MONTHLY'). Default is 'MONTHLY'. You must not get 'MONTHLY' for the current month, as the month is not complete.", 'type': 'string'}, 'accounts': {'default': None, 'description': 'Optional list of AWS account IDs to filter by. Use get_available_accounts() to get account IDs.', 'items': {}, 'type': 'array'}, 'services': {'default': None, 'description': 'Optional list of AWS services to filter by. Use get_available_services() to get service names.', 'items': {}, 'type': 'array'}, 'tags': {'default': None, 'description': "Optional dict of AWS tags to filter by. Example: {'Environment': ['Prod', 'Dev']}.", 'type': 'object'}, 'group_by': {'default': None, 'description': "Optional list of dimensions or tags to group by. Example: ['LINKED_ACCOUNT', 'SERVICE', {'TAG': 'Environment'}].", 'items': {}, 'type': 'array'}}, 'required': ['start_date', 'end_date'], 'type': 'object'}} -
Additional Information
There are no console logs, as they are not relevant; this is a back-end bug - but I can't submit without ticking the box.
@tjbck commented on GitHub (Apr 14, 2025):
I'd recommend you to use the updated convention with pydantic Field, e.g.: