Skip to content

Fix call ID detection (Mistral parser mostly) + atomicity for tag-json parsers#21230

Merged
pwilkin merged 3 commits intoggml-org:masterfrom
pwilkin:fix-mistral-parser
Apr 3, 2026
Merged

Fix call ID detection (Mistral parser mostly) + atomicity for tag-json parsers#21230
pwilkin merged 3 commits intoggml-org:masterfrom
pwilkin:fix-mistral-parser

Conversation

@pwilkin
Copy link
Copy Markdown
Member

@pwilkin pwilkin commented Mar 31, 2026

Overview

Fix autoparser handling of call ID section detection

Additional information

Should fix handling of old Mistral templates

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: only for refactoring the common function building helper

@alvaroslm
Copy link
Copy Markdown

alvaroslm commented Apr 1, 2026

Tried current master, I saw < /s > still being generated at the end of the content (if i remember correctly that's what broke many things before). Then applied this patch, and it was gone. After that, I loaded the mistral 3.2 small model in Roo code (llama server) and did some tool calls in native mode, it all worked alright. Thanks for the fix!

@pwilkin
Copy link
Copy Markdown
Member Author

pwilkin commented Apr 2, 2026

Bump, as evidenced above this fixes the issue, so would appreciate some reviews :)

common/chat.h Outdated
const std::optional<json> & tools_override = std::nullopt,
const std::optional<json> & additional_context = std::nullopt);

std::optional<common_chat_params> try_specialized_template(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't review the rest, just noticed this function can be named better:

Suggested change
std::optional<common_chat_params> try_specialized_template(
std::optional<common_chat_params> common_chat_try_specialized_template(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed :)

@pwilkin pwilkin force-pushed the fix-mistral-parser branch from c0746e7 to ed9aa13 Compare April 3, 2026 10:54
@pwilkin
Copy link
Copy Markdown
Member Author

pwilkin commented Apr 3, 2026

@aldehir @CISC pretty please? :)

Copy link
Copy Markdown
Member

@CISC CISC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok, final approval left to @aldehir

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>
@pwilkin pwilkin merged commit f1f793a into ggml-org:master Apr 3, 2026
43 of 46 checks passed
icex added a commit to icex/llama.cpp that referenced this pull request Apr 5, 2026
Includes:
- server: Fix undefined timing measurement errors (ggml-org#21201)
- server: save and clear idle slots on new task --clear-idle (ggml-org#20993)
- common: fix tool call type detection for nullable/enum schemas (ggml-org#21327)
- CUDA: fix FA kernel selection logic (ggml-org#21271)
- kv-cache: do not quantize SWA KV cache (ggml-org#21277) + revert (ggml-org#21332)
- common/parser: fix call ID detection + atomicity (ggml-org#21230)
- jinja: coerce input for string-specific filters (ggml-org#21370)
- Various CI, HIP, WebGPU, and documentation fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants