mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-05-22 01:22:48 +00:00
test(providers): cover Novita gateway fallback
This commit is contained in:
parent
e5476573f4
commit
8281cd1946
@ -148,7 +148,7 @@ ANTHROPIC_API_KEY="$(bw get password api/anthropic)" nanobot agent
|
||||
| `gemini` | LLM (Gemini direct) | [aistudio.google.com](https://aistudio.google.com) |
|
||||
| `aihubmix` | LLM (API gateway, access to all models) | [aihubmix.com](https://aihubmix.com) |
|
||||
| `siliconflow` | LLM (SiliconFlow/硅基流动) | [siliconflow.cn](https://siliconflow.cn) |
|
||||
| `novita` | LLM (NovitaAI Model API: 200+ models on an AI-native cloud for builders and agents) | [novita.ai](https://novita.ai) |
|
||||
| `novita` | LLM (Novita AI OpenAI-compatible gateway) | [novita.ai](https://novita.ai) |
|
||||
| `dashscope` | LLM (Qwen) | [dashscope.console.aliyun.com](https://dashscope.console.aliyun.com) |
|
||||
| `moonshot` | LLM (Moonshot/Kimi) | [platform.moonshot.cn](https://platform.moonshot.cn) |
|
||||
| `zhipu` | LLM (Zhipu GLM) | [open.bigmodel.cn](https://open.bigmodel.cn) |
|
||||
|
||||
@ -199,8 +199,7 @@ PROVIDERS: tuple[ProviderSpec, ...] = (
|
||||
default_api_base="https://api.siliconflow.cn/v1",
|
||||
),
|
||||
|
||||
# NovitaAI: AI-native cloud for builders and agents. Model API exposes
|
||||
# 200+ models through an OpenAI-compatible gateway.
|
||||
# Novita AI: OpenAI-compatible gateway for hosted model APIs.
|
||||
ProviderSpec(
|
||||
name="novita",
|
||||
keywords=("novita",),
|
||||
|
||||
@ -54,6 +54,25 @@ def test_novita_forced_provider_uses_default_api_base() -> None:
|
||||
assert config.get_api_base("deepseek-v4-pro") == "https://api.novita.ai/openai"
|
||||
|
||||
|
||||
def test_novita_gateway_routes_unprefixed_models_when_configured() -> None:
|
||||
config = Config.model_validate({
|
||||
"providers": {
|
||||
"novita": {
|
||||
"apiKey": "novita-key",
|
||||
},
|
||||
},
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"model": "deepseek-v4-pro",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
assert config.get_provider_name("deepseek-v4-pro") == "novita"
|
||||
assert config.get_api_key("deepseek-v4-pro") == "novita-key"
|
||||
assert config.get_api_base("deepseek-v4-pro") == "https://api.novita.ai/openai"
|
||||
|
||||
|
||||
def test_novita_preserves_model_api_id() -> None:
|
||||
spec = find_by_name("novita")
|
||||
with patch("nanobot.providers.openai_compat_provider.AsyncOpenAI"):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user