From 3cd3c58ae20dbea93b22748c37996b61f5baa602 Mon Sep 17 00:00:00 2001 From: Umberto Sgueglia Date: Fri, 16 Oct 2026 12:37:15 +0200 Subject: [PATCH 1/4] fix: move project evaluation to claude sonnet 4.5 after bedrock retired sonnet 4 Refs linuxfoundation/lfx-cdp-insights-ops#820 Signed-off-by: Umberto Sgueglia --- services/libs/types/src/enums/llm.ts | 1 + services/libs/types/src/llm.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/services/libs/types/src/enums/llm.ts b/services/libs/types/src/enums/llm.ts index 6f46889649..fe187a3ad0 100644 --- a/services/libs/types/src/enums/llm.ts +++ b/services/libs/types/src/enums/llm.ts @@ -3,6 +3,7 @@ export enum LlmModelType { CLAUDE_3_5_SONNET_V2 = 'anthropic.claude-3-5-sonnet-20241022-v2:0', CLAUDE_3_OPUS = 'anthropic.claude-3-opus-20240229-v1:0', CLAUDE_SONNET_4 = 'us.anthropic.claude-sonnet-4-20250514-v1:0', + CLAUDE_SONNET_4_5 = 'us.anthropic.claude-sonnet-4-5-20250929-v1:0', CLAUDE_HAIKU_4_5 = 'us.anthropic.claude-haiku-4-5-20251001-v1:0', } diff --git a/services/libs/types/src/llm.ts b/services/libs/types/src/llm.ts index 591c31f149..2296f80386 100644 --- a/services/libs/types/src/llm.ts +++ b/services/libs/types/src/llm.ts @@ -34,6 +34,7 @@ export const LLM_MODEL_REGION_MAP: Record = { [LlmModelType.CLAUDE_3_5_SONNET]: 'us-east-1', [LlmModelType.CLAUDE_3_5_SONNET_V2]: 'us-west-2', [LlmModelType.CLAUDE_SONNET_4]: 'us-east-1', + [LlmModelType.CLAUDE_SONNET_4_5]: 'us-east-1', [LlmModelType.CLAUDE_HAIKU_4_5]: 'us-east-1', } @@ -55,6 +56,10 @@ export const LLM_MODEL_PRICING_MAP: Record = { costPer1000InputTokens: 0.003, costPer1000OutputTokens: 0.015, }, + [LlmModelType.CLAUDE_SONNET_4_5]: { + costPer1000InputTokens: 0.003, + costPer1000OutputTokens: 0.015, + }, [LlmModelType.CLAUDE_HAIKU_4_5]: { costPer1000InputTokens: 0.001, costPer1000OutputTokens: 0.005, @@ -159,7 +164,7 @@ export const LLM_SETTINGS: Record = { }, }, [LlmQueryType.PROJECT_EVALUATION]: { - modelId: LlmModelType.CLAUDE_SONNET_4, + modelId: LlmModelType.CLAUDE_SONNET_4_5, arguments: { max_tokens: 2000, anthropic_version: 'bedrock-2023-05-31', From 2804145335a3edc03021a018cc2d6b345074d6a8 Mon Sep 17 00:00:00 2001 From: Umberto Sgueglia Date: Fri, 16 Oct 2026 12:59:32 +0200 Subject: [PATCH 2/4] fix: move project evaluation to claude sonnet 5.5 after bedrock retired sonnet 4 Refs linuxfoundation/lfx-cdp-insights-ops#820 Signed-off-by: Umberto Sgueglia --- services/libs/types/src/enums/llm.ts | 2 +- services/libs/types/src/llm.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/services/libs/types/src/enums/llm.ts b/services/libs/types/src/enums/llm.ts index fe187a3ad0..6094cd2df7 100644 --- a/services/libs/types/src/enums/llm.ts +++ b/services/libs/types/src/enums/llm.ts @@ -3,7 +3,7 @@ export enum LlmModelType { CLAUDE_3_5_SONNET_V2 = 'anthropic.claude-3-5-sonnet-20241022-v2:0', CLAUDE_3_OPUS = 'anthropic.claude-3-opus-20240229-v1:0', CLAUDE_SONNET_4 = 'us.anthropic.claude-sonnet-4-20250514-v1:0', - CLAUDE_SONNET_4_5 = 'us.anthropic.claude-sonnet-4-5-20250929-v1:0', + CLAUDE_SONNET_5_5 = 'us.anthropic.claude-sonnet-5-5', CLAUDE_HAIKU_4_5 = 'us.anthropic.claude-haiku-4-5-20251001-v1:0', } diff --git a/services/libs/types/src/llm.ts b/services/libs/types/src/llm.ts index 2296f80386..6079a7ec9a 100644 --- a/services/libs/types/src/llm.ts +++ b/services/libs/types/src/llm.ts @@ -34,7 +34,7 @@ export const LLM_MODEL_REGION_MAP: Record = { [LlmModelType.CLAUDE_3_5_SONNET]: 'us-east-1', [LlmModelType.CLAUDE_3_5_SONNET_V2]: 'us-west-2', [LlmModelType.CLAUDE_SONNET_4]: 'us-east-1', - [LlmModelType.CLAUDE_SONNET_4_5]: 'us-east-1', + [LlmModelType.CLAUDE_SONNET_5_5]: 'us-east-1', [LlmModelType.CLAUDE_HAIKU_4_5]: 'us-east-1', } @@ -56,9 +56,9 @@ export const LLM_MODEL_PRICING_MAP: Record = { costPer1000InputTokens: 0.003, costPer1000OutputTokens: 0.015, }, - [LlmModelType.CLAUDE_SONNET_4_5]: { - costPer1000InputTokens: 0.003, - costPer1000OutputTokens: 0.015, + [LlmModelType.CLAUDE_SONNET_5_5]: { + costPer1000InputTokens: 0.002, + costPer1000OutputTokens: 0.01, }, [LlmModelType.CLAUDE_HAIKU_4_5]: { costPer1000InputTokens: 0.001, @@ -164,7 +164,7 @@ export const LLM_SETTINGS: Record = { }, }, [LlmQueryType.PROJECT_EVALUATION]: { - modelId: LlmModelType.CLAUDE_SONNET_4_5, + modelId: LlmModelType.CLAUDE_SONNET_5_5, arguments: { max_tokens: 2000, anthropic_version: 'bedrock-2023-05-31', From 50554787b7006c4ce2a1b714ae06ba4b01a01862 Mon Sep 17 00:00:00 2001 From: Umberto Sgueglia Date: Fri, 16 Oct 2026 13:09:26 +0200 Subject: [PATCH 3/4] fix: drop the sampling parameter and turn off up-front thinking for sonnet 5.5 Refs linuxfoundation/lfx-cdp-insights-ops#820 Signed-off-by: Umberto Sgueglia --- services/libs/common_services/src/services/llm.service.ts | 6 +++++- services/libs/types/src/llm.ts | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/services/libs/common_services/src/services/llm.service.ts b/services/libs/common_services/src/services/llm.service.ts index 5443d4506c..dac53c6ed9 100644 --- a/services/libs/common_services/src/services/llm.service.ts +++ b/services/libs/common_services/src/services/llm.service.ts @@ -26,6 +26,10 @@ export interface IBedrockClientCredentials { secretAccessKey: string } +function firstTextBlock(content: Array<{ type?: string; text?: string }>): string { + return content.find((block) => block.type === 'text')?.text ?? content[0]?.text ?? '' +} + export class LlmService extends LoggerBase { private readonly clientRegionMap: Map private readonly qx: QueryExecutor @@ -134,7 +138,7 @@ export class LlmService extends LoggerBase { const inputTokenCount = body.usage.input_tokens const outputTokenCount = body.usage.output_tokens - const answer = body.content[0].text + const answer = firstTextBlock(body.content) const pricing = LLM_MODEL_PRICING_MAP[settings.modelId] diff --git a/services/libs/types/src/llm.ts b/services/libs/types/src/llm.ts index 6079a7ec9a..56233d997e 100644 --- a/services/libs/types/src/llm.ts +++ b/services/libs/types/src/llm.ts @@ -163,12 +163,14 @@ export const LLM_SETTINGS: Record = { temperature: 0, }, }, + // Claude 5 models reject non-default sampling parameters and Sonnet 5.5 thinks by default; + // between_tools is its lowest thinking setting: https://platform.claude.com/docs/en/build-with-claude/thinking [LlmQueryType.PROJECT_EVALUATION]: { modelId: LlmModelType.CLAUDE_SONNET_5_5, arguments: { max_tokens: 2000, anthropic_version: 'bedrock-2023-05-31', - temperature: 0, + thinking: { type: 'between_tools' }, }, }, [LlmQueryType.ONBOARDING_REQUEST_PARSING]: { From 37c51af5629a17447a528d01aa0cf9956841f94a Mon Sep 17 00:00:00 2001 From: Umberto Sgueglia Date: Fri, 16 Oct 2026 13:12:46 +0200 Subject: [PATCH 4/4] chore: drop the explanatory comment on the sonnet 5.5 settings Refs linuxfoundation/lfx-cdp-insights-ops#820 Signed-off-by: Umberto Sgueglia --- services/libs/types/src/llm.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/libs/types/src/llm.ts b/services/libs/types/src/llm.ts index 56233d997e..9c44e309ba 100644 --- a/services/libs/types/src/llm.ts +++ b/services/libs/types/src/llm.ts @@ -163,8 +163,6 @@ export const LLM_SETTINGS: Record = { temperature: 0, }, }, - // Claude 5 models reject non-default sampling parameters and Sonnet 5.5 thinks by default; - // between_tools is its lowest thinking setting: https://platform.claude.com/docs/en/build-with-claude/thinking [LlmQueryType.PROJECT_EVALUATION]: { modelId: LlmModelType.CLAUDE_SONNET_5_5, arguments: {