Repository navigation
Recognize all Claude model ids in encode_prompt - #11
Merged
Merged
Conversation
encode_prompt only built the Bedrock Messages payload when the model id started with `anthropic.claude-3` / `apac.anthropic.claude-3`. The newer Claude 4.5 inference-profile ids (e.g. `jp.anthropic.claude-sonnet-4-5`, `jp.anthropic.claude-haiku-4-5`) fell through the guard, so the function returned an empty messages list and every InvokeModel call failed with "messages: at least one message is required". Match any `anthropic.claude` model id instead, covering all region prefixes (jp./apac./us./eu./none) and versions. The Messages content-block format is identical across Claude 3+ models.
3 of 13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
encode_prompt()only builds the Bedrock Messages payload when the model id starts withanthropic.claude-3orapac.anthropic.claude-3:Claude 4.5 inference-profile ids match neither — different region prefix (
jp.) and version (4-5, not3):jp.anthropic.claude-sonnet-4-5-20250929-v1:0jp.anthropic.claude-haiku-4-5-20251001-v1:0So
encode_promptreturns an emptymessageslist and everyInvokeModelcall fails withmessages: at least one message is required. With the comma-separated fallback from this branch, both candidates fail and the agent dies:This breaks any downstream agent that adopts the 4.5 model ids.
Fix
Match any
anthropic.claudemodel id instead, covering all region prefixes (jp./apac./us./eu./none) and versions. The Messages content-block format (and thesystem → userrewrite for mid-conversation messages) is identical across Claude 3+ models.Verified
encode_promptnow returns non-empty messages for both 4.5 ids and the legacyanthropic.claude-3-5/apac.anthropic.claude-3-5ids (regression-safe), while non-Claude ids (e.g. Titan) still return empty.Based on
bedrock-model-fallback(PR #10) since that branch introduced the model ids that expose this.