Skip to content

feat: 支持通过 GenerateOptions 按轮次动态控制 enableThinking#1494

Open
Janemia wants to merge 2 commits into
agentscope-ai:mainfrom
Janemia:feat/enable-thinking-per-request
Open

feat: 支持通过 GenerateOptions 按轮次动态控制 enableThinking#1494
Janemia wants to merge 2 commits into
agentscope-ai:mainfrom
Janemia:feat/enable-thinking-per-request

Conversation

@Janemia
Copy link
Copy Markdown

@Janemia Janemia commented May 26, 2026

改动说明

GenerateOptions 新增 enableThinking 字段,使 Hook 能够按轮次动态控制 enable_thinking(此前只能控制 thinking_budget)。

修改内容

  • GenerateOptions:新增 enableThinking 字段、getter、Builder 方法及 mergeOptions 合并逻辑
  • DashScopeChatModel.applyThinkingMode():优先取 options 级别的值,未设置时 fallback 到模型级别的固定值

向后兼容

完全向后兼容。当 options.getEnableThinking() 为 null 时,行为与改造前一致,使用模型级别的 this.enableThinking

Add enableThinking field to GenerateOptions so that hooks can dynamically
control enable_thinking on a per-turn basis, not just thinking_budget.

DashScopeChatModel.applyThinkingMode() now prioritizes the options-level
value over the model-level fixed value, with full backward compatibility.
@Janemia Janemia requested a review from a team May 26, 2026 04:18
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


mingshu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

❌ Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...a/io/agentscope/core/model/DashScopeChatModel.java 71.42% 1 Missing and 1 partial ⚠️
...java/io/agentscope/core/model/GenerateOptions.java 83.33% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@LearningGp
Copy link
Copy Markdown
Collaborator

image

@AgentScopeJavaBot AgentScopeJavaBot added enhancement New feature or request area/core/model Model providers and formatters labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core/model Model providers and formatters enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants