fix(bedrock): inherit modalities for inference profiles + detect AWS creds in /model picker#11132
fix(bedrock): inherit modalities for inference profiles + detect AWS creds in /model picker#11132JiaDe-Wu wants to merge 3 commits into
Conversation
… profiles\n\nInference profiles (us.*, global.*) were hardcoded to TEXT-only input/output\nmodalities. Claude profiles support IMAGE input but this was not reflected\nin discovery results, potentially causing vision features to be excluded.\n\nNow inherits modalities from the underlying foundation model via ARN\nlookup, matching OpenClaw resolveInferenceProfiles() pattern.\n\nRef: PR NousResearch#7920 feedback from @ptlally\n132 tests passing.
list_authenticated_providers() only checked API keys and auth stores, missing Bedrock's aws_sdk auth type entirely. The /model command (no args) would show 'No authenticated providers found' even with valid IAM credentials (instance role, SSO, env vars). Add has_aws_credentials() check in the CANONICAL_PROVIDERS loop so Bedrock appears in the provider picker when AWS credentials are available. 2 new tests for detection/non-detection. Ref: PR NousResearch#7920 colleague feedback
Bedrock's aws_sdk auth type was not handled by resolve_provider_client(), causing 'No auxiliary LLM provider configured' warning on startup. Context compression would fall back to dropping middle turns without summaries. Changes: - auxiliary_client.py: Add aws_sdk auth branch using AnthropicBedrock SDK - auxiliary_client.py: Add preserve_dots param to _AnthropicCompletionsAdapter and AnthropicAuxiliaryClient (Bedrock model IDs use dots as separators) - auxiliary_client.py: Register bedrock default aux model (Claude Haiku 4.5) - 3 new tests for resolution, preserve_dots, and graceful failure Ref: PR NousResearch#7920 colleague feedback
|
Added a third fix based on testing feedback from @sunl — Bedrock's Thanks @sunl for the thorough root cause analysis and the auxiliary client + preserve_dots findings 🙏 |
|
Closing in favor of a rebased, focused PR. Two of the three fixes here (the |
|
Replaced by #34359 (rebased onto current main, scoped down to just the inference-profile modality fix). |
Three Bedrock fixes based on community and colleague feedback:
1. Inherit modalities from foundation models for inference profiles
Inference profiles (
us.*,global.*) returned bydiscover_bedrock_models()were hardcoded to["TEXT"]input/output modalities. Claude inference profiles (which support IMAGE input) lose that capability in discovery results.Fix: Build a foundation model lookup map after discovery, resolve the underlying model via ARN, and inherit its modalities.
Reported by @ptlally in PR #7920.
2. Detect AWS credentials in
/modelprovider pickerlist_authenticated_providers()only checked API keys and auth stores, missing Bedrock'saws_sdkauth type. Running/model(no args) would show "No authenticated providers found" even with valid IAM credentials.Fix: Add
has_aws_credentials()check in theCANONICAL_PROVIDERSloop.3. Add Bedrock auxiliary client for context compression
resolve_provider_client()inauxiliary_client.pyhad noaws_sdkauth branch, so Bedrock users got "No auxiliary LLM provider configured" on startup. Context compression fell back to dropping middle turns without summaries.Fix: Add
aws_sdkauth branch usingAnthropicBedrockSDK, register default aux model (claude-haiku-4-5), and threadpreserve_dots=Truethrough the adapter chain so Bedrock model IDs (which use dots as vendor separators) aren't mangled.Changes
agent/bedrock_adapter.py— Build_foundation_modalitieslookup map for inference profileshermes_cli/model_switch.py— Add Bedrock AWS credential detection inlist_authenticated_providers()agent/auxiliary_client.py— Addaws_sdkauth branch,preserve_dotsparam, Bedrock default aux modeltests/agent/test_bedrock_adapter.py— 7 new tests (2 modality + 2 picker + 3 auxiliary)Testing
137 tests passing on EC2 (Python 3.11.14).
Ref: #7920, #10549