fix(volcengine): unpack Ark parameters sent through extra_body

This commit is contained in:
mateo-berri 2026-10-16 03:20:03 -07:00
parent f21d7cf704
commit 2aefc18b0a
2 changed files with 24 additions and 1 deletions

View file

@ -592,8 +592,13 @@ class VolcEngineVideoConfig(BaseVideoConfig):
and an omitted length is sent as OpenAI's documented default of 4 seconds, since the 2.5 family's own default
is ``-1``.
"""
params: Final = video_create_optional_request_params
drop_params: Final = _drops_params(litellm_params)
params: Final = MappingProxyType(
{
**{key: value for key, value in video_create_optional_request_params.items() if key != "parameters"},
**_parameters_fields(video_create_optional_request_params.get("parameters"), model, drop_params),
}
)
content: Final = _sent_content(prompt, params, model, drop_params)
if params.get("frames") is not None and not drop_params:
raise _droppable(model, "frames is not supported through litellm, pass seconds instead")

View file

@ -876,6 +876,24 @@ async def test_seconds_size_and_extra_body_content_reach_the_wire():
}
@pytest.mark.asyncio
@pytest.mark.parametrize(
"fields",
[{"parameters": {"seed": 3}}, {"extra_body": {"parameters": {"seed": 3}}}],
ids=["top_level", "extra_body"],
)
async def test_parameters_reach_the_wire_unpacked_whether_sent_top_level_or_in_extra_body(fields: dict[str, object]):
body = await _wire_body(model=f"volcengine/{SEEDANCE_2_5}", prompt="p", seconds="4", **fields)
assert body == {
"model": SEEDANCE_2_5,
"content": [{"type": "text", "text": "p"}],
"resolution": "720p",
"duration": 4,
"seed": 3,
}
@pytest.mark.asyncio
async def test_an_extra_body_duration_of_minus_one_is_rejected_before_anything_is_sent():
with pytest.raises(UnsupportedParamsError, match="Ark-picked length"):