diff --git a/ui/litellm-dashboard/src/components/model_dashboard.tsx b/ui/litellm-dashboard/src/components/model_dashboard.tsx index 66e0bd6340..591e497c0f 100644 --- a/ui/litellm-dashboard/src/components/model_dashboard.tsx +++ b/ui/litellm-dashboard/src/components/model_dashboard.tsx @@ -49,6 +49,8 @@ import { getCallbacksCall, setCallbacksCall, modelSettingsCall, + adminGlobalActivityExceptions, + adminGlobalActivityExceptionsPerDeployment, } from "./networking"; import { BarChart, AreaChart } from "@tremor/react"; import { @@ -109,6 +111,13 @@ interface RetryPolicyObject { [key: string]: { [retryPolicyKey: string]: number } | undefined; } + +interface GlobalExceptionActivityData { + sum_num_exceptions: number; + daily_data: { date: string; num_exceptions: number; }[]; +} + + //["OpenAI", "Azure OpenAI", "Anthropic", "Gemini (Google AI Studio)", "Amazon Bedrock", "OpenAI-Compatible Endpoints (Groq, Together AI, Mistral AI, etc.)"] interface ProviderFields { @@ -301,6 +310,8 @@ const ModelDashboard: React.FC = ({ useState(null); const [defaultRetry, setDefaultRetry] = useState(0); + const [globalExceptionData, setGlobalExceptionData] = useState([]); + function formatCreatedAt(createdAt: string | null) { if (createdAt) { const date = new Date(createdAt); @@ -643,6 +654,13 @@ const ModelDashboard: React.FC = ({ dateValue.to?.toISOString() ); + const dailExceptions = await adminGlobalActivityExceptions( + accessToken, + dateValue.from?.toISOString(), + dateValue.to?.toISOString() + ); + + console.log("slowResponses:", slowResponses); setSlowResponsesData(slowResponses); diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx index 5299c0392a..d808166383 100644 --- a/ui/litellm-dashboard/src/components/networking.tsx +++ b/ui/litellm-dashboard/src/components/networking.tsx @@ -1195,6 +1195,95 @@ export const adminGlobalActivityPerModel = async ( } }; + + +export const adminGlobalActivityExceptions = async ( + accessToken: String, + startTime: String | undefined, + endTime: String | undefined, + modelGroup: String, +) => { + try { + let url = proxyBaseUrl + ? `${proxyBaseUrl}/global/activity/exceptions` + : `/global/activity/exceptions`; + + if (startTime && endTime) { + url += `?start_date=${startTime}&end_date=${endTime}`; + } + + if (modelGroup) { + url += `&model_group=${modelGroup}`; + } + + const requestOptions: { + method: string; + headers: { + Authorization: string; + }; + } = { + method: "GET", + headers: { + Authorization: `Bearer ${accessToken}`, + }, + }; + + const response = await fetch(url, requestOptions); + + if (!response.ok) { + const errorData = await response.text(); + throw new Error("Network response was not ok"); + } + const data = await response.json(); + console.log(data); + return data; + } catch (error) { + console.error("Failed to fetch spend data:", error); + throw error; + } +}; + +export const adminGlobalActivityExceptionsPerDeployment = async ( + accessToken: String, + startTime: String | undefined, + endTime: String | undefined +) => { + try { + let url = proxyBaseUrl + ? `${proxyBaseUrl}/global/activity/exceptions/deployment` + : `/global/activity/exceptions/deployment`; + + if (startTime && endTime) { + url += `?start_date=${startTime}&end_date=${endTime}`; + } + + const requestOptions: { + method: string; + headers: { + Authorization: string; + }; + } = { + method: "GET", + headers: { + Authorization: `Bearer ${accessToken}`, + }, + }; + + const response = await fetch(url, requestOptions); + + if (!response.ok) { + const errorData = await response.text(); + throw new Error("Network response was not ok"); + } + const data = await response.json(); + console.log(data); + return data; + } catch (error) { + console.error("Failed to fetch spend data:", error); + throw error; + } +}; + export const adminTopModelsCall = async (accessToken: String) => { try { let url = proxyBaseUrl