From ee066481f8c0e34f668cc597fa2a45ca68c5be8c Mon Sep 17 00:00:00 2001 From: Krish Dholakia Date: Sat, 19 Jul 2025 14:30:38 -0700 Subject: [PATCH] UI - Support 'batch' model health checks + make 'team-only' model concept clearer (#12770) * fix(add_model_modes.tsx): add 'batch' mode to ui * fix(main.py): support health checks on batches + support litellm_credentials on batches * fix(add_model_tab.tsx): clarify what 'team' on add model means --- litellm/batches/main.py | 3 ++ litellm/main.py | 7 ++- .../index.html} | 0 .../proxy/_experimental/out/onboarding.html | 1 - .../components/add_model/add_model_modes.tsx | 3 +- .../components/add_model/add_model_tab.tsx | 53 +++++++++++++++---- .../common_components/team_dropdown.tsx | 5 +- .../src/components/model_dashboard.tsx | 1 + 8 files changed, 57 insertions(+), 16 deletions(-) rename litellm/proxy/_experimental/out/{model_hub_table.html => model_hub_table/index.html} (100%) delete mode 100644 litellm/proxy/_experimental/out/onboarding.html diff --git a/litellm/batches/main.py b/litellm/batches/main.py index 98527556226..3ea0f95157f 100644 --- a/litellm/batches/main.py +++ b/litellm/batches/main.py @@ -469,6 +469,7 @@ def retrieve_batch( raise e +@client async def alist_batches( after: Optional[str] = None, limit: Optional[int] = None, @@ -481,6 +482,7 @@ async def alist_batches( """ Async: List your organization's batches. """ + try: loop = asyncio.get_event_loop() kwargs["alist_batches"] = True @@ -510,6 +512,7 @@ async def alist_batches( raise e +@client def list_batches( after: Optional[str] = None, limit: Optional[int] = None, diff --git a/litellm/main.py b/litellm/main.py index 668109e0c17..e0b76d57a6a 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -2925,7 +2925,7 @@ def completion( # type: ignore # noqa: PLR0915 acompletion=acompletion, client=client, api_base=api_base, - api_key=api_key + api_key=api_key, ) elif bedrock_route == "converse_like": model = model.replace("converse_like/", "") @@ -3306,7 +3306,7 @@ def completion( # type: ignore # noqa: PLR0915 custom_llm_provider=custom_llm_provider, encoding=encoding, stream=stream, - provider_config=bytez_transformation + provider_config=bytez_transformation, ) pass @@ -5563,6 +5563,9 @@ async def ahealth_check( api_key=model_params.get("api_key", None), api_version=model_params.get("api_version", None), ), + "batch": lambda: litellm.alist_batches( + **_filter_model_params(model_params), + ), } if mode in mode_handlers: diff --git a/litellm/proxy/_experimental/out/model_hub_table.html b/litellm/proxy/_experimental/out/model_hub_table/index.html similarity index 100% rename from litellm/proxy/_experimental/out/model_hub_table.html rename to litellm/proxy/_experimental/out/model_hub_table/index.html diff --git a/litellm/proxy/_experimental/out/onboarding.html b/litellm/proxy/_experimental/out/onboarding.html deleted file mode 100644 index 15c00b700a6..00000000000 --- a/litellm/proxy/_experimental/out/onboarding.html +++ /dev/null @@ -1 +0,0 @@ -LiteLLM Dashboard \ No newline at end of file diff --git a/ui/litellm-dashboard/src/components/add_model/add_model_modes.tsx b/ui/litellm-dashboard/src/components/add_model/add_model_modes.tsx index 2b544fd1900..2ddcf4984c3 100644 --- a/ui/litellm-dashboard/src/components/add_model/add_model_modes.tsx +++ b/ui/litellm-dashboard/src/components/add_model/add_model_modes.tsx @@ -7,5 +7,6 @@ export const TEST_MODES = [ { value: "audio_transcription", label: "Audio Transcription - /audio/transcriptions" }, { value: "image_generation", label: "Image Generation - /images/generations" }, { value: "rerank", label: "Rerank - /rerank" }, - { value: "realtime", label: "Realtime - /realtime"} + { value: "realtime", label: "Realtime - /realtime"}, + { value: "batch", label: "Batch - /batch"} ]; \ No newline at end of file diff --git a/ui/litellm-dashboard/src/components/add_model/add_model_tab.tsx b/ui/litellm-dashboard/src/components/add_model/add_model_tab.tsx index 2bd376af7fb..d128435a4fc 100644 --- a/ui/litellm-dashboard/src/components/add_model/add_model_tab.tsx +++ b/ui/litellm-dashboard/src/components/add_model/add_model_tab.tsx @@ -12,7 +12,7 @@ import { CredentialItem, modelAvailableCall } from "../networking"; import ConnectionErrorDisplay from "./model_connection_test"; import { TEST_MODES } from "./add_model_modes"; import { Row, Col } from "antd"; -import { Text, TextInput } from "@tremor/react"; +import { Text, TextInput, Switch } from "@tremor/react"; import TeamDropdown from "../common_components/team_dropdown"; import { all_admin_roles } from "@/utils/roles"; @@ -31,6 +31,7 @@ interface AddModelTabProps { credentials: CredentialItem[]; accessToken: string; userRole: string; + premiumUser: boolean; } const { Title, Link } = Typography; @@ -50,6 +51,7 @@ const AddModelTab: React.FC = ({ credentials, accessToken, userRole, + premiumUser, }) => { // State for test mode and connection testing const [testMode, setTestMode] = useState("chat"); @@ -68,6 +70,9 @@ const AddModelTab: React.FC = ({ setIsResultModalVisible(true); }; + // State for team-only switch + const [isTeamOnly, setIsTeamOnly] = useState(false); + const [modelAccessGroups, setModelAccessGroups] = useState([]); useEffect(() => { @@ -238,20 +243,46 @@ const AddModelTab: React.FC = ({ Additional Model Info Settings
+ {/* Team-only Model Switch */} - + + { + setIsTeamOnly(checked); + if (!checked) { + form.setFieldValue('team_id', undefined); + } + }} + disabled={!premiumUser} + /> + + + {/* Conditional Team Selection */} + {isTeamOnly && ( + + + + )} { isAdmin && ( <> diff --git a/ui/litellm-dashboard/src/components/common_components/team_dropdown.tsx b/ui/litellm-dashboard/src/components/common_components/team_dropdown.tsx index 3a318d1820b..367977dac52 100644 --- a/ui/litellm-dashboard/src/components/common_components/team_dropdown.tsx +++ b/ui/litellm-dashboard/src/components/common_components/team_dropdown.tsx @@ -6,15 +6,18 @@ interface TeamDropdownProps { teams?: Team[] | null; value?: string; onChange?: (value: string) => void; + disabled?: boolean; } -const TeamDropdown: React.FC = ({ teams, value, onChange }) => { +const TeamDropdown: React.FC = ({ teams, value, onChange, disabled }) => { + console.log("disabled", disabled); return (