Repository navigation
fix(bedrock): read s3_bucket_name passed to the SDK for Bedrock file content - #47459
Closed
ryan-crabbe-berri wants to merge 1 commit into
Closed
ryan-crabbe-berri wants to merge 1 commit into
ryan-crabbe-berri wants to merge 1 commit into
Conversation
…content A direct SDK call that passed s3_bucket_name as a kwarg lost it twice: the kwargs allowlist dropped the key, and the Bedrock bucket lookup refused to read anything but the proxy's deployment snapshot or AWS_S3_BUCKET_NAME. The lookup now also accepts the caller's kwarg when the call did not enter through the proxy, decided by one shared is_proxy_request helper keyed on the server-set proxy_server_request stamp. Proxy requests keep resolving the bucket from deployment config or the environment only
Contributor
Merging this PR will not alter performance
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merged
4 of 6 tasks
Contributor
Author
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.
TLDR
User Flow
Before: a developer using the Python SDK against Bedrock batch can upload a file but cannot read it back
litellm.create_file(purpose="batch", custom_llm_provider="bedrock", s3_bucket_name="my-bucket", ...)and get back ans3://my-bucket/litellm-bedrock-files-...jsonlidlitellm.file_content(file_id=<that id>, custom_llm_provider="bedrock", s3_bucket_name="my-bucket", ...)ValueError: S3 bucket_name is required. Set 's3_bucket_name' in proxy config or AWS_S3_BUCKET_NAMEeven though they passed the bucketAfter: the same two calls work with nothing but the kwargs they already pass
litellm.create_file(...)exactly as before and get the same kind ofs3://my-bucket/...idlitellm.file_content(...)exactly as beforemy-bucketA proxy user is unaffected either way. The bucket on
GET /v1/files/{id}/contentstill comes from the deployment'ss3_bucket_namein the proxy config, and a bucket a client tries to send is ignoredRelevant issues
Fixes #45061
Linear ticket
Resolves LIT-9501
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreScreenshots / Proof of Fix
Shared setup. Real AWS account, real S3 bucket
litellm-lit4162-batch-439158074652inus-west-2,AWS_S3_BUCKET_NAMEunset everywhere. The SDK script is the exact two calls a user makesProxy config used for the proxy case, started with
litellm --config lit9501_proxy.yaml --port 4931Before (7b76b2b)
SDK upload then read with the bucket as a kwarg
Proxy upload then read with the bucket in deployment config
After (7565016)
SDK upload then read with the bucket as a kwarg
Proxy upload then read with the bucket in deployment config
Type
🐛 Bug Fix
Caveats (if any)
Low
proxy_server_requeststamp, which the proxy already strips from client bodiess3_output_bucket_namegets the same SDK kwarg fallback for symmetry, not exercised live hereFinal Attestation