mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-12 02:02:13 +03:00
fix(types): preserve Claude thinking body contracts
This commit is contained in:
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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" });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user