[PR #9907] [MERGED] fix: re-enable tools in native function calls after first invocation #22436

Closed
opened 2026-04-20 04:08:56 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/9907
Author: @smonux
Created: 2/13/2025
Status: Merged
Merged: 2/13/2025
Merged by: @tjbck

Base: devHead: dev


📝 Commits (2)

  • 86074cf fix: re-enable tool use when sending tool output
  • e98f859 format

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 backend/open_webui/utils/middleware.py (+1 -0)

📄 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.
  • 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:

Changelog Entry

Description

When native tool call is enabled, the first call to the completions endpoint contains the "tools" property, but that's not true for the next invocations. This limits native function calling usefulness, and some providers like anthropic endpoint even rejects those invocations.

{"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"{\\"type\\":\\"error\\",\\"error\\":{\\"type\\":\\"invalid_request_error\\",\\"message\\":\\"Requests which include `tool_use` or `tool_result` blocks must define tools.\\"}}","provider_name":"Anthropic"}},"user_id":"user_2jKp3JNlDXqIQgKa69AfEc5AZhq"}

After the one line change, llm are able to

This has been commented in this closed pull request:

https://github.com/open-webui/open-webui/pull/7021


🔄 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/9907 **Author:** [@smonux](https://github.com/smonux) **Created:** 2/13/2025 **Status:** ✅ Merged **Merged:** 2/13/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `dev` --- ### 📝 Commits (2) - [`86074cf`](https://github.com/open-webui/open-webui/commit/86074cff6c5e08d6114a42bfba6ba0db789fdd18) fix: re-enable tool use when sending tool output - [`e98f859`](https://github.com/open-webui/open-webui/commit/e98f859a143df9554bfa84d9524f9a7c3ebcfc34) format ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/middleware.py` (+1 -0) </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. - [ ] **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? - [ ] **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? - [x] **Prefix:** To cleary categorize this pull request, prefix the pull request title, using one of the following: # Changelog Entry ### Description When native tool call is enabled, the first call to the completions endpoint contains the "tools" property, but that's not true for the next invocations. This limits native function calling usefulness, and some providers like anthropic endpoint even rejects those invocations. ``` {"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"{\\"type\\":\\"error\\",\\"error\\":{\\"type\\":\\"invalid_request_error\\",\\"message\\":\\"Requests which include `tool_use` or `tool_result` blocks must define tools.\\"}}","provider_name":"Anthropic"}},"user_id":"user_2jKp3JNlDXqIQgKa69AfEc5AZhq"} ``` After the one line change, llm are able to This has been commented in this closed pull request: https://github.com/open-webui/open-webui/pull/7021 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 04:08:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#22436