fix(bedrock): carry s3_endpoint_url and s3_region_name into file content downloads

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Devin AI 2026-09-14 22:25:53 +00:00
parent 7fd541efb9
commit dd209ba97b
6 changed files with 32 additions and 0 deletions

View file

@ -530,6 +530,8 @@ def _extract_file_access_credentials(litellm_params: dict | None) -> dict:
"vertex_credentials",
"gcs_bucket_name",
"bucket_name",
"s3_endpoint_url",
"s3_region_name",
"timeout",
"max_retries",
"_litellm_internal_model_credentials",

View file

@ -43,6 +43,8 @@ OPTIONAL_KWARGS_KEYS: Final = (
"timeout",
"gcs_bucket_name",
"bucket_name",
"s3_endpoint_url",
"s3_region_name",
"vertex_credentials",
"vertex_project",
"vertex_location",

View file

@ -3721,6 +3721,7 @@ bedrock_batch_litellm_params: Final = (
"aws_batch_role_arn",
"s3_bucket_name",
"s3_region_name",
"s3_endpoint_url",
"s3_output_bucket_name",
"bedrock_tags",
)

View file

@ -278,6 +278,8 @@ def test_extract_credentials_all_supported_keys():
"vertex_credentials",
"gcs_bucket_name",
"bucket_name",
"s3_endpoint_url",
"s3_region_name",
"timeout",
"max_retries",
}

View file

@ -55,6 +55,18 @@ class TestGetLitellmParamsKwargsExtraction:
assert result["timeout"] == 30
assert result["rpm"] == 100
def test_s3_endpoint_kwargs_are_extracted_when_provided(self):
result = get_litellm_params(
s3_endpoint_url="https://bucket.vpce-abc.s3.us-east-1.vpce.amazonaws.com",
s3_region_name="us-east-1",
)
assert result["s3_endpoint_url"] == "https://bucket.vpce-abc.s3.us-east-1.vpce.amazonaws.com"
assert result["s3_region_name"] == "us-east-1"
result_without_s3_kwargs = get_litellm_params()
assert "s3_endpoint_url" not in result_without_s3_kwargs
assert "s3_region_name" not in result_without_s3_kwargs
def test_subset_of_kwargs_only_includes_provided(self):
"""Only provided kwargs appear, others remain absent."""
result = get_litellm_params(azure_ad_token="token123")

View file

@ -2271,6 +2271,19 @@ class TestBedrockFileContentTransformation:
authorization = litellm_params[S3_SIGNED_REQUEST_HEADERS_PARAM]["Authorization"]
assert "/eu-west-1/s3/aws4_request" in authorization
def test_s3_request_target_uses_configured_endpoint_url(self):
from litellm.litellm_core_utils.get_litellm_params import get_litellm_params
from litellm.llms.bedrock.files.transformation import BedrockFilesConfig
lp = get_litellm_params(
aws_region_name="us-east-1",
s3_endpoint_url="https://bucket.vpce-abc.s3.us-east-1.vpce.amazonaws.com",
)
assert BedrockFilesConfig()._s3_request_target(
optional_params={}, litellm_params=lp
).endpoint_url == "https://bucket.vpce-abc.s3.us-east-1.vpce.amazonaws.com"
def test_validate_environment_merges_and_pops_signed_get_headers(self):
from litellm.llms.bedrock.files.transformation import (
S3_SIGNED_REQUEST_HEADERS_PARAM,