fix(types): preserve Claude thinking body contracts

This commit is contained in:
backryun
2026-08-09 00:16:09 +09:00
committed by diegosouzapw
parent aae408f585
commit 56b1e14e4f
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" });
}