fix: granular reasoning_effort handling for Claude models (#791)
- github.js: split thinking vs reasoning_effort stripping - thinking (Claude-native format) still stripped for all Claude on Copilot - reasoning_effort now passed through for Opus 4.6 and Sonnet 4.6 - still stripped for Haiku 4.5 and Opus 4.7 (rejected upstream) - reasoning_effort "none" stripped for all models (not all support it) - openai-to-claude.js: map reasoning_effort → thinking.budget_tokens for direct Anthropic backend (none→skip, low→4096, medium→8192, high→16384, xhigh→32768) Previously reasoning_effort was stripped for ALL Claude models, meaning Opus 4.6 via Copilot never received thinking configuration. AI-generated commit by Claude Opus 4.6 (Anthropic)
This commit is contained in:
@@ -179,6 +179,25 @@ Respond ONLY with the JSON object, no other text.`);
|
||||
};
|
||||
}
|
||||
|
||||
// Map OpenAI reasoning_effort → Claude thinking.budget_tokens
|
||||
// When client sends reasoning_effort (OpenAI format) but no explicit thinking block,
|
||||
// translate to Claude's native format.
|
||||
if (body.reasoning_effort && !result.thinking) {
|
||||
const effortToBudget = {
|
||||
none: 0,
|
||||
low: 4096,
|
||||
medium: 8192,
|
||||
high: 16384,
|
||||
xhigh: 32768,
|
||||
};
|
||||
const budget = effortToBudget[body.reasoning_effort.toLowerCase()];
|
||||
if (budget === 0) {
|
||||
// none → no thinking
|
||||
} else if (budget) {
|
||||
result.thinking = { type: "enabled", budget_tokens: budget };
|
||||
}
|
||||
}
|
||||
|
||||
// Attach toolNameMap to result for response translation
|
||||
if (toolNameMap.size > 0) {
|
||||
result._toolNameMap = toolNameMap;
|
||||
|
||||
Reference in New Issue
Block a user