Skip to content

fix(mistral-parser): handle nested JSON in fallback extraction#2335

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-40b195db
Mar 21, 2026
Merged

fix(mistral-parser): handle nested JSON in fallback extraction#2335
teknium1 merged 1 commit intomainfrom
hermes/hermes-40b195db

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Salvage of PR #1755 by @Himess (198 commits behind, cherry-picked cleanly).

The Mistral tool call parser's fallback regex \{.*?\} is non-greedy and stops at the first }, breaking nested JSON arguments like {"nested": {"deep": true}}. Replaced with json.JSONDecoder().raw_decode() which properly handles balanced braces.

Also adds JSON validation for v11+ format args to strip trailing garbage.

7 new tests, 27 total parser tests pass.

@teknium1 teknium1 merged commit fff7203 into main Mar 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants