Before submitting, make sure you've checked the following:
Target branch: Please verify that the pull request targets the dev branch.
Description: Provide a concise description of the changes made in this pull request.
Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
Testing: Have you written and run sufficient tests for validating the changes?
Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
Prefix: To cleary categorize this pull request, prefix the pull request title, using one of the following:
BREAKING CHANGE: Significant changes that may affect compatibility
build: Changes that affect the build system or external dependencies
ci: Changes to our continuous integration processes or workflows
chore: Refactor, cleanup, or other non-functional code changes
docs: Documentation update or addition
feat: Introduces a new feature or enhancement to the codebase
fix: Bug fix or error correction
i18n: Internationalization or localization changes
perf: Performance improvement
refactor: Code restructuring for better maintainability, readability, or scalability
style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
test: Adding missing tests or correcting existing tests
WIP: Work in progress, a temporary label for incomplete or ongoing work
Changelog Entry
Description
Added support for tools on /api/chat/completions when strem=false
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/9844
**Author:** [@Seniorsimo](https://github.com/Seniorsimo)
**Created:** 2/12/2025
**Status:** ✅ Merged
**Merged:** 2/13/2025
**Merged by:** [@tjbck](https://github.com/tjbck)
**Base:** `dev` ← **Head:** `bug-9773`
---
### 📝 Commits (2)
- [`7dc000a`](https://github.com/open-webui/open-webui/commit/7dc000a6b9c3641227872516cec313aa30490666) added support for API tool_calls if stream false
- [`b0ade6c`](https://github.com/open-webui/open-webui/commit/b0ade6c04c2b52f97c8c80990e923ad8353f038e) Fixed typo
### 📊 Changes
**2 files changed** (+32 additions, -16 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/utils/misc.py` (+8 -1)
📝 `backend/open_webui/utils/response.py` (+24 -15)
</details>
### 📄 Description
# Pull Request Checklist
**Before submitting, make sure you've checked the following:**
- [x] **Target branch:** Please verify that the pull request targets the `dev` branch.
- [x] **Description:** Provide a concise description of the changes made in this pull request.
- [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description.
- [ ] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources?
- [ ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation?
- [x] **Testing:** Have you written and run sufficient tests for validating the changes?
- [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
- [x] **Prefix:** To cleary categorize this pull request, prefix the pull request title, using one of the following:
- **BREAKING CHANGE**: Significant changes that may affect compatibility
- **build**: Changes that affect the build system or external dependencies
- **ci**: Changes to our continuous integration processes or workflows
- **chore**: Refactor, cleanup, or other non-functional code changes
- **docs**: Documentation update or addition
- **feat**: Introduces a new feature or enhancement to the codebase
- **fix**: Bug fix or error correction
- **i18n**: Internationalization or localization changes
- **perf**: Performance improvement
- **refactor**: Code restructuring for better maintainability, readability, or scalability
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
- **test**: Adding missing tests or correcting existing tests
- **WIP**: Work in progress, a temporary label for incomplete or ongoing work
# Changelog Entry
### Description
Added support for tools on `/api/chat/completions` when `strem=false`
Linked bug report: #9773
### Fixed
- Tool now gets returned in API also when stream false is used
---
Respose when `/api/chat/completions` is called with stream false
Before the fix
```json
{
"id":"qwen2.5:14b-8c6293f1-0647-49c0-ab5c-f6ebc89acdf5",
"created":1739210213,
"model":"qwen2.5:14b",
"choices":[
{
"index":0,
"logprobs":null,
"finish_reason":"stop",
"message":{
"content":"",
"role":"assistant"
}
}
],
"object":"chat.completion",
"usage":{
"response_token/s":66.43,
"prompt_token/s":1114.29,
"total_duration":3083735297,
"load_duration":2018708373,
"prompt_eval_count":156,
"prompt_eval_duration":140000000,
"eval_count":38,
"eval_duration":572000000,
"approximate_total":"0h0m3s"
}
}
```
After the fix
```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"
}
}
```
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/9844
Author: @Seniorsimo
Created: 2/12/2025
Status: ✅ Merged
Merged: 2/13/2025
Merged by: @tjbck
Base:
dev← Head:bug-9773📝 Commits (2)
7dc000aadded support for API tool_calls if stream falseb0ade6cFixed typo📊 Changes
2 files changed (+32 additions, -16 deletions)
View changed files
📝
backend/open_webui/utils/misc.py(+8 -1)📝
backend/open_webui/utils/response.py(+24 -15)📄 Description
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
Added support for tools on
/api/chat/completionswhenstrem=falseLinked bug report: #9773
Fixed
Respose when
/api/chat/completionsis called with stream falseBefore the fix
After the fix
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.