mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(utils): make supports_audio_output read the supports_audio_output cost-map key (#45294)
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
This commit is contained in:
parent
9df3d4c96b
commit
8683f1418e
2 changed files with 20 additions and 1 deletions
|
|
@ -2962,7 +2962,7 @@ def supports_pdf_input(model: str, custom_llm_provider: str | None = None) -> bo
|
|||
|
||||
def supports_audio_output(model: str, custom_llm_provider: str | None = None) -> bool:
|
||||
"""Check if a given model supports audio output in a chat completion call"""
|
||||
return supports_factory(model=model, custom_llm_provider=custom_llm_provider, key="supports_audio_input")
|
||||
return supports_factory(model=model, custom_llm_provider=custom_llm_provider, key="supports_audio_output")
|
||||
|
||||
|
||||
def supports_prompt_caching(model: str, custom_llm_provider: str | None = None) -> bool:
|
||||
|
|
|
|||
|
|
@ -325,6 +325,25 @@ def test_supports_function_calling_unknown_github_alias_returns_false():
|
|||
assert litellm.utils.supports_function_calling(model="github/non-existent-model-for-capability-check") is False
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("audio_input", "audio_output"), [(True, False), (False, True)])
|
||||
def test_supports_audio_output_reads_its_own_cost_map_flag(
|
||||
local_model_cost_map: None, monkeypatch: pytest.MonkeyPatch, audio_input: bool, audio_output: bool
|
||||
) -> None:
|
||||
model: Final = "openai/audio-flags-disagree-model"
|
||||
monkeypatch.setitem(
|
||||
litellm.model_cost,
|
||||
model,
|
||||
{
|
||||
"litellm_provider": "openai",
|
||||
"mode": "chat",
|
||||
"supports_audio_input": audio_input,
|
||||
"supports_audio_output": audio_output,
|
||||
},
|
||||
)
|
||||
assert litellm.supports_audio_input(model) is audio_input
|
||||
assert litellm.supports_audio_output(model) is audio_output
|
||||
|
||||
|
||||
def test_get_optional_params_image_gen():
|
||||
from litellm.llms.azure.image_generation import AzureGPTImageGenerationConfig
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue