Conversation
A per-request `timeout` is honored by routing the call through a boto3 client built with matching connect/read timeouts. That is impossible for a caller-supplied `client=`, whose construction any-llm does not own, so the value was dropped with a warning. Bedrock declares `TIMEOUT_SUPPORT = "mapped"`, which promises the timeout is translated rather than discarded, so the call could run unbounded while the caller believed a deadline was in force. Raise `UnsupportedParameterError` on that path instead, matching how the centralized timeout handling rejects an unsupported parameter, and point callers at `botocore.config.Config`. Fixes mozilla-ai#1264 Co-authored-by: Tony Coder <407243179@qq.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan includes up to 8 reviews per rolling hour; 6 remain after this review. WalkthroughBedrock custom clients now raise ChangesBedrock custom-client timeout handling
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change rejects unsupported per-request timeouts when using a custom Bedrock client while preserving provider-built client behavior; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 31 files with indirect coverage changes 🚀 New features to boost your workflow:
|
## Description Bedrock and SageMaker `_convert_params` gated `temperature` and `top_p` on truthiness, so `0.0` was dropped and the request used the model default (e.g. Claude 1.0 on Bedrock) instead of greedy decoding. Other providers already use `is not None`. `max_tokens` and `stop` stay on truthiness: `0` and empty sequences are rejected by both providers. ## PR Type - Bug Fix ## Relevant issues No open issue. Distinct from #1292 (Anthropic tool_choice) and our #1296/#1297/#1298. ## Checklist - [x] I understand the code I am submitting. - [x] I have added unit tests that prove my fix/feature works - [x] I have run this code locally and verified it fixes the issue. - [x] New and existing tests pass locally - [x] Documentation was updated where necessary - [x] I have read and followed the contribution guidelines - [x] **AI Usage:** - [x] This is fully AI-generated. ## AI Usage Information - AI Model used: Claude Opus 5 - AI Developer Tool used: Cursor cloud agent - [x] I am an AI Agent filling out this form (check box if true) `uv run pytest tests/unit` → 2161 passed, 69 skipped. Target files fail on current main (`KeyError: inferenceConfig` / missing keys) and pass after. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * AWS Bedrock and SageMaker integrations now correctly honour explicitly configured zero values for temperature and top-p sampling parameters. * Unset sampling parameters continue to be omitted from requests. * **Tests** * Added coverage confirming zero-valued parameters are forwarded and unset values are excluded. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Brings in upstream's merges of our mozilla-ai#1291/mozilla-ai#1292/mozilla-ai#1310 plus mozilla-ai#1297, mozilla-ai#1299, mozilla-ai#1301, mozilla-ai#1302, mozilla-ai#1303, mozilla-ai#1305. Carried-until-merged fork work stays: mozilla-ai#1294 (gemini reasoning_effort=none), mozilla-ai#1308 (aresponses timeout), mozilla-ai#1309 (gemini native tool dicts), and the mozilla-ai#1300 carry. One conflict in tests/unit/test_responses.py: kept our mozilla-ai#1308 timeout test next to upstream's flatten test. Unit suite: 2234 passed. Claude-Session: https://claude.ai/code/session_018D3FGNvb1hRZQmsXFoA44J
Description
Fixes #1264.
Bedrock with a caller-supplied client= ignored per-request timeout (TIMEOUT_SUPPORT is mapped). Raise UnsupportedParameterError when timeout is set alongside a custom client, matching the centralized rejection. Provider-built clients are unchanged.
PR Type
Relevant issues
Fixes #1264
Checklist
AI Usage Information
tests/unit/providers/test_aws_provider.py timeout/custom_client: 12 passed. tests/unit: 2158 passed.
Summary by CodeRabbit