fix(types): preserve Claude thinking body contracts (#9852)

Co-authored-by: backryun <bakryun0718@proton.me>
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-08-09 09:51:56 -03:00
committed by GitHub
parent 65dae70403
commit 4fe0fffb31
2 changed files with 5 additions and 3 deletions

View File

@@ -54,7 +54,7 @@ export function normalizeClaudeAdaptiveThinking<T extends Record<string, unknown
delete nextThinking.budget_tokens;
delete nextThinking.max_tokens;
return { ...record, thinking: nextThinking } as T;
return { ...body, thinking: nextThinking };
}
/**
@@ -84,7 +84,7 @@ export function normalizeClaudeDisabledThinkingEffort<T extends Record<string, u
}
return {
...record,
...body,
output_config: { ...outputConfig, effort: disabledEffortCap },
} as T;
};
}

View File

@@ -55,10 +55,12 @@ test("direct Anthropic API providers clamp Opus 5 disabled thinking to high effo
for (const effort of ["xhigh", "max"]) {
const body = {
model: "claude-opus-5",
request_marker: "preserve-me",
thinking: { type: "disabled" },
output_config: { effort, format: "compact" },
};
const result = normalizeClaudeDisabledThinkingEffort(body, "claude-opus-5", provider);
assert.equal(result.request_marker, "preserve-me");
assert.deepEqual(result.thinking, { type: "disabled" });
assert.deepEqual(result.output_config, { effort: "high", format: "compact" });
}