mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-29 01:42:19 +00:00
fix(sail): keep Sail out of the audio transcription provider set
This commit is contained in:
parent
3f6ad59d12
commit
adbb5b7287
2 changed files with 22 additions and 7 deletions
|
|
@ -1011,7 +1011,6 @@ openai_compatible_providers: Final[list] = [
|
|||
"meta", # Meta Model API (Muse Spark) - JSON-configured provider
|
||||
"cognition",
|
||||
"scx-ai",
|
||||
"sail",
|
||||
]
|
||||
|
||||
OPENAI_AUDIO_TRANSCRIPTION_PROVIDERS: Final = frozenset({"openai"} | frozenset(openai_compatible_providers))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
"""Tests for the Sail (sailresearch.com) JSON-configured provider."""
|
||||
|
||||
import io
|
||||
import json
|
||||
import wave
|
||||
from typing import Final
|
||||
|
||||
import pytest
|
||||
import respx
|
||||
|
|
@ -97,15 +100,11 @@ class TestSailRequestShape:
|
|||
assert request.url == SAIL_CHAT_COMPLETIONS
|
||||
assert request.headers["Authorization"] == "Bearer sk-sail-test"
|
||||
|
||||
_, provider, _, _ = get_llm_provider(
|
||||
model=MODEL, custom_llm_provider=None, api_base=None, api_key=None
|
||||
)
|
||||
_, provider, _, _ = get_llm_provider(model=MODEL, custom_llm_provider=None, api_base=None, api_key=None)
|
||||
assert provider == "sail"
|
||||
|
||||
@pytest.mark.respx()
|
||||
def test_sail_api_base_env_overrides_url(
|
||||
self, respx_mock: respx.Router, monkeypatch: pytest.MonkeyPatch
|
||||
):
|
||||
def test_sail_api_base_env_overrides_url(self, respx_mock: respx.Router, monkeypatch: pytest.MonkeyPatch):
|
||||
monkeypatch.setenv("SAIL_API_BASE", "https://sail.internal.example/v2")
|
||||
route = respx_mock.post("https://sail.internal.example/v2/chat/completions").respond(
|
||||
json=_chat_completion_payload()
|
||||
|
|
@ -220,6 +219,23 @@ class TestSailRequestShape:
|
|||
assert body["metadata"] == {"completion_window": "flex"}
|
||||
assert body["background"] is True
|
||||
|
||||
@pytest.mark.respx(assert_all_called=False)
|
||||
def test_sail_transcription_rejected_without_hitting_sail(self, respx_mock: respx.Router):
|
||||
route = respx_mock.post(f"{SAIL_BASE_URL}/audio/transcriptions")
|
||||
|
||||
wav: Final = io.BytesIO()
|
||||
with wave.open(wav, "wb") as wav_file:
|
||||
wav_file.setnchannels(1)
|
||||
wav_file.setsampwidth(2)
|
||||
wav_file.setframerate(8000)
|
||||
wav_file.writeframes(b"\x00" * 1600)
|
||||
wav.seek(0)
|
||||
|
||||
with pytest.raises(ValueError, match="Unmapped provider"):
|
||||
litellm.transcription(model=MODEL, file=wav)
|
||||
|
||||
assert not route.called
|
||||
|
||||
|
||||
class TestSailCostTracking:
|
||||
def test_cached_tokens_billed_at_sail_cache_read_rate(self, monkeypatch: pytest.MonkeyPatch):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue