From d65547dcaa3e79764d30668ff11065287693889c Mon Sep 17 00:00:00 2001 From: municorn Date: Mon, 20 Oct 2025 15:09:59 -0600 Subject: [PATCH 1/3] fix(anthropic): remove `top_p` parameter for Claude 4.5 models Fixes #520. --- src/engine/anthropic.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/engine/anthropic.ts b/src/engine/anthropic.ts index 7dbc5936..880e400e 100644 --- a/src/engine/anthropic.ts +++ b/src/engine/anthropic.ts @@ -37,9 +37,14 @@ export class AnthropicEngine implements AiEngine { system: systemMessage, messages: restMessages, temperature: 0, - top_p: 0.1, max_tokens: this.config.maxTokensOutput }; + + // add top_p for non-4.5 models + if (!params.model.includes('-4-5')) { + params.top_p = 0.1; + } + try { const REQUEST_TOKENS = messages .map((msg) => tokenCount(msg.content as string) + 4) From a0dc1c87c5dcd64245f43a6a5877b5e6f51b0560 Mon Sep 17 00:00:00 2001 From: municorn Date: Wed, 22 Oct 2025 08:27:39 -0600 Subject: [PATCH 2/3] fix(anthropic): correct model detection logic to properly identify Claude 4.5 models --- src/engine/anthropic.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/anthropic.ts b/src/engine/anthropic.ts index 880e400e..1543efa2 100644 --- a/src/engine/anthropic.ts +++ b/src/engine/anthropic.ts @@ -41,7 +41,7 @@ export class AnthropicEngine implements AiEngine { }; // add top_p for non-4.5 models - if (!params.model.includes('-4-5')) { + if (!params.model.includes('-4-5') || !params.model.includes('claude')) { params.top_p = 0.1; } From 74fff2861b60e53dbffa7037a4792046a2f9a65a Mon Sep 17 00:00:00 2001 From: municorn Date: Wed, 22 Oct 2025 08:33:33 -0600 Subject: [PATCH 3/3] refactor(anthropic): improve model version detection using regex pattern --- src/engine/anthropic.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/anthropic.ts b/src/engine/anthropic.ts index 1543efa2..8c7d4c51 100644 --- a/src/engine/anthropic.ts +++ b/src/engine/anthropic.ts @@ -41,7 +41,7 @@ export class AnthropicEngine implements AiEngine { }; // add top_p for non-4.5 models - if (!params.model.includes('-4-5') || !params.model.includes('claude')) { + if (!/claude.*-4-5/.test(params.model)) { params.top_p = 0.1; }