Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

style(ui): format complexity router files

yuneng4117d9f7860b
diff --git a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterAdvancedSections.tsx b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterAdvancedSections.tsx
index 0412298ccdd..71f8bce76b5 100644
--- a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterAdvancedSections.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterAdvancedSections.tsx
@@ -130,7 +130,9 @@ const ComplexityRouterAdvancedSections: React.FC<ComplexityRouterAdvancedSection
{
key: "plan-mode",
label: <strong className="text-foreground font-semibold">Advanced: Plan-Mode Override</strong>,
- children: <PlanModeOverrideControls value={value} onChange={onChange} planModeTierOptions={planModeTierOptions} />,
+ children: (
+ <PlanModeOverrideControls value={value} onChange={onChange} planModeTierOptions={planModeTierOptions} />
+ ),
},
{
key: "housekeeping",
@@ -195,9 +197,7 @@ const ComplexityRouterAdvancedSections: React.FC<ComplexityRouterAdvancedSection
rules={keywordTierRules}
onChange={onKeywordTierRulesChange}
tierLabels={value.tier_labels}
- tierNames={
- customTierSet || forecast ? tierRows.map(activeTierName).filter(Boolean) : undefined
- }
+ tierNames={customTierSet || forecast ? tierRows.map(activeTierName).filter(Boolean) : undefined}
/>
)}
{onKeywordTierRulesChange && onSemanticMatchingEnabledChange && <Separator className="my-4" />}
diff --git a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx
index 9a8577100df..56b37b92af3 100644
--- a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx
@@ -106,7 +106,6 @@ describe("ComplexityRouterConfig", () => {
const capabilityValue = { ...defaultValue, classifier_type: "capability" as const };
rerender(<ComplexityRouterConfig {...baseProps} value={capabilityValue} />);
expect(screen.queryByText("Advanced: Heuristic Keyword Overrides")).not.toBeInTheDocument();
-
});
it.each([
@@ -127,11 +126,7 @@ describe("ComplexityRouterConfig", () => {
it.each([true, false])("shows reminder marker validation only when requested: %s", (showValidationErrors) => {
const value = { ...defaultValue, reminder_markers: [{ open: "", close: "x" }] };
renderWithProviders(
- <ComplexityRouterConfig
- {...baseProps}
- value={value}
- showValidationErrors={showValidationErrors}
- />,
+ <ComplexityRouterConfig {...baseProps} value={value} showValidationErrors={showValidationErrors} />,
);
fireEvent.click(screen.getByText("Advanced: Reminder Markers"));
const validation = screen.queryByText(/needs both/i);
@@ -144,10 +139,7 @@ describe("ComplexityRouterConfig", () => {
it("disables housekeeping sentinels when cheapest-tier routing is off", () => {
renderWithProviders(
- <ComplexityRouterConfig
- {...baseProps}
- value={{ ...defaultValue, route_housekeeping_to_cheapest_tier: false }}
- />,
+ <ComplexityRouterConfig {...baseProps} value={{ ...defaultValue, route_housekeeping_to_cheapest_tier: false }} />,
);
fireEvent.click(screen.getByText("Advanced: Housekeeping Routing"));
const sentinelInput = screen.getByRole("combobox", { name: "e.g., conversation title" });
diff --git a/ui/litellm-dashboard/src/components/add_model/HeuristicKeywordOverrides.tsx b/ui/litellm-dashboard/src/components/add_model/HeuristicKeywordOverrides.tsx
index 696924f4e77..185f187bbfc 100644
--- a/ui/litellm-dashboard/src/components/add_model/HeuristicKeywordOverrides.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/HeuristicKeywordOverrides.tsx
@@ -15,8 +15,8 @@ const HeuristicKeywordOverrides: React.FC<{
}> = ({ value, onChange }) => (
<div className="space-y-3">
<p className="text-sm text-muted-foreground">
- Each list replaces the built-in keyword list of the same name for the heuristic scorer. Leave a list empty to
- keep the built-in one. To add technical terms without replacing the list, use custom technical keywords under
+ Each list replaces the built-in keyword list of the same name for the heuristic scorer. Leave a list empty to keep
+ the built-in one. To add technical terms without replacing the list, use custom technical keywords under
Classification Method.
</p>
{fields.map(([key, label]) => {
diff --git a/ui/litellm-dashboard/src/components/add_model/ReminderMarkers.tsx b/ui/litellm-dashboard/src/components/add_model/ReminderMarkers.tsx
index 970394291d4..c7f9ee48e0b 100644
--- a/ui/litellm-dashboard/src/components/add_model/ReminderMarkers.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/ReminderMarkers.tsx
@@ -14,7 +14,9 @@ const ReminderMarkers: React.FC<{
const update = (index: number, patch: Partial<ReminderMarkerPair>) =>
onChange({
...value,
- reminder_markers: markers.map((marker, markerIndex) => (markerIndex === index ? { ...marker, ...patch } : marker)),
+ reminder_markers: markers.map((marker, markerIndex) =>
+ markerIndex === index ? { ...marker, ...patch } : marker,
+ ),
});
const remove = (index: number) => {
const next = markers.filter((_, markerIndex) => markerIndex !== index);
@@ -24,9 +26,9 @@ const ReminderMarkers: React.FC<{
return (
<div>
<p className="mb-4 text-sm text-muted-foreground">
- Delimiter pairs that wrap harness-injected reminder blocks, which are stripped before classification. Setting any
- pair replaces the built-in pairs, so list every pair your harness emits. Matching is case-insensitive and values
- are saved lowercased.
+ Delimiter pairs that wrap harness-injected reminder blocks, which are stripped before classification. Setting
+ any pair replaces the built-in pairs, so list every pair your harness emits. Matching is case-insensitive and
+ values are saved lowercased.
</p>
<div className="space-y-3">
{markers.map((marker, index) => (
@@ -53,7 +55,12 @@ const ReminderMarkers: React.FC<{
onChange={(event) => update(index, { close: event.target.value })}
/>
</div>
- <Button variant="ghost" size="icon" aria-label={`Remove reminder marker pair ${index + 1}`} onClick={() => remove(index)}>
+ <Button
+ variant="ghost"
+ size="icon"
+ aria-label={`Remove reminder marker pair ${index + 1}`}
+ onClick={() => remove(index)}
+ >
<Trash2 />
</Button>
</div>
diff --git a/ui/litellm-dashboard/src/components/add_model/ResponseFormatControls.tsx b/ui/litellm-dashboard/src/components/add_model/ResponseFormatControls.tsx
index 9edbf204a6d..6e7b1489a4c 100644
--- a/ui/litellm-dashboard/src/components/add_model/ResponseFormatControls.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/ResponseFormatControls.tsx
@@ -27,8 +27,8 @@ const ResponseFormatControls: React.FC<{
<strong className="font-semibold">Cap max_tokens at the tier model&apos;s output ceiling</strong>
</div>
<span className="block text-xs text-muted-foreground">
- Replace the caller&apos;s max_tokens with the routed tier model&apos;s output ceiling so one client value fits every
- tier. Off forwards the caller&apos;s value unchanged.
+ Replace the caller&apos;s max_tokens with the routed tier model&apos;s output ceiling so one client value fits
+ every tier. Off forwards the caller&apos;s value unchanged.
</span>
</>
);
diff --git a/ui/litellm-dashboard/src/components/add_model/build_complexity_router_config.ts b/ui/litellm-dashboard/src/components/add_model/build_complexity_router_config.ts
index 4782a58513d..ca46e171970 100644
--- a/ui/litellm-dashboard/src/components/add_model/build_complexity_router_config.ts
+++ b/ui/litellm-dashboard/src/components/add_model/build_complexity_router_config.ts
@@ -752,9 +752,7 @@ export const buildComplexityRouterConfig = ({
plan_mode_patterns: cleanList(planModePatterns),
housekeeping_patterns: cleanList(housekeepingPatterns),
};
- const cleanedLists = Object.fromEntries(
- Object.entries(cleanedListValues).filter(([, list]) => list !== undefined),
- );
+ const cleanedLists = Object.fromEntries(Object.entries(cleanedListValues).filter(([, list]) => list !== undefined));
const hasValidCustomClassifierTimeout =
classifierType === "custom" &&
classifierPluginTimeoutMs !== undefined &&
diff --git a/ui/litellm-dashboard/src/components/edit_auto_router/edit_auto_router_modal.tsx b/ui/litellm-dashboard/src/components/edit_auto_router/edit_auto_router_modal.tsx
index e6f1ccd0e17..0dafa9b330a 100644
--- a/ui/litellm-dashboard/src/components/edit_auto_router/edit_auto_router_modal.tsx
+++ b/ui/litellm-dashboard/src/components/edit_auto_router/edit_auto_router_modal.tsx
@@ -1,10 +1,7 @@
import AutoRouterClassifierTabs from "../add_model/AutoRouterClassifierTabs";
import { usesClassifierContext } from "../add_model/classifier_types";
export type { StoredComplexityRouterConfig } from "../add_model/build_complexity_router_config";
-import {
- getForecastConfigError,
- isForecastClassifier,
-} from "../add_model/forecast_classifier_config";
+import { getForecastConfigError, isForecastClassifier } from "../add_model/forecast_classifier_config";
import React, { useEffect, useMemo, useState } from "react";
import {
complexityRouterSchema,
@@ -457,7 +454,13 @@ const EditAutoRouterModal: React.FC<EditAutoRouterModalProps> = ({
// Dual write: complexity_router_config.default_model (the pin marker hydratePinnedDefaultModel
// reads back) and complexity_router_default_model (what the backend routes on) must always be
// written together from the same value. Same pairing in add_auto_router_tab.tsx.
- const keywordMatching = { keywordTierRules, escalationKeywords, semanticMatchingEnabled, embeddingModel, matchThreshold };
+ const keywordMatching = {
+ keywordTierRules,
+ escalationKeywords,
+ semanticMatchingEnabled,
+ embeddingModel,
+ matchThreshold,
+ };
const updatedConfig = buildUpdatedComplexityRouterConfig(
modelData.litellm_params?.complexity_router_config,
complexityRouterConfig,
diff --git a/ui/litellm-dashboard/src/components/edit_auto_router/hydrate_complexity_router_config.ts b/ui/litellm-dashboard/src/components/edit_auto_router/hydrate_complexity_router_config.ts
index b3a9ae0a504..6dbd2b19b52 100644
--- a/ui/litellm-dashboard/src/components/edit_auto_router/hydrate_complexity_router_config.ts
+++ b/ui/litellm-dashboard/src/components/edit_auto_router/hydrate_complexity_router_config.ts
@@ -24,9 +24,7 @@ import {
resolveComplexityDefaultModel,
} from "../add_model/tier_rows";
-const isReminderMarkerPair = (
- input: unknown,
-): input is { open: string; close: string } => {
+const isReminderMarkerPair = (input: unknown): input is { open: string; close: string } => {
if (typeof input !== "object" || input === null) {
return false;
}
@@ -176,9 +174,12 @@ export const hydrateComplexityRouterConfig = (
? parsedConfig.reminder_markers.filter(isReminderMarkerPair)
: undefined,
max_tokens_from_tier_model:
- typeof parsedConfig.max_tokens_from_tier_model === "boolean" ? parsedConfig.max_tokens_from_tier_model : undefined,
+ typeof parsedConfig.max_tokens_from_tier_model === "boolean"
+ ? parsedConfig.max_tokens_from_tier_model
+ : undefined,
classifier_plugin_timeout_ms:
- typeof parsedConfig.classifier_plugin_timeout_ms === "number" && Number.isFinite(parsedConfig.classifier_plugin_timeout_ms)
+ typeof parsedConfig.classifier_plugin_timeout_ms === "number" &&
+ Number.isFinite(parsedConfig.classifier_plugin_timeout_ms)
? parsedConfig.classifier_plugin_timeout_ms
: undefined,
};