Skip to content

feat: add reasoning_effort configuration support for Doubao/GPT-5 models#947

Open
zhiyunyao wants to merge 4 commits intobytedance:mainfrom
zhiyunyao:feat/reasoning_effort
Open

feat: add reasoning_effort configuration support for Doubao/GPT-5 models#947
zhiyunyao wants to merge 4 commits intobytedance:mainfrom
zhiyunyao:feat/reasoning_effort

Conversation

@zhiyunyao
Copy link
Contributor

Overview

This PR adds comprehensive support for reasoning effort configuration across the DeerFlow agent system, enabling models that support variable reasoning depths to expose this capability to users.

image

Key Changes

Backend

  • Extended ModelConfig with supports_reasoning_effort flag to declare model capability
  • Updated create_chat_model() to pass reasoning_effort parameter to LLM providers
  • Added reasoning effort to agent initialization and logging in lead agent
  • Updated API endpoints /api/models and /api/models/{model_name} to include reasoning effort capability in model metadata
  • Fixed UTF-8 encoding in file loading (app_config.py & extensions_config.py)
  • Cleaned up unused imports in reflection module (resolvers.py)

Frontend

  • New reasoning effort selector in the input box with 4 interactive levels:
    • Minimal: Retrieval + Direct Output
    • Low: Simple Logic Check + Shallow Deduction
    • Medium: Multi-layer Logic Analysis + Basic Verification (default)
    • High: Full-dimensional Logic Deduction + Multi-path Verification + Backward Check
  • Integrated with existing mode selector (automatic defaults based on selected mode)
  • Conditional display: only visible when model supports reasoning effort and mode is not "flash"
  • Passed through thread context to backend via reasoning_effort field

Configuration

  • Updated example config with Doubao model (doubao-seed-1.8) supporting reasoning effort
  • Model configurations can now declare supports_reasoning_effort: true to enable the feature
* Add `reasoning_effort` parameter to model config and agent initialization
* Support reasoning effort levels (minimal/low/medium/high) for Doubao/GPT-5 models
* Add UI controls in input box for reasoning effort selection
* Update doubao-seed-1.8 example config with reasoning effort support

Fixes & Cleanup:
* Ensure UTF-8 encoding for file operations
* Remove unused imports
@WillemJiang
Copy link
Collaborator

@zhiyunyao, please fix the test error that was introduced by the change of reasoning effort.

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

Adds end-to-end “reasoning effort” capability metadata and UI controls so users can select reasoning depth for models that support it (e.g., Doubao/GPT-5-class models), and propagates that setting through agent initialization and model creation.

Changes:

  • Extend model metadata (backend + frontend types + /api/models) with supports_reasoning_effort.
  • Add frontend reasoning-effort selector and pass reasoning_effort via thread context.
  • Wire backend agent/model factory to accept and forward reasoning_effort, plus small config/encoding cleanup.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/core/threads/types.ts Adds reasoning_effort to thread context typing.
frontend/src/core/settings/local.ts Persists reasoning_effort in local settings context.
frontend/src/core/models/types.ts Adds supports_reasoning_effort to model metadata typing.
frontend/src/core/i18n/locales/zh-CN.ts Adds zh-CN strings for reasoning effort UI.
frontend/src/core/i18n/locales/en-US.ts Adds en-US strings for reasoning effort UI.
frontend/src/core/i18n/locales/types.ts Extends translation type to include reasoning effort keys.
frontend/src/components/workspace/messages/message-list.tsx Refactors MessageList to take messages explicitly.
frontend/src/components/workspace/input-box.tsx Adds reasoning effort selector UI and mode-driven defaults.
frontend/src/app/workspace/chats/[thread_id]/page.tsx Passes reasoning_effort through threadContext; updates MessageList usage.
config.example.yaml Updates example model config to include Doubao + supports_reasoning_effort.
backend/src/reflection/resolvers.py Removes unused TypeVar (keeps PEP 695 generics).
backend/src/models/factory.py Attempts to inject/strip reasoning_effort and disable thinking via extra_body.
backend/src/gateway/routers/models.py Exposes supports_reasoning_effort in model API responses.
backend/src/config/model_config.py Adds supports_reasoning_effort to model config schema.
backend/src/config/extensions_config.py Ensures UTF-8 when reading extensions config JSON.
backend/src/config/app_config.py Ensures UTF-8 when reading YAML config.
backend/src/client.py Includes supports_reasoning_effort in client model listings.
backend/src/agents/lead_agent/agent.py Reads reasoning_effort from runnable config, logs it, passes to model factory.
.gitignore Ignores .vscode/.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

zhiyunyao and others added 2 commits March 2, 2026 11:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants