fix(core): honor the -1 sentinels for max_turns and max_tokens (#56)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yaowei ZhengandClaude Fable 5 authored and GitHub committed 2026-07-24 16:18:38 +08:00
1 parent 6bbdac132f
commit c7465625a4
10 files changed
+66 -10

No files matched your search

+4 -1
View File
@@ -1113,7 +1113,10 @@ export function buildUniConfig(config: GenerativeModelConfig): UniConfig {
if (config.systemPrompt !== undefined) {
uniConfig.system_prompt = config.systemPrompt;
}
if (config.maxTokens !== undefined) {
// Non-positive (-1 per the config contract) means "no explicit cap": the key is left off
// the wire so the provider default applies — sent literally, every provider rejects a
// negative max_tokens with a 400 (issue #55's sibling).
if (config.maxTokens !== undefined && config.maxTokens > 0) {
uniConfig.max_tokens = config.maxTokens;
}
const thinking = mapThinkingLevel(config.thinkingLevel);