fix(anthropic): scope Kimi thinking guard to /coding endpoint only#56730
Open
liuhao1024 wants to merge 1 commit into
Open
fix(anthropic): scope Kimi thinking guard to /coding endpoint only#56730liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
The thinking suppression in `build_anthropic_kwargs` used `_is_kimi_family_endpoint` which matches ALL Kimi endpoints (coding, chat_completions, custom proxied). The `reasoning_content` validation that necessitates this guard only applies to the `/coding` endpoint. Non-`/coding` Kimi endpoints (e.g. `api.kimi.com/v1`, custom proxied with `api_mode: anthropic_messages`) do not enforce this restriction and should receive the thinking parameter normally. Fix: narrow the guard from `_is_kimi_family_endpoint` to `_is_kimi_coding_endpoint`. Fixes NousResearch#56727
Collaborator
Related: fixes #56727 (Kimi thinking wrongly suppressed on non- |
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.
What does this PR do?
Narrows the Kimi thinking guard in
build_anthropic_kwargs()from_is_kimi_family_endpoint(matches ALL Kimi endpoints) to_is_kimi_coding_endpoint(matches only/coding). This restores thethinkingparameter for non-/codingKimi endpoints that were incorrectly blocked.Related Issue
Fixes #56727
Type of Change
Changes Made
agent/anthropic_adapter.py: Changed line 2627 from_is_kimi_family_endpoint(base_url, model)to_is_kimi_coding_endpoint(base_url), scoping the thinking guard to only the/codingendpoint. Updated comment to clarify the scope.tests/agent/test_kimi_coding_anthropic_thinking.py: Updated tests for non-/codingKimi endpoints to assert that thinking IS present (was incorrectly asserting omission). Renamed tests to reflect new behavior.How to Test
python -m pytest tests/agent/test_kimi_coding_anthropic_thinking.py -v— all 17 tests should pass/codingendpoints still omit thinking (4 parametrized tests pass)/codingKimi endpoints now receive thinking (7 parametrized tests pass)Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/agent/test_kimi_coding_anthropic_thinking.py -vand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A