Commit Graph

10 Commits

  • fix(thinking): align budget effort mapping across translators
    Unify thinking budget-to-effort conversion in a shared helper, handle disabled/default thinking cases in translators, adjust zero-budget mapping, and drop the old OpenAI-specific helper with updated tests.
  • fix(thinking): map budgets to effort levels
    Ensure thinking settings translate correctly across providers:
    - Only apply reasoning_effort to level-based models and derive it from numeric
      budget suffixes when present
    - Strip effort string fields for budget-based models and skip Claude/Gemini
      budget resolution for level-based or unsupported models
    - Default Gemini include_thoughts when a nonzero budget override is set
    - Add cross-protocol conversion and budget range tests
  • refactor(thinking): use bracket tags for thinking meta
    Align thinking suffix handling on a single bracket-style marker.
    
    NormalizeThinkingModel strips a terminal `[value]` segment from
    model identifiers and turns it into either a thinking budget (for
    numeric values) or a reasoning effort hint (for strings). Emission
    of `ThinkingIncludeThoughtsMetadataKey` is removed.
    
    Executor helpers and the example config are updated so their
    comments reference the new `[value]` suffix format instead of the
    legacy dash variants.
    
    BREAKING CHANGE: dash-based thinking suffixes (`-thinking`,
    `-thinking-N`, `-reasoning`, `-nothinking`) are no longer parsed
    for thinking metadata; only `[value]` annotations are recognized.
  • fix(util): do not strip thinking suffix on registered models
    NormalizeThinkingModel now checks ModelSupportsThinking before removing
    "-thinking" or "-thinking-<ver>", avoiding accidental parsing of model
    names where the suffix is part of the official id (e.g., kimi-k2-thinking,
    qwen3-235b-a22b-thinking-2507).
    
    The registry adds ThinkingSupport metadata for several models and
    propagates it via ModelInfo (e.g., kimi-k2-thinking, deepseek-r1,
    qwen3-235b-a22b-thinking-2507, minimax-m2), enabling accurate detection
    of thinking-capable models and correcting base model inference.
  • feat(util): implement dynamic thinking suffix normalization and refactor budget resolution logic
    - Added support for parsing and normalizing dynamic thinking model suffixes.
    - Centralized budget resolution across executors and payload helpers.
    - Retired legacy Gemini-specific thinking handlers in favor of unified logic.
    - Updated executors to use metadata-based thinking configuration.
    - Added `ResolveOriginalModel` utility for resolving normalized upstream models using request metadata.
    - Updated executors (Gemini, Codex, iFlow, OpenAI, Qwen) to incorporate upstream model resolution and substitute model values in payloads and request URLs.
    - Ensured fallbacks handle cases with missing or malformed metadata to derive models robustly.
    - Refactored upstream model resolution to dynamically incorporate metadata for selecting and normalizing models.
    - Improved handling of thinking configurations and model overrides in executors.
    - Removed hardcoded thinking model entries and migrated logic to metadata-based resolution.
    - Updated payload mutations to always include the resolved model.