chat : strip the think block in the qwen3-coder with reasoning_format none (#31380)

* chat : accept the think block in the qwen3-coder response format with reasoning_format none

Assisted-by: Claude Opus 5.5

* chat : define both qwen3-coder think block variants up front
This commit is contained in:
Tarek Dakhran authored and GitHub committed 2026-10-30 22:38:04 -05:00
1 parent 8956c769e8
commit 1052f7e1d6
2 files changed
+37 -4

No files matched your search

+25
View File
@@ -5629,6 +5629,31 @@ static void test_template_output_peg_parsers(bool detailed_debug) {
.expect(message_assist_call_thoughts)
.run();
const std::string answer_schema = R"({"type":"object","properties":{"answer":{"type":"integer"}},"required":["answer"]})";
tst.test("I'm\nthinking</think>{\"answer\":42}")
.enable_thinking(true)
.reasoning_format(COMMON_REASONING_FORMAT_AUTO)
.json_schema(answer_schema)
.expect_reasoning("I'm\nthinking")
.expect_content(R"({"answer":42})")
.run();
// the reasoning block of the generation prompt must still be accepted when it is not extracted
tst.test("{\"answer\":42}")
.enable_thinking(false)
.reasoning_format(COMMON_REASONING_FORMAT_NONE)
.json_schema(answer_schema)
.expect_content(R"({"answer":42})")
.run();
tst.test("I'm\nthinking</think>{\"answer\":42}")
.enable_thinking(true)
.reasoning_format(COMMON_REASONING_FORMAT_NONE)
.json_schema(answer_schema)
.expect_content(R"({"answer":42})")
.run();
// a deferred tool is left out of <tools>, a tool_reference renders it, and its schema types the call
const auto deferred_tools = common_chat_tools_parse_oaicompat(json::parse(R"([
{"type": "function", "function": {"name": "tool_search", "description": "Search for tools",