From 7dbf105e13def15c367f080adc8ee6c5dd783909 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Mon, 23 Mar 2026 11:09:50 -0700 Subject: [PATCH] fix(bedrock/files): handle IO[bytes] content in non-JSONL upload path --- litellm/llms/bedrock/files/transformation.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/litellm/llms/bedrock/files/transformation.py b/litellm/llms/bedrock/files/transformation.py index 3007b54808c..fc46ee719ad 100644 --- a/litellm/llms/bedrock/files/transformation.py +++ b/litellm/llms/bedrock/files/transformation.py @@ -390,6 +390,12 @@ class BedrockFilesConfig(BaseAWSLLM, BaseFilesConfig): file_content = extracted_file_data_content.decode("utf-8") elif isinstance(extracted_file_data_content, str): file_content = extracted_file_data_content + elif hasattr(extracted_file_data_content, "read") and hasattr( + extracted_file_data_content, "seek" + ): + # IO[bytes] path (e.g. SpooledTemporaryFile from FastAPI UploadFile) + extracted_file_data_content.seek(0) + file_content = extracted_file_data_content.read().decode("utf-8") else: raise ValueError("Unsupported file content type")