Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
});

it("should return empty logo and dash display name when providerValue is undefined", () => {
const result = getProviderLogoAndName(undefined as any);

Check warning on line 19 in ui/litellm-dashboard/src/components/provider_info_helpers.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
expect(result).toEqual({ logo: "", displayName: "-" });
});

Expand Down Expand Up @@ -208,7 +208,7 @@
});

it("should return default gpt-3.5-turbo placeholder for unknown provider", () => {
expect(getPlaceholder("UnknownProvider" as any)).toBe("gpt-3.5-turbo");

Check warning on line 211 in ui/litellm-dashboard/src/components/provider_info_helpers.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
});

it("should return default gpt-3.5-turbo placeholder for OpenAI provider", () => {
Expand All @@ -225,17 +225,17 @@

it("should return empty array when provider is not provided", () => {
const modelMap = {};
const result = getProviderModels(undefined as any, modelMap);

Check warning on line 228 in ui/litellm-dashboard/src/components/provider_info_helpers.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
expect(result).toEqual([]);
});

it("should return empty array when modelMap is not an object type", () => {
const result = getProviderModels(Providers.OpenAI, "not-an-object" as any);

Check warning on line 233 in ui/litellm-dashboard/src/components/provider_info_helpers.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
expect(result).toEqual([]);
});

it("should return empty array when modelMap is undefined", () => {
const result = getProviderModels(Providers.OpenAI, undefined as any);

Check warning on line 238 in ui/litellm-dashboard/src/components/provider_info_helpers.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
expect(result).toEqual([]);
});

Expand Down Expand Up @@ -308,17 +308,17 @@
expect(result).not.toContain("anthropic-native");
});

it("should include bedrock variants (converse, mantle) when called with 'Bedrock' provider key", () => {
it("should include bedrock converse but exclude standalone bedrock_mantle when called with 'Bedrock' provider key", () => {
const modelMap = {
"bedrock-base": { litellm_provider: "bedrock" },
"bedrock-converse-model": { litellm_provider: "bedrock_converse" },
"bedrock-mantle-model": { litellm_provider: "bedrock_mantle" },
"bedrock_mantle/openai.gpt-5.4": { litellm_provider: "bedrock_mantle" },
"openai-model": { litellm_provider: "openai" },
};
const result = getProviderModels("Bedrock" as Providers, modelMap);
expect(result).toContain("bedrock-base");
expect(result).toContain("bedrock-converse-model");
expect(result).toContain("bedrock-mantle-model");
expect(result).not.toContain("bedrock_mantle/openai.gpt-5.4");
expect(result).not.toContain("openai-model");
});

Expand Down
10 changes: 7 additions & 3 deletions ui/litellm-dashboard/src/components/provider_info_helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@
ZAI: "zai",
};

const standaloneSubproviderSlugs = new Set<string>(["bedrock_mantle"]);

const asset_logos_folder = "/ui/assets/logos/";

export const providerLogoMap: Record<string, string> = {
Expand Down Expand Up @@ -382,7 +384,7 @@
}
};

export const getProviderModels = (provider: Providers, modelMap: any): Array<string> => {

Check warning on line 387 in ui/litellm-dashboard/src/components/provider_info_helpers.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
let providerKey = provider;
console.log(`Provider key: ${providerKey}`);
let custom_llm_provider = provider_map[providerKey];
Expand All @@ -393,12 +395,14 @@
if (providerKey && typeof modelMap === "object") {
Object.entries(modelMap).forEach(([key, value]) => {
if (value !== null && typeof value === "object" && "litellm_provider" in (value as object)) {
const litellmProvider = (value as any)["litellm_provider"];

Check warning on line 398 in ui/litellm-dashboard/src/components/provider_info_helpers.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
const isPrefixVariant =
typeof litellmProvider === "string" &&
(litellmProvider.startsWith(`${custom_llm_provider}_`) ||
litellmProvider.startsWith(`${custom_llm_provider}-`));
if (
litellmProvider === custom_llm_provider ||
(typeof litellmProvider === "string" &&
(litellmProvider.startsWith(`${custom_llm_provider}_`) ||
litellmProvider.startsWith(`${custom_llm_provider}-`)))
(isPrefixVariant && !standaloneSubproviderSlugs.has(litellmProvider))
) {
providerModels.push(key);
}
Expand All @@ -413,7 +417,7 @@
value !== null &&
typeof value === "object" &&
"litellm_provider" in (value as object) &&
(value as any)["litellm_provider"] === "cohere_chat"

Check warning on line 420 in ui/litellm-dashboard/src/components/provider_info_helpers.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
) {
providerModels.push(key);
}
Expand All @@ -429,7 +433,7 @@
value !== null &&
typeof value === "object" &&
"litellm_provider" in (value as object) &&
(value as any)["litellm_provider"] === "sagemaker_chat"

Check warning on line 436 in ui/litellm-dashboard/src/components/provider_info_helpers.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
) {
providerModels.push(key);
}
Expand Down
Loading