Closed
Conversation
When using Qwen3-coder model through Ollama with many tools (6+), the model outputs XML-style tool calls in the content field instead of using the native JSON tool_calls format. This causes Goose to fail to execute any tools. This commit adds XML parsing as a fallback mechanism: - Add parse_xml_tool_calls() helper function using regex to parse <function=name><parameter=key>value</parameter></function> format - Modify response_to_message() to check for XML tool calls when no JSON tool_calls are found in the response - Modify response_to_streaming_message() to accumulate text and parse XML tool calls when stream completes - Add comprehensive unit tests for XML parsing The fix is backward-compatible and only activates when JSON tool_calls are absent, ensuring existing providers continue to work normally. Tested with Qwen3-coder:latest via Ollama with 11 developer tools. Signed-off-by: Krispy <krispy@emergentbit.com>
…o/goose into kuccello-fix/qwen3-coder-xml-tool-parsing * 'fix/qwen3-coder-xml-tool-parsing' of github.com:kuccello/goose: fix: add XML tool call parsing fallback for Qwen3-coder via Ollama
10 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
pushing here to check it passes live tests