- Notifications
You must be signed in to change notification settings - Fork19.3k
fix(core): accept fenced JSON in tool call arguments#33012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
fix(core): accept fenced JSON in tool call arguments#33012
Conversation
…re strict parsing\n\n- Use parse_json_markdown in parse_tool_call when partial=False (no partial fill)\n- Keep strict json.loads under the hood; incomplete JSON still errors\n- Add unit tests for normal, fenced, and incomplete JSON cases
vercelbot commentedSep 18, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The latest updates on your projects. Learn more aboutVercel for GitHub. |
codspeed-hqbot commentedSep 18, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
CodSpeed Performance ReportMerging#33012 willdegrade performances by 10.96%Comparing
|
Mode | Benchmark | BASE | HEAD | Change | |
---|---|---|---|---|---|
❌ | WallTime | test_import_time[BaseChatModel] | 493.2 ms | 553.8 ms | -10.96% |
❌ | WallTime | test_import_time[ChatPromptTemplate] | 561.2 ms | 626.4 ms | -10.41% |
❌ | WallTime | test_import_time[Runnable] | 460.9 ms | 515.3 ms | -10.55% |
Footnotes
No successful run was found on
master
(c8205ff) during the generation of this report, sod0f5a1c was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.↩21 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase,click here and archive them to remove them from the performance reports.↩
Uh oh!
There was an error while loading.Please reload this page.
Summary
Accept Markdown-fenced JSON in tool call arguments when using with_structured_output. This aligns the structured-output path with the robustness already present in PydanticOutputParser, while keeping strictness for incomplete payloads.
Changes
Rationale
json ...
fences. PydanticOutputParser already tolerates this via parse_json_markdown; with_structured_output should behave similarly so users get consistent parsing across pathways.Testing
Backwards Compatibility