Skip to content

fix(bedrock): inherit modalities from foundation models for inference profiles#34359

Open
JiaDe-Wu wants to merge 1 commit into
NousResearch:mainfrom
JiaDe-Wu:fix/bedrock-profile-modalities-v2
Open

fix(bedrock): inherit modalities from foundation models for inference profiles#34359
JiaDe-Wu wants to merge 1 commit into
NousResearch:mainfrom
JiaDe-Wu:fix/bedrock-profile-modalities-v2

Conversation

@JiaDe-Wu

Copy link
Copy Markdown
Contributor

discover_bedrock_models() hardcodes inference profiles (us.*, global.*) to TEXT-only modalities. Foundation models report their real inputModalities/outputModalities from ListFoundationModels, but ListInferenceProfiles doesn't return that field, so the profile entries were just stamped with ["TEXT"].

The practical effect: Claude profiles like us.anthropic.claude-sonnet-4-6 support IMAGE input, but they show up as text-only. Anything that filters models by vision capability in the /model picker 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:

  1. Pull the model ID out of the profile's ARN (arn:aws:bedrock:*::foundation-model/<id>)
  2. If there's no ARN, strip the regional prefix (us.anthropic.claude-v2 -> anthropic.claude-v2)
  3. If neither resolves, keep the TEXT-only default

Tests

Three new cases in TestInferenceProfileModalityInheritance -- ARN-based inheritance, the regional-prefix fallback, and the no-match default. Full test_bedrock_adapter.py passes (121 tests) on Python 3.11.

Reported by @ptlally in #7920.

… 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
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have provider/bedrock AWS Bedrock (boto3, IAM) comp/agent Core agent loop, run_agent.py, prompt builder labels May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P3 Low — cosmetic, nice to have provider/bedrock AWS Bedrock (boto3, IAM) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants