refactor(kosong): control thinking mode via extra_body parameter#655
Merged
refactor(kosong): control thinking mode via extra_body parameter#655
Conversation
Signed-off-by: Richard Chien <stdrc@outlook.com>
Contributor
There was a problem hiding this comment.
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
ThinkingConfigandExtraBodyTypedDict 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 bothreasoning_effortandextra_body.thinkingfor 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates the Kimi chat provider to control thinking mode via the
extra_body.thinkingparameter instead of relying solely on the legacyreasoning_effortparameter.Changes
ThinkingConfigandExtraBodyTypedDict types for type-safe extra body configurationwith_extra_body()method toKimiclass for updating extra body parameterswith_thinking_effort()to set bothreasoning_effort(for backward compatibility) andextra_body.thinkingreasoning_effortinGenerationKwargsas legacy with a docstring noteBackward Compatibility
The
reasoning_effortparameter is still set alongside the newextra_body.thinkingparameter to maintain backward compatibility with older API versions.