fix(bedrock): inherit modalities from foundation models for inference profiles#34359
Open
JiaDe-Wu wants to merge 1 commit into
Open
fix(bedrock): inherit modalities from foundation models for inference profiles#34359JiaDe-Wu wants to merge 1 commit into
JiaDe-Wu wants to merge 1 commit into
Conversation
… profiles discover_bedrock_models() hardcoded inference profiles (us.*, global.*) to TEXT-only input/output modalities. Claude inference profiles support IMAGE input, but this was lost — excluding them from vision-capable filtering in the /model picker. Build a foundation-model modality lookup after foundation discovery, then resolve each profile's underlying model via its ARN (arn:aws:bedrock:*::foundation-model/<id>) and inherit those modalities. Falls back to stripping the regional prefix (us./eu./global./apac.) when the ARN is absent, and to TEXT-only when no foundation match exists. 3 new tests: ARN inheritance, regional-prefix fallback, TEXT-only default. 121 bedrock_adapter tests passing. Ref: PR NousResearch#7920 feedback from @ptlally
This was referenced May 29, 2026
Closed
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.
discover_bedrock_models()hardcodes inference profiles (us.*,global.*) to TEXT-only modalities. Foundation models report their realinputModalities/outputModalitiesfromListFoundationModels, butListInferenceProfilesdoesn't return that field, so the profile entries were just stamped with["TEXT"].The practical effect: Claude profiles like
us.anthropic.claude-sonnet-4-6support IMAGE input, but they show up as text-only. Anything that filters models by vision capability in the/modelpicker silently drops them.Fix
After foundation models are discovered, build a small
{model_id: modalities}map. When walking the inference profiles, resolve each one back to its base foundation model and inherit those modalities:arn:aws:bedrock:*::foundation-model/<id>)us.anthropic.claude-v2->anthropic.claude-v2)Tests
Three new cases in
TestInferenceProfileModalityInheritance-- ARN-based inheritance, the regional-prefix fallback, and the no-match default. Fulltest_bedrock_adapter.pypasses (121 tests) on Python 3.11.Reported by @ptlally in #7920.