Screenshots/Screen Recordings (if applicable):
not applicable
Additional Information
Sorry to disturb again.
Seems like the tools field isn't populated.
This time I don't have a solution yet, but I will try to address.
I let you know ;-)
Originally created by @Seniorsimo on GitHub (Feb 10, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/9773
# Bug Report
## Installation Method
Docker
## Environment
- **Open WebUI Version:** v0.5.10
- **Ollama (if applicable):** 0.5.7-0-ga420a45-dirty
- **Operating System:** Windows 11
**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.
- [x] 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:
When a model should generate a tool call, it should generate it
- if called with stream: true
- if called with stream: false
## Actual Behavior:
When called with stream: false, no tool call and an empty response is generated as if the tool data isn't added.
## Description
Tool call in API when stream is false seems not working and the response is empty
## Reproduction Details
*Stream true*
Request
```bash
curl -XPOST -H 'Authorization: Bearer sk-YOUR-API-KEY' -H "Content-type: application/json" -d '{
"messages": [
{
"content": "You are a helpful assistant",
"role": "system"
}, {
"content": "It feels so cold today in NY.",
"role": "user"
}
],
"model": "pc.qwen2.5:14b",
"n": 1,
"stream": true,
"temperature": 0.7,
"tools": [
{
"type": "function",
"function": {
"name": "weather",
"description": "Retrieve the weather for a city.",
"parameters": {
"properties": {
"city": {
"description": "The city to inspect current weather",
"type": "string"
}
},
"required": ["city"],
"type": "object"
}
}
}
]
}' 'http://localhost:8080/api/chat/completions'
```
Response
```json
{
"id": "qwen2.5:14b-92f77e7e-baa5-454a-aa84-4a8647ef3044",
"created": 1739210359,
"model": "qwen2.5:14b",
"choices": [
{
"index": 0,
"logprobs": null,
"finish_reason": null,
"delta": {
"tool_calls": [
{
"index": 0,
"id": "call_df2ee15e-e8ee-4709-b179-e0f2df19fa91",
"type": "function",
"function": {
"name": "weather",
"arguments": "{\"city\":\"New York\"}"
}
}
]
}
}
],
"object": "chat.completion.chunk"
}
```
*Stream false*
Request
```bash
curl -XPOST -H 'Authorization: Bearer sk-YOUR-API-KEY' -H "Content-type: application/json" -d '{
"messages": [
{
"content": "You are a helpful assistant",
"role": "system"
}, {
"content": "It feels so cold today in NY.",
"role": "user"
}
],
"model": "pc.qwen2.5:14b",
"n": 1,
"stream": false,
"temperature": 0.7,
"tools": [
{
"type": "function",
"function": {
"name": "weather",
"description": "Retrieve the weather for a city.",
"parameters": {
"properties": {
"city": {
"description": "The city to inspect current weather",
"type": "string"
}
},
"required": ["city"],
"type": "object"
}
}
}
]
}' 'http://localhost:8080/api/chat/completions'
```
Response
```json
{
"id":"qwen2.5:14b-a7679dcc-3f1e-48cd-9e13-8d170943b44a",
"created":1739219565,
"model":"qwen2.5:14b",
"choices":[
{
"index":0,
"logprobs":null,
"finish_reason":"stop",
"message":{
"content":"",
"role":"assistant"
}
}
],
"object":"chat.completion",
"usage":{
"response_token/s":47.56,
"prompt_token/s":19500.0,
"total_duration":802440073,
"load_duration":10723211,
"prompt_eval_count":156,
"prompt_eval_duration":8000000,
"eval_count":37,
"eval_duration":778000000,
"approximate_total":"0h0m0s"
}
}
```
## Logs and Screenshots
**Browser Console Logs:**
not applicable
**Docker Container Logs:**
INFO: 10.88.5.1:0 - "POST /api/chat/completions HTTP/1.1" 200 OK
**Screenshots/Screen Recordings (if applicable):**
not applicable
## Additional Information
Sorry to disturb again.
Seems like the tools field isn't populated.
This time I don't have a solution yet, but I will try to address.
I let you know ;-)
Enought for today Great work yours!!! Open WebUI is becaming a great success!!
<!-- gh-comment-id:2649273043 -->
@Seniorsimo commented on GitHub (Feb 10, 2025):
Yeee! Easier than expected!
This should solve the problem:
https://github.com/open-webui/open-webui/commit/ba66d586c7d9541b56c625e56c81d231116987f4
I've just moved the tool part outside the 2 function to not copy it.
Tested now and seems working with stream false as well as with stream true
Response with stream false
```json
{
"id":"qwen2.5:14b-7b5ec4b5-32c5-4f9e-ad85-f23dfd55ae6d",
"created":1739222142,
"model":"qwen2.5:14b",
"choices":[
{
"index":0,
"logprobs":null,
"finish_reason":"stop",
"message":{
"content":"",
"role":"assistant"
},
"tool_calls":[
{
"index":0,
"id":"call_6fb45e1a-7999-4fde-8fa9-4a83cd8512b5",
"type":"function",
"function":{
"name":"weather",
"arguments":"{\"city\": \"New York\"}"
}
}
]
}
],
"object":"chat.completion",
"usage":{
"response_token/s":47.56,
"prompt_token/s":19500.0,
"total_duration":802440073,
"load_duration":10723211,
"prompt_eval_count":156,
"prompt_eval_duration":8000000,
"eval_count":37,
"eval_duration":778000000,
"approximate_total":"0h0m0s"
}
}
```
Enought for today Great work yours!!! Open WebUI is becaming a great success!!
@taylorwilsdon commented on GitHub (Feb 11, 2025):
This is interesting, I'm not seeing it necessarily tied to stream false but am seeing this behavior introduced in v0.5.10 where tools are seemingly executing but disregarding the response unless I prompt it explicitly to await RAG response (tool in question fires a retrieval call and adds the response documents as citations)
<!-- gh-comment-id:2651337457 -->
@taylorwilsdon commented on GitHub (Feb 11, 2025):
This is interesting, I'm not seeing it necessarily tied to stream false but am seeing this behavior introduced in v0.5.10 where tools are seemingly executing but disregarding the response unless I prompt it explicitly to await RAG response (tool in question fires a retrieval call and adds the response documents as citations)
@taylorwilsdon commented on GitHub (Feb 11, 2025):
My symptoms look like:
"Await the rag response" fixes it ->
In both cases, the middleware is firing - open_webui.utils.middleware] tools={'fetch_rag_context
But in the former, the tool doesn't appear to fire the call and nothing is ever actually retrieved, the model answers immediately with the wrong information
<!-- gh-comment-id:2651344249 -->
@taylorwilsdon commented on GitHub (Feb 11, 2025):
My symptoms look like:

"Await the rag response" fixes it ->

In both cases, the middleware is firing - `open_webui.utils.middleware] tools={'fetch_rag_context`
But in the former, the tool doesn't appear to fire the call and nothing is ever actually retrieved, the model answers immediately with the wrong information
Interesting indeed!
Maybe the same api code is invoked?
If you can, you can try the fix I posted and tell us if it solves also in your case.
From what i saw yesterday, for me seems simply the tools not being copied to the response
<!-- gh-comment-id:2651349294 -->
@Seniorsimo commented on GitHub (Feb 11, 2025):
Interesting indeed!
Maybe the same api code is invoked?
If you can, you can try the fix I posted and tell us if it solves also in your case.
From what i saw yesterday, for me seems simply the tools not being copied to the response
@taylorwilsdon commented on GitHub (Feb 11, 2025):
It seems to be introduced between v0.5.7 and v0.5.10 with changes to backend/open_webui/utils/middleware.py - seems like the native tool calling support and code interpreter logic introduced some significant changes to middleware.py that are resulting in inconsistent tool execution for me where previously the tool would always fire and fully complete before any response was generated by the underlying model: https://github.com/open-webui/open-webui/compare/v0.5.7...v0.5.10
Edit - another breadcrumb, if I force function calling to "Native" it is now working much more reliably. Interesting... seems a little faster too, but still worth fixing because it'll be confusing to users
<!-- gh-comment-id:2651371659 -->
@taylorwilsdon commented on GitHub (Feb 11, 2025):
It seems to be introduced between v0.5.7 and v0.5.10 with changes to `backend/open_webui/utils/middleware.py` - seems like the native tool calling support and code interpreter logic introduced some significant changes to middleware.py that are resulting in inconsistent tool execution for me where previously the tool would always fire and fully complete before any response was generated by the underlying model:
https://github.com/open-webui/open-webui/compare/v0.5.7...v0.5.10
Edit - another breadcrumb, if I force function calling to "Native" it is now working much more reliably. Interesting... seems a little faster too, but still worth fixing because it'll be confusing to users
I was searching the diff between v0.5.7 and v0.5.10, can't say for sure after a fast look, but for me they look like 2 separate bug.
some logic change in the middleware.py that cause inconsistency with tool calls in the UI
the missing tools field in response.py that cause no tools beign returned in API when invoked with stream=false
<!-- gh-comment-id:2651511103 -->
@Seniorsimo commented on GitHub (Feb 11, 2025):
I was searching the diff between v0.5.7 and v0.5.10, can't say for sure after a fast look, but for me they look like 2 separate bug.
- some logic change in the middleware.py that cause inconsistency with tool calls in the UI
- the missing `tools` field in response.py that cause no tools beign returned in API when invoked with stream=false
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 @Seniorsimo on GitHub (Feb 10, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/9773
Bug Report
Installation Method
Docker
Environment
Open WebUI Version: v0.5.10
Ollama (if applicable): 0.5.7-0-ga420a45-dirty
Operating System: Windows 11
Confirmation:
Expected Behavior:
When a model should generate a tool call, it should generate it
Actual Behavior:
When called with stream: false, no tool call and an empty response is generated as if the tool data isn't added.
Description
Tool call in API when stream is false seems not working and the response is empty
Reproduction Details
Stream true
Request
Response
Stream false
Request
Response
Logs and Screenshots
Browser Console Logs:
not applicable
Docker Container Logs:
INFO: 10.88.5.1:0 - "POST /api/chat/completions HTTP/1.1" 200 OK
Screenshots/Screen Recordings (if applicable):
not applicable
Additional Information
Sorry to disturb again.
Seems like the tools field isn't populated.
This time I don't have a solution yet, but I will try to address.
I let you know ;-)
@Seniorsimo commented on GitHub (Feb 10, 2025):
Yeee! Easier than expected!
This should solve the problem:
https://github.com/open-webui/open-webui/commit/ba66d586c7d9541b56c625e56c81d231116987f4
I've just moved the tool part outside the 2 function to not copy it.
Tested now and seems working with stream false as well as with stream true
Response with stream false
Enought for today Great work yours!!! Open WebUI is becaming a great success!!
@taylorwilsdon commented on GitHub (Feb 11, 2025):
This is interesting, I'm not seeing it necessarily tied to stream false but am seeing this behavior introduced in v0.5.10 where tools are seemingly executing but disregarding the response unless I prompt it explicitly to await RAG response (tool in question fires a retrieval call and adds the response documents as citations)
@taylorwilsdon commented on GitHub (Feb 11, 2025):
My symptoms look like:
"Await the rag response" fixes it ->
In both cases, the middleware is firing -
open_webui.utils.middleware] tools={'fetch_rag_contextBut in the former, the tool doesn't appear to fire the call and nothing is ever actually retrieved, the model answers immediately with the wrong information
@Seniorsimo commented on GitHub (Feb 11, 2025):
Interesting indeed!
Maybe the same api code is invoked?
If you can, you can try the fix I posted and tell us if it solves also in your case.
From what i saw yesterday, for me seems simply the tools not being copied to the response
@taylorwilsdon commented on GitHub (Feb 11, 2025):
It seems to be introduced between v0.5.7 and v0.5.10 with changes to
backend/open_webui/utils/middleware.py- seems like the native tool calling support and code interpreter logic introduced some significant changes to middleware.py that are resulting in inconsistent tool execution for me where previously the tool would always fire and fully complete before any response was generated by the underlying model:https://github.com/open-webui/open-webui/compare/v0.5.7...v0.5.10
Edit - another breadcrumb, if I force function calling to "Native" it is now working much more reliably. Interesting... seems a little faster too, but still worth fixing because it'll be confusing to users
@Seniorsimo commented on GitHub (Feb 11, 2025):
I was searching the diff between v0.5.7 and v0.5.10, can't say for sure after a fast look, but for me they look like 2 separate bug.
toolsfield in response.py that cause no tools beign returned in API when invoked with stream=false@tjbck commented on GitHub (Feb 12, 2025):
@Seniorsimo PR welcome!
@Seniorsimo commented on GitHub (Feb 12, 2025):
Here it is