feat: support extra_body for kimi/oai/anthropic#76
Conversation
- also pass kimi thinking config as extra_body Signed-off-by: tianxiao <shentianxiao@moonshot.cn>
There was a problem hiding this comment.
Pull request overview
This PR adds support for the extra_body parameter to multiple chat providers (Kimi, OpenAILegacy, OpenAIResponses, and Anthropic), allowing users to pass arbitrary provider-specific request fields. Additionally, it refactors how Kimi's thinking configuration is passed to use the extra_body mechanism.
- Added
extra_bodyparameter support to Kimi, OpenAILegacy, OpenAIResponses, and Anthropic chat providers - Refactored Kimi's thinking configuration to use
thinkingparameter (instead ofreasoning_effort) which is injected viaextra_body - Added comprehensive test coverage for
extra_bodyfunctionality across all affected providers
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/kosong/chat_provider/init.py | Defines the ExtraBody type alias for provider-specific request fields |
| src/kosong/chat_provider/kimi.py | Refactors thinking config to use thinking parameter passed via extra_body; adds extra_body support |
| src/kosong/contrib/chat_provider/openai_legacy.py | Adds extra_body parameter support to OpenAILegacy provider |
| src/kosong/contrib/chat_provider/openai_responses.py | Adds extra_body parameter support to OpenAIResponses provider |
| src/kosong/contrib/chat_provider/anthropic.py | Adds extra_body parameter support to Anthropic provider |
| tests/api_snapshot_tests/test_kimi.py | Updates test to reflect new thinking format; adds test for merging extra_body with thinking config |
| tests/api_snapshot_tests/test_openai_legacy.py | Adds test for extra_body functionality |
| tests/api_snapshot_tests/test_openai_responses.py | Adds test for extra_body functionality |
| tests/api_snapshot_tests/test_anthropic.py | Adds test for extra_body functionality |
| CHANGELOG.md | Documents the new extra_body support and Kimi thinking config changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
下个版本( 正准备发版了,来不及 review 了
next version ( It’s about to be released, it’s too late to review |
Signed-off-by: xxchan <shentianxiao@moonshot.cn>
Signed-off-by: tianxiao shentianxiao@moonshot.cn