From 40eff976b4a89711965457ea27b0ce2847076cc3 Mon Sep 17 00:00:00 2001 From: RaymondVerhoef Date: Wed, 20 May 2026 17:14:17 +0200 Subject: [PATCH] Fix: exclude temperature parameter for reasoning-tier models 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) --- src/lib/llm.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/llm.js b/src/lib/llm.js index 9e69f59..0edea82 100644 --- a/src/lib/llm.js +++ b/src/lib/llm.js @@ -303,9 +303,12 @@ export async function callLLM(options) { const body = { model, max_tokens: maxTokens, - temperature, messages: messagesPayload, }; + // Temperature is not supported for reasoning tier models + if (tier !== 'reasoning') { + body.temperature = temperature; + } if (system !== undefined) body.system = system; if (tools && tools.length) body.tools = tools; if (toolChoice) body.tool_choice = toolChoice; -- 2.49.1