-
Notifications
You must be signed in to change notification settings - Fork 729
chore: switch from sonnet to haiku in maintainers processing [CM-1049] #3915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,7 +78,7 @@ async def invoke_bedrock( | |
| } | ||
| ) | ||
|
|
||
| modelId = "us.anthropic.claude-sonnet-4-20250514-v1:0" | ||
| modelId = "us.anthropic.claude-haiku-4-5-20251001-v1:0" | ||
| accept = "application/json" | ||
| contentType = "application/json" | ||
|
|
||
|
|
@@ -107,14 +107,20 @@ async def invoke_bedrock( | |
| response_body = json.loads(body_bytes.decode("utf-8")) | ||
| raw_text = response_body["content"][0]["text"].replace('"""', "").strip() | ||
|
|
||
| # Expect pure JSON - no markdown handling | ||
| # Strip markdown code fences if present (Haiku sometimes ignores the system prompt) | ||
| if raw_text.startswith("```"): | ||
| raw_text = raw_text.split("\n", 1)[-1] | ||
| if raw_text.endswith("```"): | ||
| raw_text = raw_text.rsplit("```", 1)[0] | ||
| raw_text = raw_text.strip() | ||
|
|
||
| output = json.loads(raw_text) | ||
|
Comment on lines
+110
to
117
|
||
|
|
||
| # Calculate cost | ||
| # Calculate cost (Claude Haiku 4.5 on AWS Bedrock: $1.00/$5.00 per 1M tokens) | ||
| input_tokens = response_body["usage"]["input_tokens"] | ||
| output_tokens = response_body["usage"]["output_tokens"] | ||
| input_cost = (input_tokens / 1000) * 0.003 | ||
| output_cost = (output_tokens / 1000) * 0.015 | ||
| input_cost = (input_tokens / 1_000_000) * 1.00 | ||
| output_cost = (output_tokens / 1_000_000) * 5.00 | ||
| total_cost = input_cost + output_cost | ||
|
|
||
| # Validate output with the provided model if it exists | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The markdown code-fence stripping can still leave a trailing closing fence in common outputs like
json\n{...}\n\n (note the newline after the closing fence). In that caseraw_text.endswith("```")is false before.strip(), so the closing fence remains andjson.loads(raw_text)will fail. Consider stripping whitespace before checking for the closing fence (or using a small regex that removes leading.*\n and trailingwith surrounding whitespace).