mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-12 08:42:18 +00:00
fix(superbot): register the provider as superbot-gg so the model id superbot resolves
A provider whose id equals one of its model ids loops back into get_llm_provider, which splits the bare name on '/' and raises IndexError, so superbot/superbot never reached the API. The provider key, the enum value, the endpoint-support and Add Model entries and the two cost-map keys are now superbot-gg; the model ids stay superbot and superbot-fast.
This commit is contained in:
parent
0d8653d3e8
commit
2c3fb40e35
9 changed files with 36 additions and 36 deletions
|
|
@ -1130,7 +1130,7 @@ openai_compatible_providers: Final[list[str]] = [
|
|||
"prism",
|
||||
"sail",
|
||||
"reka",
|
||||
"superbot",
|
||||
"superbot-gg",
|
||||
]
|
||||
|
||||
OPENAI_AUDIO_TRANSCRIPTION_PROVIDERS: Final = frozenset({"openai"} | frozenset(openai_compatible_providers))
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@
|
|||
"/v1/messages"
|
||||
]
|
||||
},
|
||||
"superbot": {
|
||||
"superbot-gg": {
|
||||
"base_url": "https://api.superbot.gg/v1",
|
||||
"api_key_env": "SUPERBOT_API_KEY",
|
||||
"api_base_env": "SUPERBOT_API_BASE"
|
||||
|
|
|
|||
|
|
@ -76119,7 +76119,7 @@
|
|||
"supports_reasoning": true,
|
||||
"source": "https://api.openinfer.ai/v1/models"
|
||||
},
|
||||
"superbot/superbot": {
|
||||
"superbot-gg/superbot": {
|
||||
"max_tokens": 65536,
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 65536,
|
||||
|
|
@ -76127,13 +76127,13 @@
|
|||
"output_cost_per_token": 5e-06,
|
||||
"cache_read_input_token_cost": 5e-08,
|
||||
"cache_creation_input_token_cost": 1.25e-06,
|
||||
"litellm_provider": "superbot",
|
||||
"litellm_provider": "superbot-gg",
|
||||
"mode": "chat",
|
||||
"supports_function_calling": true,
|
||||
"supports_reasoning": true,
|
||||
"source": "https://superbot.gg/pricing"
|
||||
},
|
||||
"superbot/superbot-fast": {
|
||||
"superbot-gg/superbot-fast": {
|
||||
"max_tokens": 65536,
|
||||
"max_input_tokens": 500000,
|
||||
"max_output_tokens": 65536,
|
||||
|
|
@ -76141,7 +76141,7 @@
|
|||
"output_cost_per_token": 5e-06,
|
||||
"cache_read_input_token_cost": 5e-08,
|
||||
"cache_creation_input_token_cost": 1.25e-06,
|
||||
"litellm_provider": "superbot",
|
||||
"litellm_provider": "superbot-gg",
|
||||
"mode": "chat",
|
||||
"supports_function_calling": true,
|
||||
"supports_reasoning": true,
|
||||
|
|
|
|||
|
|
@ -2207,8 +2207,8 @@
|
|||
"interactions": false
|
||||
}
|
||||
},
|
||||
"superbot": {
|
||||
"display_name": "superbot (`superbot`)",
|
||||
"superbot-gg": {
|
||||
"display_name": "superbot (`superbot-gg`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/superbot",
|
||||
"endpoints": {
|
||||
"chat_completions": true,
|
||||
|
|
|
|||
|
|
@ -3318,7 +3318,7 @@
|
|||
{
|
||||
"provider": "Superbot",
|
||||
"provider_display_name": "superbot",
|
||||
"litellm_provider": "superbot",
|
||||
"litellm_provider": "superbot-gg",
|
||||
"credential_fields": [
|
||||
{
|
||||
"key": "api_base",
|
||||
|
|
@ -3341,7 +3341,7 @@
|
|||
"default_value": null
|
||||
}
|
||||
],
|
||||
"default_model_placeholder": "superbot/superbot"
|
||||
"default_model_placeholder": "superbot-gg/superbot"
|
||||
},
|
||||
{
|
||||
"provider": "Sambanova",
|
||||
|
|
|
|||
|
|
@ -4534,7 +4534,7 @@ class LlmProviders(str, Enum):
|
|||
META = "meta"
|
||||
SAIL = "sail"
|
||||
REKA = "reka"
|
||||
SUPERBOT = "superbot"
|
||||
SUPERBOT = "superbot-gg"
|
||||
LITELLM_AGENT = "litellm_agent"
|
||||
CURSOR = "cursor"
|
||||
BEDROCK_MANTLE = "bedrock_mantle"
|
||||
|
|
|
|||
|
|
@ -76119,7 +76119,7 @@
|
|||
"supports_reasoning": true,
|
||||
"source": "https://api.openinfer.ai/v1/models"
|
||||
},
|
||||
"superbot/superbot": {
|
||||
"superbot-gg/superbot": {
|
||||
"max_tokens": 65536,
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 65536,
|
||||
|
|
@ -76127,13 +76127,13 @@
|
|||
"output_cost_per_token": 5e-06,
|
||||
"cache_read_input_token_cost": 5e-08,
|
||||
"cache_creation_input_token_cost": 1.25e-06,
|
||||
"litellm_provider": "superbot",
|
||||
"litellm_provider": "superbot-gg",
|
||||
"mode": "chat",
|
||||
"supports_function_calling": true,
|
||||
"supports_reasoning": true,
|
||||
"source": "https://superbot.gg/pricing"
|
||||
},
|
||||
"superbot/superbot-fast": {
|
||||
"superbot-gg/superbot-fast": {
|
||||
"max_tokens": 65536,
|
||||
"max_input_tokens": 500000,
|
||||
"max_output_tokens": 65536,
|
||||
|
|
@ -76141,7 +76141,7 @@
|
|||
"output_cost_per_token": 5e-06,
|
||||
"cache_read_input_token_cost": 5e-08,
|
||||
"cache_creation_input_token_cost": 1.25e-06,
|
||||
"litellm_provider": "superbot",
|
||||
"litellm_provider": "superbot-gg",
|
||||
"mode": "chat",
|
||||
"supports_function_calling": true,
|
||||
"supports_reasoning": true,
|
||||
|
|
|
|||
|
|
@ -2479,8 +2479,8 @@
|
|||
"interactions": false
|
||||
}
|
||||
},
|
||||
"superbot": {
|
||||
"display_name": "superbot (`superbot`)",
|
||||
"superbot-gg": {
|
||||
"display_name": "superbot (`superbot-gg`)",
|
||||
"url": "https://docs.litellm.ai/docs/providers/superbot",
|
||||
"endpoints": {
|
||||
"chat_completions": true,
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ _CHAT_COMPLETION: Final = {
|
|||
|
||||
|
||||
def test_superbot_is_a_registered_provider():
|
||||
assert litellm.LlmProviders.SUPERBOT.value == "superbot"
|
||||
assert "superbot" in litellm.provider_list
|
||||
assert "superbot" in litellm.constants.openai_compatible_providers
|
||||
assert litellm.LlmProviders.SUPERBOT.value == "superbot-gg"
|
||||
assert "superbot-gg" in litellm.provider_list
|
||||
assert "superbot-gg" in litellm.constants.openai_compatible_providers
|
||||
|
||||
|
||||
def test_superbot_provider_resolution(monkeypatch: pytest.MonkeyPatch):
|
||||
|
|
@ -40,14 +40,14 @@ def test_superbot_provider_resolution(monkeypatch: pytest.MonkeyPatch):
|
|||
monkeypatch.setenv("SUPERBOT_API_KEY", ENV_CREDENTIAL)
|
||||
|
||||
model, provider, resolved_key, api_base = get_llm_provider(
|
||||
model="superbot/superbot-fast",
|
||||
model="superbot-gg/superbot-fast",
|
||||
custom_llm_provider=None,
|
||||
api_base=None,
|
||||
api_key=None,
|
||||
)
|
||||
|
||||
assert model == "superbot-fast"
|
||||
assert provider == "superbot"
|
||||
assert provider == "superbot-gg"
|
||||
assert resolved_key == ENV_CREDENTIAL
|
||||
assert api_base == "https://api.superbot.gg/v1"
|
||||
|
||||
|
|
@ -59,13 +59,13 @@ def test_superbot_provider_keeps_explicit_credentials(monkeypatch: pytest.Monkey
|
|||
monkeypatch.setenv("SUPERBOT_API_BASE", "https://superbot.env.example/v1")
|
||||
|
||||
_, provider, resolved_key, api_base = get_llm_provider(
|
||||
model="superbot/superbot",
|
||||
model="superbot-gg/superbot",
|
||||
custom_llm_provider=None,
|
||||
api_base="https://superbot.internal.example/v1",
|
||||
api_key=EXPLICIT_CREDENTIAL,
|
||||
)
|
||||
|
||||
assert provider == "superbot"
|
||||
assert provider == "superbot-gg"
|
||||
assert resolved_key == EXPLICIT_CREDENTIAL
|
||||
assert api_base == "https://superbot.internal.example/v1"
|
||||
|
||||
|
|
@ -77,13 +77,13 @@ def test_superbot_api_base_env_overrides_default(monkeypatch: pytest.MonkeyPatch
|
|||
monkeypatch.setenv("SUPERBOT_API_BASE", "https://superbot.env.example/v1")
|
||||
|
||||
_, provider, _, api_base = get_llm_provider(
|
||||
model="superbot/superbot",
|
||||
model="superbot-gg/superbot",
|
||||
custom_llm_provider=None,
|
||||
api_base=None,
|
||||
api_key=None,
|
||||
)
|
||||
|
||||
assert provider == "superbot"
|
||||
assert provider == "superbot-gg"
|
||||
assert api_base == "https://superbot.env.example/v1"
|
||||
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ def test_superbot_api_base_autodetects_provider(monkeypatch: pytest.MonkeyPatch)
|
|||
)
|
||||
|
||||
assert model == "superbot"
|
||||
assert provider == "superbot"
|
||||
assert provider == "superbot-gg"
|
||||
assert resolved_key == ENV_CREDENTIAL
|
||||
assert api_base == "https://api.superbot.gg/v1"
|
||||
|
||||
|
|
@ -108,11 +108,11 @@ def test_superbot_api_base_autodetects_provider(monkeypatch: pytest.MonkeyPatch)
|
|||
def test_superbot_is_available_in_add_model_form():
|
||||
fields_path = Path(litellm.__file__).parent / "proxy" / "public_endpoints" / "provider_create_fields.json"
|
||||
providers = json.loads(fields_path.read_text())
|
||||
superbot = next(provider for provider in providers if provider["litellm_provider"] == "superbot")
|
||||
superbot = next(provider for provider in providers if provider["litellm_provider"] == "superbot-gg")
|
||||
|
||||
assert superbot["provider"] == "Superbot"
|
||||
assert superbot["provider_display_name"] == "superbot"
|
||||
assert superbot["default_model_placeholder"] == "superbot/superbot"
|
||||
assert superbot["default_model_placeholder"] == "superbot-gg/superbot"
|
||||
assert {field["key"]: field["required"] for field in superbot["credential_fields"]} == {
|
||||
"api_base": False,
|
||||
"api_key": True,
|
||||
|
|
@ -137,13 +137,13 @@ def test_superbot_supported_endpoints():
|
|||
backup_path = Path(litellm.__file__).parent / "provider_endpoints_support_backup.json"
|
||||
root_path = Path(litellm.__file__).parent.parent / "provider_endpoints_support.json"
|
||||
|
||||
assert json.loads(backup_path.read_text())["providers"]["superbot"]["endpoints"] == expected
|
||||
assert json.loads(root_path.read_text())["providers"]["superbot"]["endpoints"] == expected
|
||||
assert json.loads(backup_path.read_text())["providers"]["superbot-gg"]["endpoints"] == expected
|
||||
assert json.loads(root_path.read_text())["providers"]["superbot-gg"]["endpoints"] == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"model_id, context",
|
||||
[("superbot/superbot", 1_000_000), ("superbot/superbot-fast", 500_000)],
|
||||
[("superbot-gg/superbot", 1_000_000), ("superbot-gg/superbot-fast", 500_000)],
|
||||
)
|
||||
def test_superbot_models_are_priced_in_both_cost_maps(model_id: str, context: int):
|
||||
root = Path(litellm.__file__).parent.parent
|
||||
|
|
@ -153,7 +153,7 @@ def test_superbot_models_are_priced_in_both_cost_maps(model_id: str, context: in
|
|||
]
|
||||
for path in maps:
|
||||
row = json.loads(path.read_text())[model_id]
|
||||
assert row["litellm_provider"] == "superbot"
|
||||
assert row["litellm_provider"] == "superbot-gg"
|
||||
assert row["mode"] == "chat"
|
||||
assert row["max_input_tokens"] == context
|
||||
assert row["max_output_tokens"] == 65_536
|
||||
|
|
@ -168,7 +168,7 @@ def test_superbot_chat_completion_request():
|
|||
with respx.mock() as upstream:
|
||||
route: Final = upstream.post("https://api.superbot.gg/v1/chat/completions").respond(200, json=_CHAT_COMPLETION)
|
||||
response: Final = litellm.completion(
|
||||
model="superbot/superbot",
|
||||
model="superbot-gg/superbot",
|
||||
messages=[{"role": "user", "content": "Say hello"}],
|
||||
api_key=EXPLICIT_CREDENTIAL,
|
||||
)
|
||||
|
|
@ -187,7 +187,7 @@ def test_superbot_responses_request_is_bridged_to_chat_completions():
|
|||
with respx.mock() as upstream:
|
||||
route: Final = upstream.post("https://api.superbot.gg/v1/chat/completions").respond(200, json=_CHAT_COMPLETION)
|
||||
response: Final = litellm.responses(
|
||||
model="superbot/superbot",
|
||||
model="superbot-gg/superbot",
|
||||
input="Say hello",
|
||||
api_key=EXPLICIT_CREDENTIAL,
|
||||
)
|
||||
|
|
@ -208,7 +208,7 @@ async def test_superbot_anthropic_messages_request_is_bridged_to_chat_completion
|
|||
with respx.mock() as upstream:
|
||||
route: Final = upstream.post("https://api.superbot.gg/v1/chat/completions").respond(200, json=_CHAT_COMPLETION)
|
||||
response: Final = await litellm.anthropic.messages.acreate(
|
||||
model="superbot/superbot",
|
||||
model="superbot-gg/superbot",
|
||||
messages=[{"role": "user", "content": "Say hello"}],
|
||||
max_tokens=32,
|
||||
api_key=EXPLICIT_CREDENTIAL,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue