Repository navigation
Multi-language: Update Anthropic Claude Converse samples to active Claude Haiku 5.5 - #8205
Conversation
The Converse and ConverseStream Anthropic Claude samples pinned the end-of-life model ID anthropic.claude-3-haiku-20240307-v1:0, so running them produced a hard 404. Repoint all six languages (Java v2, .NET v3, .NET v4, JavaScript v3, Rust v1, Swift) and the Go v2 ConverseClaude action to the active Claude Haiku 4.5 inference profile us.anthropic.claude-haiku-4-5-20251001-v1:0 (status ACTIVE; the "us." prefix matches the us-east-1 Region these samples use). Claude Haiku 4.5 rejects temperature and topP in the same request, so the topP inference parameter is removed from the Java, .NET, JavaScript, and Swift samples; without this they would still fail after the model swap. The Rust and Go samples set no inference config and are unaffected. The Go unit-test constant CONVERSE_CLAUDE_MODEL_ID is updated in lockstep with the sample so its stubbed test still matches. Verified live in us-east-1 against the new profile: the Go ConverseClaude action and the shared inference-config shapes all return 200. This updates the non-Python languages that share the defect fixed for Python in the Bedrock User Guide ConverseStream / Anthropic Claude page. sim: https://t.corp.amazon.com/V2245921888
…bers Rerun .tools/readmes/writeme.py after the model-ID changes shifted snippet anchors in the Go and Rust Converse samples (converse.go#L53->#L55, converse.rs#L43->#L45, converse-stream.rs#L70->#L72). sim: https://t.corp.amazon.com/V2245921888
There was a problem hiding this comment.
🤖 AI Code Example Review
This PR passes review. It makes a focused, well-reasoned model-ID update across 15 files to replace an end-of-life Claude 3 Haiku model with the active Claude Haiku 4.5 inference profile, and correctly removes the topP inference parameter that the new model rejects when combined with temperature. All changes are consistent, commented, and the Go unit test constant is kept in sync.
Detailed Review
-
[nit]
dotnetv3/Bedrock-runtime/Models/AnthropicClaude/Converse/Converse.csand its dotnetv4 counterpart both contain a duplicatednamespace AnthropicClaude { public partial class Converse { } }declaration at the end of the file. This is a pre-existing issue not introduced by this PR, but worth flagging since it will generate a compiler warning about duplicate partial class declarations. -
[nit] The Go
converse.gofile declaresmodelIdas a local variable (modelId := "us.anthropic...") rather than a package-level or file-level constant. This is inconsistent with the Rust files, which useconst MODEL_ID. Since the model ID is not dynamically determined, aconstwould better signal its fixed nature and be consistent across languages. That said, this is a pre-existing pattern and not introduced by this PR. -
[nit] The Swift
Converse/main.swiftandConverseStream/main.swiftfiles retainstopSequences: ["END"]in theirInferenceConfiguration. This is a pre-existing parameter not changed by this PR, and it's worth confirming it does not cause aValidationExceptionwith Claude Haiku 4.5 in the same waytopPdid. The PR description mentions the Swift shape was tested live and returns 200, so this appears verified. -
[policy] No new automated tests were added for the non-Go languages (.NET, Java, JavaScript, Rust, Swift). The Go unit test constant was correctly updated to match the new model ID. For the other languages, the PR relies on live manual verification rather than CI-enforced tests. This is acceptable for a model-ID-only change, but worth noting as a policy observation.
-
[nit] The README.md line-number anchors in
gov2/bedrock-runtime/README.mdandrustv1/examples/bedrock-runtime/README.mdwere updated to reflect the new line positions after adding comment lines. This is good housekeeping. However, README anchor line numbers are fragile and will drift with future edits — consider whether the project has a better mechanism (e.g., named anchors) for this. -
[nit] The comment style for the model ID explanation is slightly inconsistent across languages. Java, .NET, and JavaScript use a two-line comment block; Go and Rust use a single-line comment; Swift uses a two-line comment. This is a minor cosmetic inconsistency across the codebase and is not introduced by this PR.
-
[policy] The PR description notes that two tool-use demos referencing retired model IDs are intentionally deferred. This is a reasonable scoping decision, but the deferred work should be tracked to avoid those samples remaining broken indefinitely.
-
[nit] In
converse.go, the comment reads// the "us." cross-Region profile ID.without explicitly mentioning that it matches a specific region. The other language files say...that matches the Region set aboveor...that matches CLAUDE_REGION below, which is more informative for readers. The Go version is slightly less explicit. -
[nit] The
CONVERSE_CLAUDE_MODEL_IDconstant inconverse_test.gousesUPPER_SNAKE_CASE, which is idiomatic for Go exported constants but the name is arguably redundant with theCONVERSE_prefix given the file context. This is pre-existing style and not introduced by this PR. -
[policy] The PR has been verified manually against us-east-1, but the inference profile ID
us.anthropic.claude-haiku-4-5-20251001-v1:0is region-specific (theus.prefix). Samples that hardcodeus-east-1as the region are consistent with this profile, but readers deploying in other regions (e.g.,eu-west-1) would need a different profile prefix. A brief note in the comments or README about this constraint would improve discoverability, though this is a minor documentation nit.
Reviewed at commit 04bf88c4d5fa59a9128df608de1158c0e9a7360c. This review was generated automatically using Amazon Bedrock. It compares your changes against existing examples and coding guidelines. Findings are labeled by severity (blocking / nit / policy) and reflect only the commit above. Please use your judgment — this is advisory, not authoritative.
|
Depends on #8207 (merge that first). The |
DennisTraub
left a comment
There was a problem hiding this comment.
One change requested across all examples: Use us.anthropic.claude-haiku-5-5
Update the Converse/ConverseStream Anthropic Claude samples across Java, .NET v3/v4, JavaScript, Rust, Swift, and Go (plus the Go unit-test constant) from Claude Haiku 4.5 to the active Claude Haiku 5.5 inference profile us.anthropic.claude-haiku-5-5. Claude Haiku 5.5 deprecates both temperature and top_p, so also remove the temperature inference parameter from the Java, .NET, JavaScript, and Swift samples (topP was already removed for Haiku 4.5). Rust and Go set no inference config and are unaffected beyond the model-ID change. All inference-config shapes verified live against the new profile (return 200); gofmt and cargo fmt are clean.
Rerun writeme to update the Converse/ConverseStream line anchors that shifted when awsdocs#8205 merged into main, resolving the Validate WRITEMEs check failure.
This pull request updates the Converse and ConverseStream Anthropic Claude samples across six languages (plus the Go unit test) to a current, working model. It is the multi-language follow-up to #8204, which fixed the Python samples behind the same documentation feedback.
Why
These samples pinned
anthropic.claude-3-haiku-20240307-v1:0, which has reached end of life — running them as published fails with a 404 (ResourceNotFoundException, "reached the end of its life", re-confirmed in us-east-1).What changed
us.anthropic.claude-haiku-5-5(statusACTIVE; theus.prefix matches the us-east-1 Region these samples use).temperatureandtopPinference parameters from the Java, .NET, JavaScript, and Swift samples. Claude Haiku 5.5 deprecates bothtemperatureandtop_pentirely (ValidationException:`temperature` is deprecated for this model/`top_p` is deprecated for this model), so a model-ID swap alone would leave those samples broken. The Rust and Go samples set no inference config and are unaffected.CONVERSE_CLAUDE_MODEL_IDin lockstep withconverse.goso the stubbed test still matches.Files (15)
Converse.java,ConverseAsync.java,ConverseStream.javaConverse.cs,ConverseStream.csConverse.cs,ConverseStream.csconverse.js,converseStream.jsconverse.rs,converse-stream.rsConverse/main.swift,ConverseStream/main.swiftactions/converse.go+actions/converse_test.goVerification
us.anthropic.claude-haiku-5-5and returns 200:maxTokensonly (Java/.NET/JavaScript, after removingtemperature)maxTokens+stopSequences(Swift, after removingtemperature)gofmtandcargo fmt --checkare clean on the modified Go and Rust files.Not included
Two tool-use demos (
rustv1/.../tool-use.rsandpython/.../tool_use_demo/tool_use_demo.py) also reference retired IDs but exercise a different API surface (and the Python one carries additional retired Claude 3 Opus/Sonnet IDs in aSupportedModelsenum). Those are intentionally deferred to a separate change so tool use can be verified independently.Related: internal ticket V2245921888.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.