mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-18 09:45:23 +00:00
fix(cruise): keep cruise out of the OpenAI audio providers and list it in Add Model
Registering cruise in openai_compatible_providers also put it in OPENAI_AUDIO_TRANSCRIPTION_PROVIDERS and the speech route, which Cruise does not serve. Chat completions already resolve JSON providers through JSONProviderRegistry, so the entry was not needed for chat. Add the provider_create_fields.json entry that test_every_backend_provider_is_listed_in_add_model_or_frozen_as_unlisted requires, and drop the comment and test docstrings per AGENTS.md. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
27057a9986
commit
562902c75a
3 changed files with 52 additions and 11 deletions
|
|
@ -1008,7 +1008,6 @@ openai_compatible_providers: Final[list] = [
|
|||
"meta", # Meta Model API (Muse Spark) - JSON-configured provider
|
||||
"cognition",
|
||||
"scx-ai",
|
||||
"cruise", # BytesBrains Cruise - JSON-configured provider
|
||||
]
|
||||
|
||||
OPENAI_AUDIO_TRANSCRIPTION_PROVIDERS: Final = frozenset({"openai"} | frozenset(openai_compatible_providers))
|
||||
|
|
|
|||
|
|
@ -2985,6 +2985,34 @@
|
|||
],
|
||||
"default_model_placeholder": "sap/gpt-4"
|
||||
},
|
||||
{
|
||||
"provider": "CRUISE",
|
||||
"provider_display_name": "BytesBrains Cruise",
|
||||
"litellm_provider": "cruise",
|
||||
"credential_fields": [
|
||||
{
|
||||
"key": "api_base",
|
||||
"label": "API Base",
|
||||
"placeholder": "https://cruise.bytesbrains.net/v1",
|
||||
"tooltip": null,
|
||||
"required": false,
|
||||
"field_type": "text",
|
||||
"options": null,
|
||||
"default_value": null
|
||||
},
|
||||
{
|
||||
"key": "api_key",
|
||||
"label": "API Key",
|
||||
"placeholder": null,
|
||||
"tooltip": null,
|
||||
"required": true,
|
||||
"field_type": "password",
|
||||
"options": null,
|
||||
"default_value": null
|
||||
}
|
||||
],
|
||||
"default_model_placeholder": "cruise/anthropic/claude-sonnet-5"
|
||||
},
|
||||
{
|
||||
"provider": "SCX_AI",
|
||||
"provider_display_name": "SCX.ai",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
"""
|
||||
Tests for BytesBrains Cruise provider configuration and integration.
|
||||
"""
|
||||
|
||||
import litellm
|
||||
|
||||
|
||||
|
|
@ -24,14 +20,13 @@ class TestCruiseProviderConfig:
|
|||
assert cruise.api_key_env == "CRUISE_API_KEY"
|
||||
assert cruise.api_base_env == "CRUISE_API_BASE"
|
||||
|
||||
def test_cruise_in_openai_compatible_providers(self):
|
||||
from litellm.constants import openai_compatible_providers
|
||||
def test_cruise_not_routed_to_openai_audio_transcription(self):
|
||||
from litellm.constants import OPENAI_AUDIO_TRANSCRIPTION_PROVIDERS, openai_compatible_providers
|
||||
|
||||
assert "cruise" in openai_compatible_providers
|
||||
assert "cruise" not in openai_compatible_providers
|
||||
assert "cruise" not in OPENAI_AUDIO_TRANSCRIPTION_PROVIDERS
|
||||
|
||||
def test_cruise_provider_resolution_keeps_upstream_prefix(self):
|
||||
"""Cruise model ids carry their own provider prefix, e.g. `anthropic/claude-sonnet-5`.
|
||||
Only the leading `cruise/` is LiteLLM's; the rest must reach Cruise intact."""
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
|
||||
model, provider, api_key, api_base = get_llm_provider(
|
||||
|
|
@ -78,7 +73,6 @@ class TestCruiseProviderConfig:
|
|||
assert api_key == "cru_test"
|
||||
|
||||
def test_cruise_max_completion_tokens_passed_through(self):
|
||||
"""Cruise accepts `max_completion_tokens` as sent, so no mapping to `max_tokens`."""
|
||||
from litellm.llms.openai_like.dynamic_config import create_config_class
|
||||
from litellm.llms.openai_like.json_loader import JSONProviderRegistry
|
||||
|
||||
|
|
@ -129,3 +123,23 @@ class TestCruiseEndpointSupport:
|
|||
assert root["cruise"] == backup["cruise"]
|
||||
assert root["cruise"]["endpoints"]["chat_completions"] is True
|
||||
assert root["cruise"]["endpoints"]["responses"] is False
|
||||
|
||||
|
||||
class TestCruiseDashboardRegistration:
|
||||
def test_cruise_is_selectable_in_the_add_model_form(self):
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
path = Path(litellm.__file__).parent / "proxy" / "public_endpoints" / "provider_create_fields.json"
|
||||
with open(path) as f:
|
||||
entries = [e for e in json.load(f) if e["litellm_provider"] == "cruise"]
|
||||
|
||||
assert len(entries) == 1
|
||||
entry = entries[0]
|
||||
assert entry["provider"] == "CRUISE"
|
||||
assert entry["default_model_placeholder"].startswith("cruise/")
|
||||
|
||||
fields = {f["key"]: f for f in entry["credential_fields"]}
|
||||
assert fields["api_key"]["required"] is True
|
||||
assert fields["api_key"]["field_type"] == "password"
|
||||
assert fields["api_base"]["required"] is False
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue