[Cherry-Pick][Optimization]Fix tool parser (#7079)#7167
Merged
luukunn merged 1 commit intoPaddlePaddle:release/2.5from Apr 3, 2026
Merged
[Cherry-Pick][Optimization]Fix tool parser (#7079)#7167luukunn merged 1 commit intoPaddlePaddle:release/2.5from
luukunn merged 1 commit intoPaddlePaddle:release/2.5from
Conversation
|
Thanks for your contribution! |
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 作为 cherry-pick,主要调整 OpenAI entrypoint 下 Ernie X1 的 tool parser 解析逻辑(包含非流式与流式),并显著补充单元测试覆盖;同时对 Ernie 4.5 VL thinking 的流式解析移除“空 chunk 跳过”逻辑。
Changes:
- 重写
ErnieX1ToolParser.extract_tool_calls:改为正则提取<tool_call>...</tool_call>并用json.loads解析。 - 重写
ErnieX1ToolParser.extract_tool_calls_streaming:引入基于计数与partial_json_parser的流式增量解析逻辑。 - 扩充
test_ernie_x1_tool_parser.py:新增大量分支/集成场景用例;并在ernie_45_vl_thinking_tool_parser.py移除空 delta 的 early-return。
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| fastdeploy/entrypoints/openai/tool_parsers/ernie_x1_tool_parser.py | 调整 Ernie X1 tool call 的非流式与流式解析实现、日志与依赖导入 |
| tests/entrypoints/openai/tool_parsers/test_ernie_x1_tool_parser.py | 新增/重构 Ernie X1 tool parser 的单测覆盖,包含大量 streaming 分支用例 |
| fastdeploy/entrypoints/openai/tool_parsers/ernie_45_vl_thinking_tool_parser.py | 流式解析不再跳过空白 delta chunk |
Jiang-Jia-Jun
approved these changes
Apr 2, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/2.5 #7167 +/- ##
==============================================
Coverage ? 69.15%
==============================================
Files ? 390
Lines ? 54224
Branches ? 8546
==============================================
Hits ? 37496
Misses ? 14033
Partials ? 2695
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Motivation
Modifications
Usage or Command
Accuracy Tests
Checklist
[FDConfig],[APIServer],[Engine],[Scheduler],[PD Disaggregation],[Executor],[Graph Optimization],[Speculative Decoding],[RL],[Models],[Quantization],[Loader],[OP],[KVCache],[DataProcessor],[BugFix],[Docs],[CI],[Optimization],[Feature],[Benchmark],[Others],[XPU],[HPU],[GCU],[DCU],[Iluvatar],[Metax]]pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.