mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #23515] [CLOSED] fix: native function calling for REST API consumers #66086
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/23515
Author: @PedroFCM
Created: 4/8/2026
Status: ❌ Closed
Base:
dev← Head:fix/native-tool-calling-api-loop📝 Commits (1)
9f97b21fix: native function calling for REST API consumers📊 Changes
1 file changed (+59 additions, -6 deletions)
View changed files
📝
backend/open_webui/main.py(+59 -6)📄 Description
Two fixes for native function calling, especially for REST API consumers that bypass the frontend WebSocket session:
Pass through the
function_callingvalue as-is instead of only checking for'native'and falling back to'default'. This respects values set viaDEFAULT_MODEL_PARAMSor per-model params.Add server-side tool-calling loop for API calls (no
session_id). The native tool execution loop is driven by the frontend via WebSocket. REST API calls never enter that loop, sotool_callsare returned raw and tools are never executed. This adds a loop that executes tools and re-invokes the LLM untilfinish_reason != 'tool_calls'orCHAT_RESPONSE_MAX_TOOL_CALL_RETRIESis reached.Ref: #9435
Pull Request Checklist
devCHAT_RESPONSE_MAX_TOOL_CALL_RETRIESCHAT_RESPONSE_MAX_TOOL_CALL_RETRIESdevfix:Changelog Entry
Description
/api/chat/completions) that don't use a WebSocket sessionFixed
function_callingparameter now passes through the configured value instead of only recognizing'native'and falling back to'default'Breaking Changes
function_calling: nativeand tools — these previously returned rawtool_callswithout execution.Additional Information
session_id(REST API),function_calling == 'native', and tools are present in metadataCHAT_RESPONSE_MAX_TOOL_CALL_RETRIESsettingContributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.