mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
Feat/add watsonx fields (#18569)
This commit is contained in:
parent
44d309f270
commit
705b54bf04
3 changed files with 72 additions and 6 deletions
|
|
@ -2893,7 +2893,7 @@
|
|||
"key": "api_base",
|
||||
"label": "API Base",
|
||||
"placeholder": null,
|
||||
"tooltip": null,
|
||||
"tooltip": "Base URL of your WatsonX instance",
|
||||
"required": false,
|
||||
"field_type": "text",
|
||||
"options": null,
|
||||
|
|
@ -2903,14 +2903,54 @@
|
|||
"key": "api_key",
|
||||
"label": "API Key",
|
||||
"placeholder": null,
|
||||
"tooltip": null,
|
||||
"tooltip": "IBM Cloud API key. Required if not using Token or Zen API Key",
|
||||
"required": false,
|
||||
"field_type": "password",
|
||||
"options": null,
|
||||
"default_value": null
|
||||
},
|
||||
{
|
||||
"key": "token",
|
||||
"label": "IAM Token",
|
||||
"placeholder": null,
|
||||
"tooltip": "Pre-generated IAM bearer token. Use instead of API Key if you manage tokens externally",
|
||||
"required": false,
|
||||
"field_type": "password",
|
||||
"options": null,
|
||||
"default_value": null
|
||||
},
|
||||
{
|
||||
"key": "zen_api_key",
|
||||
"label": "Zen API Key",
|
||||
"placeholder": null,
|
||||
"tooltip": "Zen API Key for Cloud Pak for Data deployments. Use instead of API Key for on-premises",
|
||||
"required": false,
|
||||
"field_type": "password",
|
||||
"options": null,
|
||||
"default_value": null
|
||||
},
|
||||
{
|
||||
"key": "project_id",
|
||||
"label": "Project ID",
|
||||
"placeholder": null,
|
||||
"tooltip": "Optional: Your Watsonx.ai Project ID",
|
||||
"required": false,
|
||||
"field_type": "text",
|
||||
"options": null,
|
||||
"default_value": null
|
||||
},
|
||||
{
|
||||
"key": "space_id",
|
||||
"label": "Deployment Space ID",
|
||||
"placeholder": null,
|
||||
"tooltip": "Optional: Watsonx.ai Deployment Space ID",
|
||||
"required": false,
|
||||
"field_type": "text",
|
||||
"options": null,
|
||||
"default_value": null
|
||||
}
|
||||
],
|
||||
"default_model_placeholder": "gpt-3.5-turbo"
|
||||
"default_model_placeholder": "watsonx/ibm/granite-3-3-8b-instruct"
|
||||
},
|
||||
{
|
||||
"provider": "WATSONX_TEXT",
|
||||
|
|
|
|||
|
|
@ -78,3 +78,26 @@ def test_get_litellm_model_cost_map_returns_cost_map():
|
|||
# Check for common cost fields that should be present
|
||||
assert "input_cost_per_token" in sample_model_data or "output_cost_per_token" in sample_model_data
|
||||
|
||||
|
||||
def test_watsonx_provider_fields():
|
||||
"""Test that Watsonx provider has all required credential fields including multiple auth options."""
|
||||
app = FastAPI()
|
||||
app.include_router(router)
|
||||
client = TestClient(app)
|
||||
|
||||
response = client.get("/public/providers/fields")
|
||||
providers = response.json()
|
||||
|
||||
watsonx = next((p for p in providers if p["provider"] == "WATSONX"), None)
|
||||
assert watsonx is not None
|
||||
|
||||
field_keys = [f["key"] for f in watsonx["credential_fields"]]
|
||||
# Core fields
|
||||
assert "api_base" in field_keys
|
||||
assert "project_id" in field_keys
|
||||
assert "space_id" in field_keys
|
||||
# Multiple auth methods supported
|
||||
assert "api_key" in field_keys
|
||||
assert "token" in field_keys
|
||||
assert "zen_api_key" in field_keys
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
export enum Providers {
|
||||
A2A_Agent = "A2A Agent",
|
||||
AIML = "AI/ML API",
|
||||
|
|
@ -44,6 +43,7 @@ export enum Providers {
|
|||
Voyage = "Voyage AI",
|
||||
xAI = "xAI",
|
||||
SAP = "SAP Generative AI Hub",
|
||||
Watsonx = "Watsonx",
|
||||
}
|
||||
|
||||
export const provider_map: Record<string, string> = {
|
||||
|
|
@ -90,7 +90,8 @@ export const provider_map: Record<string, string> = {
|
|||
DeepInfra: "deepinfra",
|
||||
Hosted_Vllm: "hosted_vllm",
|
||||
Infinity: "infinity",
|
||||
SAP: "sap",
|
||||
SAP: "sap",
|
||||
Watsonx: "watsonx",
|
||||
};
|
||||
|
||||
const asset_logos_folder = "../ui/assets/logos/";
|
||||
|
|
@ -139,7 +140,7 @@ export const providerLogoMap: Record<string, string> = {
|
|||
[Providers.JinaAI]: `${asset_logos_folder}jina.png`,
|
||||
[Providers.VolcEngine]: `${asset_logos_folder}volcengine.png`,
|
||||
[Providers.DeepInfra]: `${asset_logos_folder}deepinfra.png`,
|
||||
[Providers.SAP]: `${asset_logos_folder}sap.png`,
|
||||
[Providers.SAP]: `${asset_logos_folder}sap.png`,
|
||||
};
|
||||
|
||||
export const getProviderLogoAndName = (providerValue: string): { logo: string; displayName: string } => {
|
||||
|
|
@ -203,6 +204,8 @@ export const getPlaceholder = (selectedProvider: string): string => {
|
|||
return "fal_ai/fal-ai/flux-pro/v1.1-ultra";
|
||||
} else if (selectedProvider == Providers.RunwayML) {
|
||||
return "runwayml/gen4_turbo";
|
||||
} else if (selectedProvider === Providers.Watsonx) {
|
||||
return "watsonx/ibm/granite-3-3-8b-instruct";
|
||||
} else {
|
||||
return "gpt-3.5-turbo";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue