mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
test(bedrock): cover the bare string video url on the async path
No test exercised the bare string form of video_url through the async dispatcher, so those two lines stayed uncovered Add the async counterpart of the existing string form test
This commit is contained in:
parent
a88e0f5f3d
commit
ddb3b4450c
1 changed files with 33 additions and 0 deletions
|
|
@ -7059,6 +7059,39 @@ async def test_bedrock_converse_user_video_url_becomes_video_block_async():
|
|||
assert blocks[1]["video"]["format"] == "mp4"
|
||||
|
||||
|
||||
async def test_bedrock_converse_user_video_url_str_form_becomes_video_block_async():
|
||||
"""A bare string video_url must survive the async (acompletion) path too."""
|
||||
from litellm.litellm_core_utils.prompt_templates.factory import (
|
||||
BedrockConverseMessagesProcessor,
|
||||
)
|
||||
|
||||
clip_b64 = _video_clip_b64()
|
||||
messages = [
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "text", "text": "Describe this video."},
|
||||
{
|
||||
"type": "video_url",
|
||||
"video_url": f"data:video/mp4;base64,{clip_b64}",
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
|
||||
translated = (
|
||||
await BedrockConverseMessagesProcessor._bedrock_converse_messages_pt_async(
|
||||
messages=messages,
|
||||
model="amazon.nova-pro-v1:0",
|
||||
llm_provider="bedrock",
|
||||
)
|
||||
)
|
||||
|
||||
blocks = translated[0]["content"]
|
||||
assert [next(iter(block)) for block in blocks] == ["text", "video"]
|
||||
assert blocks[1]["video"]["format"] == "mp4"
|
||||
|
||||
|
||||
def test_bedrock_converse_image_url_still_becomes_image_block():
|
||||
"""The video_url branch must not hijack ordinary image parts."""
|
||||
from litellm.litellm_core_utils.prompt_templates.factory import (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue