kimi-code/packages/kosong
Kimi Agent b2603264ec
fix(google-genai): map thinking effort off to LOW for Gemini 4 models (#4230)
* fix(google-genai): map thinking effort off to LOW for Gemini 4 models

Gemini 4 supports only LOW/MEDIUM/HIGH thinking levels and always thinks;
sending MINIMAL for effort=off makes every request fail with a 400. Degrade
'off' to LOW (thoughts still hidden) for gemini-4 models in both the
agent-core-v2 requester and the legacy kosong provider, keeping MINIMAL for
Gemini 3.

Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>

* fix(google-genai): drop comment in comment-free agent-core-v2 source

Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>

* fix(google-genai): preserve effort off in thinkingEffort for Gemini 4

LOW with suppressed thoughts is the Gemini 4 encoding of 'off', so map it
back to 'off' in the thinkingEffort getter instead of reporting 'low'.

Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>

* fix(google-genai): keep explicit LOW kwargs reported as low on non-Gemini-4

Only Gemini 4 encodes 'off' as LOW with suppressed thoughts, so gate the
reverse mapping on the model; a caller-supplied LOW/includeThoughts=false on
other models keeps reporting 'low'.

Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>

* fix(google-genai): report LOW as low in thinkingEffort again

Gemini 4 encodes 'off' as LOW with suppressed thoughts, which is
indistinguishable from an explicit LOW/includeThoughts=false kwarg, so no
reverse mapping can serve both callers. Nothing in the repo reads this
getter to persist or display effort, so keep the derive-from-kwargs
semantics; for Gemini 4's 'off', 'low' is the honest report of what runs.

Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>

* fix(google-genai): reject thinking effort off for Gemini 4 models

Gemini 4 supports only LOW/MEDIUM/HIGH thinking levels and always thinks,
so requesting effort 'off' now fails fast with a clear thinking-config
error (matching the always-reasons rejection other protocols already use)
instead of sending an invalid MINIMAL level or silently degrading to LOW.

Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>

---------

Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
Co-authored-by: 7Hanrui <qihanrui@moonshot.ai>
2026-10-15 12:34:28 +08:00
..
src fix(google-genai): map thinking effort off to LOW for Gemini 4 models (#4230) 2026-10-15 12:34:28 +08:00
test fix(google-genai): map thinking effort off to LOW for Gemini 4 models (#4230) 2026-10-15 12:34:28 +08:00
CHANGELOG.md ci: release packages (#3574) 2026-09-09 14:22:47 +08:00
package.json ci: release packages (#3574) 2026-09-09 14:22:47 +08:00
README.md Kimi For Coding 2026-05-22 15:54:50 +08:00
tsconfig.json Kimi For Coding 2026-05-22 15:54:50 +08:00
tsconfig.type-negative.json Kimi For Coding 2026-05-22 15:54:50 +08:00
tsdown.config.ts fix: align Anthropic-compatible model capabilities (#1746) 2026-07-16 01:31:38 +08:00
vitest.config.ts Kimi For Coding 2026-05-22 15:54:50 +08:00

@moonshot-ai/kosong

LLM abstraction layer used by Kimi Code.

Part of the Kimi Code monorepo.

See the main repository for documentation, issues, and contribution guidelines.

License

MIT