mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
test_gemini_image_size_limit_exceeded
This commit is contained in:
parent
65854743c5
commit
ae72092744
1 changed files with 34 additions and 0 deletions
|
|
@ -1401,3 +1401,37 @@ def test_anthropic_thinking_param_via_map_openai_params():
|
|||
assert "thinkingLevel" not in thinking_config_2, "Should NOT have thinkingLevel for Gemini 2"
|
||||
assert thinking_config_2["includeThoughts"] is True
|
||||
assert thinking_config_2["thinkingBudget"] == 10000
|
||||
|
||||
|
||||
def test_gemini_image_size_limit_exceeded():
|
||||
"""
|
||||
Test that large images exceeding MAX_IMAGE_URL_DOWNLOAD_SIZE_MB are rejected.
|
||||
|
||||
This validates that the 50MB default limit prevents downloading very large images
|
||||
that could cause memory issues and pod crashes.
|
||||
"""
|
||||
messages = [
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "What is in this image?"
|
||||
},
|
||||
{
|
||||
"type": "image_url",
|
||||
"image_url": "https://upload.wikimedia.org/wikipedia/commons/5/51/Blue_Marble_2002.jpg"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
with pytest.raises(litellm.ImageFetchError) as excinfo:
|
||||
completion(
|
||||
model="gemini/gemini-2.5-flash-lite",
|
||||
messages=messages
|
||||
)
|
||||
|
||||
error_message = str(excinfo.value)
|
||||
assert "Image size" in error_message
|
||||
assert "exceeds maximum allowed size" in error_message
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue