Fix: exclude temperature parameter for reasoning-tier models
All checks were successful
On Pull Request to Main / test (pull_request) Successful in 31s
On Pull Request to Main / publish (pull_request) Successful in 1m3s
On Pull Request to Main / deploy-dev (pull_request) Successful in 1m33s

Anthropic has deprecated the temperature parameter for their reasoning
models (claude-opus-4-7). This was causing a 400 error when analyzeGraph
called callLLM with tier: 'reasoning'.

Solution: conditionally exclude temperature from the request body when
tier === 'reasoning'. Fast and standard tiers retain their temperature
parameter.

This unblocks the "Analyse and Optimize" button in the Knowledge Graph
admin panel post-Phase-2 deployment.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
RaymondVerhoef
2026-05-20 17:14:17 +02:00
parent f838755991
commit 40eff976b4

View File

@@ -303,9 +303,12 @@ export async function callLLM(options) {
const body = { const body = {
model, model,
max_tokens: maxTokens, max_tokens: maxTokens,
temperature,
messages: messagesPayload, messages: messagesPayload,
}; };
// Temperature is not supported for reasoning tier models
if (tier !== 'reasoning') {
body.temperature = temperature;
}
if (system !== undefined) body.system = system; if (system !== undefined) body.system = system;
if (tools && tools.length) body.tools = tools; if (tools && tools.length) body.tools = tools;
if (toolChoice) body.tool_choice = toolChoice; if (toolChoice) body.tool_choice = toolChoice;