Skip to content

[Optimization]Fix tool parser#7079

Open
luukunn wants to merge 3 commits intoPaddlePaddle:developfrom
luukunn:fix_tool_parser
Open

[Optimization]Fix tool parser#7079
luukunn wants to merge 3 commits intoPaddlePaddle:developfrom
luukunn:fix_tool_parser

Conversation

@luukunn
Copy link
Copy Markdown
Collaborator

@luukunn luukunn commented Mar 30, 2026

Motivation

修复tool_parser中过滤\n或者空格的问题

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 March 30, 2026 09:06
@paddle-bot
Copy link
Copy Markdown

paddle-bot bot commented Mar 30, 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 旨在修复/重构 OpenAI entrypoint 下 Ernie 工具调用(tool_call)解析逻辑,重点调整 ernie-x1 的非流式与流式解析实现,并同步改动了 ernie-45-vl-thinking 的流式处理细节。

Changes:

  • 重写 ErnieX1ToolParser.extract_tool_calls():改为基于正则提取并直接 json.loads
  • 重写 ErnieX1ToolParser.extract_tool_calls_streaming():调整流式解析与增量输出逻辑、日志接口。
  • 移除 ernie-x1 的单测文件;并在 ernie_45_vl_thinking 流式解析中删除“空 chunk 跳过”逻辑。

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
tests/entrypoints/openai/tool_parsers/test_ernie_x1_tool_parser.py 删除了 Ernie X1 tool parser 的单元测试覆盖。
fastdeploy/entrypoints/openai/tool_parsers/ernie_x1_tool_parser.py 大幅改动非流式/流式 tool_call 解析实现与返回结构。
fastdeploy/entrypoints/openai/tool_parsers/ernie_45_vl_thinking_tool_parser.py 流式解析逻辑中不再跳过空 delta chunk。

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 93.18182% with 9 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@76cf5e9). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...points/openai/tool_parsers/ernie_x1_tool_parser.py 93.18% 5 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #7079   +/-   ##
==========================================
  Coverage           ?   73.15%           
==========================================
  Files              ?      402           
  Lines              ?    56421           
  Branches           ?     8894           
==========================================
  Hits               ?    41273           
  Misses             ?    12250           
  Partials           ?     2898           
Flag Coverage Δ
GPU 73.15% <93.18%> (?)

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 changed the title Fix tool parser [Optimization]Fix tool parser Mar 31, 2026
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.

3 participants