From 93d41fbe0ec5018d0c2cb5ef2e35a17ac617b214 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 28 Mar 2024 14:41:16 -0700 Subject: [PATCH 1/3] (fix) clean up team table --- ui/litellm-dashboard/src/components/teams.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/litellm-dashboard/src/components/teams.tsx b/ui/litellm-dashboard/src/components/teams.tsx index f1d5d65556..b438f379ac 100644 --- a/ui/litellm-dashboard/src/components/teams.tsx +++ b/ui/litellm-dashboard/src/components/teams.tsx @@ -187,9 +187,9 @@ const Team: React.FC = ({ - TPM Limit:{" "} + TPM:{" "} {team.tpm_limit ? team.tpm_limit : "Unlimited"}{" "} -

RPM Limit:{" "} +

RPM:{" "} {team.rpm_limit ? team.rpm_limit : "Unlimited"}
From 7b998f9b9103a1ddf057aaae0e1b5ac5168b5bc4 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 28 Mar 2024 14:56:15 -0700 Subject: [PATCH 2/3] (fix) show models on team tab easily --- litellm/proxy/proxy_config.yaml | 39 +++++++++++++++++-- ui/litellm-dashboard/src/components/teams.tsx | 13 ++++++- .../src/components/view_key_table.tsx | 23 +++++++---- 3 files changed, 63 insertions(+), 12 deletions(-) diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yaml index dc50067cb5..f5f05891ea 100644 --- a/litellm/proxy/proxy_config.yaml +++ b/litellm/proxy/proxy_config.yaml @@ -1,10 +1,43 @@ model_list: - - model_name: azure-gpt-3.5 + + - model_name: gpt-3.5-turbo litellm_params: model: azure/chatgpt-v-2 - api_base: os.environ/AZURE_API_BASE + api_base: https://openai-gpt-4-test-v-1.openai.azure.com/ + api_version: "2023-05-15" + api_key: os.environ/AZURE_API_KEY # The `os.environ/` prefix tells litellm to read this from the env. See https://docs.litellm.ai/docs/simple_proxy#load-api-keys-from-vault + - model_name: gpt-3.5-turbo-large + litellm_params: + model: "gpt-3.5-turbo-1106" + api_key: os.environ/OPENAI_API_KEY + - model_name: gpt-4 + litellm_params: + model: azure/chatgpt-v-2 + api_base: https://openai-gpt-4-test-v-1.openai.azure.com/ + api_version: "2023-05-15" + api_key: os.environ/AZURE_API_KEY # The `os.environ/` prefix tells litellm to read this from the env. See https://docs.litellm.ai/docs/simple_proxy#load-api-keys-from-vault + - model_name: sagemaker-completion-model + litellm_params: + model: sagemaker/berri-benchmarking-Llama-2-70b-chat-hf-4 + input_cost_per_second: 0.000420 + - model_name: text-embedding-ada-002 + litellm_params: + model: azure/azure-embedding-model api_key: os.environ/AZURE_API_KEY - api_version: "2023-07-01-preview" + api_base: https://openai-gpt-4-test-v-1.openai.azure.com/ + api_version: "2023-05-15" + model_info: + mode: embedding + base_model: text-embedding-ada-002 + - model_name: dall-e-2 + litellm_params: + model: azure/ + api_version: 2023-06-01-preview + api_base: https://openai-gpt-4-test-v-1.openai.azure.com/ + api_key: os.environ/AZURE_API_KEY + - model_name: openai-dall-e-3 + litellm_params: + model: dall-e-3 - model_name: fake-openai-endpoint litellm_params: model: openai/fake diff --git a/ui/litellm-dashboard/src/components/teams.tsx b/ui/litellm-dashboard/src/components/teams.tsx index b438f379ac..36cc5c5822 100644 --- a/ui/litellm-dashboard/src/components/teams.tsx +++ b/ui/litellm-dashboard/src/components/teams.tsx @@ -21,6 +21,7 @@ import { Card, Icon, Button, + Badge, Col, Text, Grid, @@ -182,8 +183,16 @@ const Team: React.FC = ({ {team["max_budget"] ? team["max_budget"] : "No limit"} - - {JSON.stringify(team["models"] ? team["models"] : [])} + + {Array.isArray(team.models) ? ( +
+ {team.models.map((model: string, index: number) => ( + + {model.length > 30 ? `${model.slice(0, 30)}...` : model} + + ))} +
+ ) : null}
diff --git a/ui/litellm-dashboard/src/components/view_key_table.tsx b/ui/litellm-dashboard/src/components/view_key_table.tsx index 5136934304..f4b39cb28c 100644 --- a/ui/litellm-dashboard/src/components/view_key_table.tsx +++ b/ui/litellm-dashboard/src/components/view_key_table.tsx @@ -85,9 +85,9 @@ const ViewKeyTable: React.FC = ({ Key Alias Secret Key Spend (USD) - Key Budget (USD) + Budget (USD) Spend Report - Team ID + Team Metadata Models TPM / RPM Limits @@ -128,7 +128,7 @@ const ViewKeyTable: React.FC = ({ {item.max_budget != null ? ( {item.max_budget} ) : ( - Unlimited Budget + Unlimited )} @@ -147,13 +147,22 @@ const ViewKeyTable: React.FC = ({ {JSON.stringify(item.metadata).slice(0, 400)} - - {JSON.stringify(item.models)} + + + {Array.isArray(item.models) ? ( +
+ {item.models.map((model: string, index: number) => ( + + {model.length > 30 ? `${model.slice(0, 30)}...` : model} + + ))} +
+ ) : null}
- TPM Limit: {item.tpm_limit ? item.tpm_limit : "Unlimited"}{" "} -

RPM Limit:{" "} + TPM: {item.tpm_limit ? item.tpm_limit : "Unlimited"}{" "} +

RPM:{" "} {item.rpm_limit ? item.rpm_limit : "Unlimited"}
From fc79e8255c9b1e7b6134730fa598c8df63a15ef8 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 28 Mar 2024 15:08:21 -0700 Subject: [PATCH 3/3] (fix) actually view the spend report on the UI --- litellm/proxy/proxy_server.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 2fe4a3523d..5caffefb35 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -5289,8 +5289,6 @@ async def user_info( except: # if using pydantic v1 key = key.dict() - key.pop("token", None) - if ( "team_id" in key and key["team_id"] is not None