Skip to content

Commit

Permalink
ui - get/set model retry policy
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaan-jaff committed May 7, 2024
1 parent 116e555 commit 4fdf114
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions ui/litellm-dashboard/src/components/model_dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 18,7 @@ import {
} from "@tremor/react";
import { TabPanel, TabPanels, TabGroup, TabList, Tab, TextInput, Icon, DateRangePicker } from "@tremor/react";
import { Select, SelectItem, MultiSelect, MultiSelectItem, DateRangePickerValue } from "@tremor/react";
import { modelInfoCall, userGetRequesedtModelsCall, modelCreateCall, Model, modelCostMap, modelDeleteCall, healthCheckCall, modelUpdateCall, modelMetricsCall, modelExceptionsCall, modelMetricsSlowResponsesCall, getCallbacksCall } from "./networking";
import { modelInfoCall, userGetRequesedtModelsCall, modelCreateCall, Model, modelCostMap, modelDeleteCall, healthCheckCall, modelUpdateCall, modelMetricsCall, modelExceptionsCall, modelMetricsSlowResponsesCall, getCallbacksCall, setCallbacksCall } from "./networking";
import { BarChart, AreaChart } from "@tremor/react";
import {
Button as Button2,
Expand Down Expand Up @@ -443,6 443,29 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
setLastRefreshed(currentDate.toLocaleString());
};

const handleSaveRetrySettings = async () => {
if (!accessToken) {
console.error("Access token is missing");
return;
}

console.log("new modelGroupRetryPolicy:", modelGroupRetryPolicy);

try {
const payload = {
router_settings: {
model_group_retry_policy: modelGroupRetryPolicy
}
};

await setCallbacksCall(accessToken, payload);
message.success("Retry settings saved successfully");
} catch (error) {
console.error("Failed to save retry settings:", error);
message.error("Failed to save retry settings");
}
};


useEffect(() => {
if (!accessToken || !token || !userRole || !userID) {
Expand Down Expand Up @@ -1277,7 1300,8 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
<table>
<tbody>
{Object.entries(retry_policy_map).map(([exceptionType, retryPolicyKey], idx) => {
let retryCount = (modelGroupRetryPolicy[selectedModelGroup] ?? {})[retryPolicyKey];

let retryCount = modelGroupRetryPolicy?.[selectedModelGroup]?.[retryPolicyKey]
if (retryCount == null) {
retryCount = defaultRetry;
}
Expand Down Expand Up @@ -1310,7 1334,7 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
</tbody>
</table>
}
<Button className="mt-6 mr-8">
<Button className="mt-6 mr-8" onClick={handleSaveRetrySettings}>
Save
</Button>

Expand Down

0 comments on commit 4fdf114

Please sign in to comment.