Skip to content

[Cherry-Pick]Allows tools and content to coexist.(#6656)#6996

Merged
Jiang-Jia-Jun merged 2 commits intoPaddlePaddle:release/2.4from
luukunn:2.4
Mar 25, 2026
Merged

[Cherry-Pick]Allows tools and content to coexist.(#6656)#6996
Jiang-Jia-Jun merged 2 commits intoPaddlePaddle:release/2.4from
luukunn:2.4

Conversation

@luukunn
Copy link
Collaborator

@luukunn luukunn commented Mar 24, 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 March 24, 2026 13:11
@paddle-bot
Copy link

paddle-bot bot commented Mar 24, 2026

Thanks for your contribution!

Copy link
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 旨在调整文本后处理逻辑:当解析到 tool_calls 时,不再用工具解析结果覆盖原有 text 字段,以便在同一次回复中同时返回自然语言内容与工具调用信息(更贴近 OpenAI “content + tool_calls 可共存”的语义)。

Changes:

  • process_response() 中,检测到 tool_calls 时不再覆盖 response_dict.outputs.text
  • process_response_dict_normal() 中,检测到 tool_calls 时不再覆盖 response_dict["outputs"]["text"]

Comment on lines 402 to 406
if self.tool_parser_obj:
tool_parser = self.tool_parser_obj(self.tokenizer)
tool_call_info = tool_parser.extract_tool_calls(full_text, response_dict)
if tool_call_info.tools_called:
response_dict.outputs.tool_calls = tool_call_info.tool_calls
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

当前 DataProcessor 在检测到 tool_calls 时不再用 tool_call_info.content 覆盖 text;但 fastdeploy/input/ernie4_5_processor.py 仍会覆盖 text(会导致 tool_calls + 文本共存行为在不同 processor 间不一致)。如果这是一个全局语义变更,建议同步修改 Ernie4_5Processor,或在此处说明仅适用于 text_processor 的原因。

Copilot uses AI. Check for mistakes.
Comment on lines 404 to 406
tool_call_info = tool_parser.extract_tool_calls(full_text, response_dict)
if tool_call_info.tools_called:
response_dict.outputs.tool_calls = tool_call_info.tool_calls
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

PR 标题未完全符合仓库 Cherry-Pick 规范:除了开头的 [Cherry-Pick] 外,通常还需要至少一个语义标签(如 [BugFix]/[Feature]/[APIServer] 等),并将原始 PR 号以 "(#6656)" 形式附在标题末尾。建议按模板示例调整标题格式以通过 CI 校验。

Copilot uses AI. Check for mistakes.
Comment on lines 441 to 444
tool_parser = self.tool_parser_obj(self.tokenizer)
tool_call_info = tool_parser.extract_tool_calls(full_text, response_dict)
if tool_call_info.tools_called:
response_dict["outputs"]["tool_calls"] = tool_call_info.tool_calls
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

PR 描述目前仍是模板占位(Motivation/Modifications/Usage/Tests 未填写)。建议补充:为何需要允许 tool_calls 与 content 共存、影响哪些模型/接口、以及是否做过回归或对齐 OpenAI tool_calls 行为的测试。

Copilot uses AI. Check for mistakes.
@luukunn luukunn changed the title [Cherry-Pick]Allows tools and content to coexist.#6656 [Cherry-Pick]Allows tools and content to coexist.(#6656) Mar 24, 2026
@codecov-commenter
Copy link

codecov-commenter commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release/2.4@4516c58). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff               @@
##             release/2.4    #6996   +/-   ##
==============================================
  Coverage               ?   56.03%           
==============================================
  Files                  ?      333           
  Lines                  ?    42570           
  Branches               ?     6483           
==============================================
  Hits                   ?    23855           
  Misses                 ?    16831           
  Partials               ?     1884           
Flag Coverage Δ
GPU 56.03% <ø> (?)

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.

@Jiang-Jia-Jun Jiang-Jia-Jun merged commit f35f0c1 into PaddlePaddle:release/2.4 Mar 25, 2026
15 of 19 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