diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py index 31612b8e78d..4990c7081b7 100644 --- a/litellm/litellm_core_utils/prompt_templates/factory.py +++ b/litellm/litellm_core_utils/prompt_templates/factory.py @@ -4741,7 +4741,9 @@ class BedrockConverseMessagesProcessor: source = element["source"] media_type: str = source["media_type"] data: str = source["data"] - doc_format = media_type.split("/")[1] + doc_format = BedrockImageProcessor._validate_format( + mime_type=media_type, image_format=media_type.split("/")[1] + ) # Deterministic name using the same hashing pattern as _create_bedrock_block HASH_SAMPLE_BYTES = 64 * 1024 diff --git a/tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_factory.py b/tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_factory.py index d6005f25da9..462d697e0a3 100644 --- a/tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_factory.py +++ b/tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_factory.py @@ -2444,9 +2444,11 @@ def test_bedrock_converse_messages_pt_document_various_formats(): ("application/pdf", "pdf"), ("text/csv", "csv"), ("text/html", "html"), + ("text/plain", "txt"), + ("text/markdown", "md"), ( "application/vnd.openxmlformats-officedocument.wordprocessingml.document", - "vnd.openxmlformats-officedocument.wordprocessingml.document", + "docx", ), ]