fix(bedrock): inherit modalities from foundation models for inference profiles - #34359
fix(bedrock): inherit modalities from foundation models for inference profiles#34359JiaDe-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
|
Thanks for the focused metadata fix. The current-head defect is real: inference profiles are still stamped Problems
Suggested changes
Automated hermes-sweeper review. |
GottZ
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Summary
Two PRs address the Bedrock inference-profile metadata defect: #11132 combines modality inheritance with two unrelated Bedrock fixes, while #34359 carries the remaining modality change as a focused, current-main replacement. Both replace hardcoded TEXT-only profile metadata by resolving the underlying foundation model, inheriting its input and output modalities, and retaining a TEXT fallback when resolution fails.
Related pull requests
- #11132 [closed]
duplicate— (+209/-6) — superseded by #34359: The diff fixes the reported hardcoded-modality cause, but also adds AWS credential detection and Bedrock auxiliary-client support; those two changes later landed separately, leaving its modality portion as the relevant reference implementation and motivating its closure in favor of the focused replacement. - #34359
related— (+135/-3) — keep open pending review fixes: The focused diff resolves profile ARNs or strips regional prefixes, copies both modality fields from matching foundation models, and defaults unmatched profiles to TEXT. The contributor keep_open review correctly notes that the claimed /model capability-filtering impact is not present in current consumers and that output-modality inheritance lacks an assertion, so the description should be narrowed or a real consumer path added and the missing assertion supplied before merge.
Duplicates
#11132 and #34359 implement substantially the same inference-profile modality inheritance; #34359 is the rebased, scoped successor, while #11132 also contains unrelated fixes.
Suggested consolidation
Merge #34359 after addressing its keep_open review by removing or implementing the unsupported /model filtering claim and adding an output-modality inheritance assertion; retain #11132 closed as superseded by #34359 rather than reopening it.
Complex graph
flowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
subgraph Dup11132 ["PRs duplicating each other"]
P11132["PR #11132 (closed)"]
P34359["PR #34359 (open)"]
end
class P11132 closed
class P34359 open
class P34359 target
click P11132 "https://github.com/NousResearch/hermes-agent/pull/11132"
click P34359 "https://github.com/NousResearch/hermes-agent/pull/34359"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label).
Cross-PR triage: Reviewed 2 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 23 kB of PR diffs, 3 kB of issue/PR text, 2 kB of discussion (4 comments), 0 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.
|
Thanks for the review — both points hold up, and I've verified them against current On the What I'm adding:
On the output-modality assertion: agreed, and it needs more care than it first looks. Discovery drops any foundation model whose One scope note: this branch predates the |
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.