mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-01 07:03:02 +00:00
fix(ui): restore Z.AI credential fields in provider catalog (#49325)
Carry the Z.AI catalog fix from #40088 and move its regression into the mapped unit test file. Co-authored-by: Chaitanya Laxman <chaitanyalaxman118@gmail.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
a42c1c138a
commit
467847b2e9
2 changed files with 56 additions and 1 deletions
|
|
@ -4285,6 +4285,34 @@
|
|||
],
|
||||
"default_model_placeholder": "gpt-3.5-turbo"
|
||||
},
|
||||
{
|
||||
"provider": "ZAI",
|
||||
"provider_display_name": "Z.AI (Zhipu AI)",
|
||||
"litellm_provider": "zai",
|
||||
"credential_fields": [
|
||||
{
|
||||
"key": "api_base",
|
||||
"label": "API Base",
|
||||
"placeholder": "https://api.z.ai/api/paas/v4",
|
||||
"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": "zai/glm-4.5"
|
||||
},
|
||||
{
|
||||
"provider": "ZeroGPU",
|
||||
"provider_display_name": "ZeroGPU",
|
||||
|
|
|
|||
|
|
@ -408,6 +408,34 @@ def test_cognition_provider_fields():
|
|||
assert fields_by_key["api_base"]["required"] is False
|
||||
|
||||
|
||||
def test_zai_provider_fields():
|
||||
from litellm.llms.zai.chat.transformation import ZAI_API_BASE
|
||||
|
||||
app_instance: Final = FastAPI()
|
||||
app_instance.include_router(router)
|
||||
test_client: Final = TestClient(app_instance)
|
||||
|
||||
response: Final = test_client.get("/public/providers/fields")
|
||||
assert response.status_code == 200
|
||||
providers: Final = response.json()
|
||||
|
||||
zai: Final = next((p for p in providers if p["provider"] == "ZAI"), None)
|
||||
assert zai is not None, "Z.AI provider entry not found"
|
||||
|
||||
assert zai["provider_display_name"] == "Z.AI (Zhipu AI)"
|
||||
assert zai["litellm_provider"] == "zai"
|
||||
assert zai["default_model_placeholder"].startswith("zai/")
|
||||
|
||||
fields_by_key: Final = {f["key"]: f for f in zai["credential_fields"]}
|
||||
|
||||
assert fields_by_key["api_key"]["required"] is True
|
||||
assert fields_by_key["api_key"]["field_type"] == "password"
|
||||
|
||||
assert fields_by_key["api_base"]["required"] is False
|
||||
assert fields_by_key["api_base"]["field_type"] == "text"
|
||||
assert fields_by_key["api_base"]["placeholder"] == ZAI_API_BASE
|
||||
|
||||
|
||||
def test_zerogpu_add_model_form_defaults_resolve_to_a_priced_zerogpu_model():
|
||||
import litellm
|
||||
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
|
||||
|
|
@ -611,7 +639,6 @@ ADD_MODEL_UNLISTED_PROVIDERS: Final = frozenset(
|
|||
"transcribe",
|
||||
"valkey",
|
||||
"xiaomi_mimo",
|
||||
"zai",
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue