mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +00:00
test: update assertions for single-image tool result fix
Update test_translate_anthropic_messages_to_openai_tool_result_with_base64_image and test_translate_anthropic_messages_to_openai_tool_result_with_url_image to expect structured ChatCompletionImageObject list instead of plain string, matching the fix in transformation.py.
This commit is contained in:
parent
b510628bc2
commit
fd63e6a3a9
1 changed files with 11 additions and 7 deletions
|
|
@ -750,10 +750,12 @@ def test_translate_anthropic_messages_to_openai_tool_result_with_base64_image():
|
|||
break
|
||||
|
||||
assert tool_message is not None, "Tool message not found in result"
|
||||
# Tool messages in OpenAI format have string content (data URL), not list
|
||||
assert isinstance(tool_message["content"], str)
|
||||
assert tool_message["content"].startswith("data:image/jpeg;base64,")
|
||||
assert "/9j/4AAQSkZJRgABAQAAAQABAAD" in tool_message["content"]
|
||||
# Tool messages with single image should have structured image_url content
|
||||
assert isinstance(tool_message["content"], list)
|
||||
assert len(tool_message["content"]) == 1
|
||||
assert tool_message["content"][0]["type"] == "image_url"
|
||||
assert tool_message["content"][0]["image_url"]["url"].startswith("data:image/jpeg;base64,")
|
||||
assert "/9j/4AAQSkZJRgABAQAAAQABAAD" in tool_message["content"][0]["image_url"]["url"]
|
||||
|
||||
|
||||
def test_translate_anthropic_messages_to_openai_tool_result_with_url_image():
|
||||
|
|
@ -806,10 +808,12 @@ def test_translate_anthropic_messages_to_openai_tool_result_with_url_image():
|
|||
break
|
||||
|
||||
assert tool_message is not None, "Tool message not found in result"
|
||||
# Tool messages in OpenAI format have string content (URL), not list
|
||||
assert isinstance(tool_message["content"], str)
|
||||
# Tool messages with single image should have structured image_url content
|
||||
assert isinstance(tool_message["content"], list)
|
||||
assert len(tool_message["content"]) == 1
|
||||
assert tool_message["content"][0]["type"] == "image_url"
|
||||
assert (
|
||||
tool_message["content"]
|
||||
tool_message["content"][0]["image_url"]["url"]
|
||||
== "https://i0.wp.com/picjumbo.com/wp-content/uploads/amazing-stone-path-in-forest-free-image.jpg"
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue