This repository was archived by the owner on May 15, 2026. It is now read-only.
fix: improve error messages for API providers without native tool calling support - #11012
Closed
ghost wants to merge 1 commit into
Closed
fix: improve error messages for API providers without native tool calling support#11012ghost wants to merge 1 commit into
ghost wants to merge 1 commit into
Conversation
…ling support When an API provider (such as OpenAI-compatible proxies like kie.ai) does not properly support native function/tool calling, the model may output XML-formatted tool calls in its text response. The previous error messages were technical and confusing for users. Updated error messages to: - Explain what happened in user-friendly terms - Identify the likely cause (API provider not supporting native tool calling) - Provide actionable guidance Fixes #11011
Author
Review completed. No issues found. The PR cleanly improves error messages to be more user-friendly when API providers don't fully support native function/tool calling. The changes are minimal, well-tested, and accomplish the stated goal. Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
7 tasks
Author
|
Closing in favor of PR #11014, which contains the proper fix with the openAiStrictToolMode setting. This PR (error message improvement) was an intermediate attempt before understanding the root cause. |
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves error messages when an API provider (such as OpenAI-compatible proxies like kie.ai) does not properly support native function/tool calling.
Problem
When using OpenAI-compatible proxies that do not fully support the function calling API, the model may output XML-formatted tool calls in its text response. The previous error messages were confusing for users:
These messages were technical and implied user error when the actual issue is API provider compatibility.
Solution
Updated error messages to be more user-friendly:
XML tool markup detection: "The model is outputting XML-formatted tool calls instead of using native function calling. This typically happens when your API provider does not fully support OpenAI's function/tool calling feature. Please verify that your API provider supports native tool calling, or try using a different provider."
Missing tool call ID: "Invalid tool call: the model's tool call is missing a required ID. This typically happens when your API provider does not fully support OpenAI's function/tool calling feature. Please verify that your API provider supports native tool calling, or try using a different provider."
Changes
presentAssistantMessage.tswith improved error messagesBaseTool.tswith consistent messagingTesting
Fixes #11011