Skip to content

[Cherry-Pick][Optimization]Fix tool parser (#7079)#7167

Merged
luukunn merged 1 commit intoPaddlePaddle:release/2.5from
luukunn:fix_tool_parser_2.5
Apr 3, 2026
Merged

[Cherry-Pick][Optimization]Fix tool parser (#7079)#7167
luukunn merged 1 commit intoPaddlePaddle:release/2.5from
luukunn:fix_tool_parser_2.5

Conversation

@luukunn
Copy link
Copy Markdown
Collaborator

@luukunn luukunn commented Apr 2, 2026

Motivation

💡 If this PR is a Cherry Pick, the PR title needs to follow the format by adding the [Cherry-Pick] label at the very beginning and appending the original PR ID at the end. For example, [Cherry-Pick][CI] Add check trigger and logic(#5191)

💡 如若此PR是Cherry Pick,PR标题需遵循格式,在最开始加上[Cherry-Pick]标签,以及最后面加上原PR ID,例如[Cherry-Pick][CI] Add check trigger and logic(#5191)

Modifications

Usage or Command

Accuracy Tests

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[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]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

Copilot AI review requested due to automatic review settings April 2, 2026 13:25
@paddle-bot
Copy link
Copy Markdown

paddle-bot bot commented Apr 2, 2026

Thanks for your contribution!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 93.47826% with 9 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/2.5@242ed02). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...points/openai/tool_parsers/ernie_x1_tool_parser.py 93.47% 5 Missing and 4 partials ⚠️
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           
Flag Coverage Δ
GPU 69.15% <93.47%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@luukunn luukunn merged commit 1f29389 into PaddlePaddle:release/2.5 Apr 3, 2026
54 of 59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants