Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Litellm reports 500 instead of 400 when making call to anthropic.claude-3-haiku for vision with unsupported type. #6204

Open
rachitchauhan43 opened this issue Oct 13, 2024 · 3 comments
Labels
bedrock bug Something isn't working feb 2025 help wanted Extra attention is needed

Comments

@rachitchauhan43
Copy link

rachitchauhan43 commented Oct 13, 2024

What happened?

When using litellm to call anthropic models that support vision modality with unsupported image format say "pdf", then litellm returns litellm.APIConnectionError with status code 500 where as it should be handled as 400.
Detailed stack:

APIConnectionError: Unsupported image format: pdf. Supported formats: ['png', 'jpeg', 'gif', 'webp']\nTraceback (most recent call last):\n
  File \"/Users/trylitellm/.venv/lib/python3.11/site-packages/litellm/main.py\", line 2464, in completion\n    response = bedrock_converse_chat_completion.completion(\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
  File \"/Users/trylitellm/.venv/lib/python3.11/site-packages/litellm/llms/bedrock/chat/converse_handler.py\", line 302, in completion\n    _data = AmazonConverseConfig()._transform_request(\n            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
  File \"/Users/trylitellm/.venv/lib/python3.11/site-packages/litellm/llms/bedrock/chat/converse_transformation.py\", line 257, in _transform_request\n    bedrock_messages: List[MessageBlock] = _bedrock_converse_messages_pt(\n                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
  File \"/Users/trylitellm/.venv/lib/python3.11/site-packages/litellm/llms/prompt_templates/factory.py\", line 2401, in _bedrock_converse_messages_pt\n    _part = _process_bedrock_converse_image_block(  # type: ignore\n            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
  File \"/Users/trylitellm/.venv/lib/python3.11/site-packages/litellm/llms/prompt_templates/factory.py\", line 2204, in _process_bedrock_converse_image_block\n    raise ValueError(\nValueError: Unsupported image format: pdf. Supported formats: ['png', 'jpeg', 'gif', 'webp']\n

Relevant log output

No response

Twitter / LinkedIn details

No response

@rachitchauhan43 rachitchauhan43 added the bug Something isn't working label Oct 13, 2024
@rachitchauhan43 rachitchauhan43 changed the title [Bug]: Litellm reports 500 instead of 400 when making call to anthropic.claude-3-haiku-20240307 for vision with unsupported type. [Bug]: Litellm reports 500 instead of 400 when making call to anthropic.claude-3-haiku for vision with unsupported type. Oct 13, 2024
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@ishaan-jaff
Copy link
Contributor

not stale

@ishaan-jaff ishaan-jaff added help wanted Extra attention is needed bedrock feb 2025 labels Feb 7, 2025
@PradyMagal
Copy link

I will give this a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bedrock bug Something isn't working feb 2025 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants