fix adminGlobalActivityExceptions

This commit is contained in:
Ishaan Jaff 2024-05-30 18:08:20 -07:00
parent e981f342bc
commit d78492b050
2 changed files with 107 additions and 0 deletions

View file

@ -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<ModelDashboardProps> = ({
useState<RetryPolicyObject | null>(null);
const [defaultRetry, setDefaultRetry] = useState<number>(0);
const [globalExceptionData, setGlobalExceptionData] = useState<GlobalExceptionActivityData[]>([]);
function formatCreatedAt(createdAt: string | null) {
if (createdAt) {
const date = new Date(createdAt);
@ -643,6 +654,13 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({
dateValue.to?.toISOString()
);
const dailExceptions = await adminGlobalActivityExceptions(
accessToken,
dateValue.from?.toISOString(),
dateValue.to?.toISOString()
);
console.log("slowResponses:", slowResponses);
setSlowResponsesData(slowResponses);