Skip to content

refactor(kosong): control thinking mode via extra_body parameter#655

Merged
stdrc merged 2 commits intomainfrom
rc/new-thinking-config
Jan 21, 2026
Merged

refactor(kosong): control thinking mode via extra_body parameter#655
stdrc merged 2 commits intomainfrom
rc/new-thinking-config

Conversation

@stdrc
Copy link
Collaborator

@stdrc stdrc commented Jan 21, 2026

Summary

This PR updates the Kimi chat provider to control thinking mode via the extra_body.thinking parameter instead of relying solely on the legacy reasoning_effort parameter.

Changes

  • Add ThinkingConfig and ExtraBody TypedDict types for type-safe extra body configuration
  • Add with_extra_body() method to Kimi class for updating extra body parameters
  • Update with_thinking_effort() to set both reasoning_effort (for backward compatibility) and extra_body.thinking
  • Mark reasoning_effort in GenerationKwargs as legacy with a docstring note

Backward Compatibility

The reasoning_effort parameter is still set alongside the new extra_body.thinking parameter to maintain backward compatibility with older API versions.

stdrc added 2 commits January 21, 2026 12:15
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Copilot AI review requested due to automatic review settings January 21, 2026 04:21
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

This PR refactors the Kimi chat provider to control thinking mode via the extra_body.thinking parameter while maintaining backward compatibility with the legacy reasoning_effort parameter.

Changes:

  • Introduced ThinkingConfig and ExtraBody TypedDict types for type-safe extra body configuration
  • Added with_extra_body() method to update extra body parameters in generation kwargs
  • Updated with_thinking() to set both reasoning_effort and extra_body.thinking for backward compatibility

Reviewed changes

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

File Description
packages/kosong/src/kosong/chat_provider/kimi.py Adds TypedDict definitions, implements with_extra_body() method, updates with_thinking() to use new extra_body parameter alongside legacy reasoning_effort
packages/kosong/CHANGELOG.md Documents the change to use extra_body parameter for thinking mode control

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

@stdrc stdrc merged commit 1ee947d into main Jan 21, 2026
20 checks passed
@stdrc stdrc deleted the rc/new-thinking-config branch January 21, 2026 04:58
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.

2 participants