mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix(ui): stop listing bedrock_mantle models under the Bedrock provider (#31478)
The Add Model form's getProviderModels rolled any litellm_provider that
starts with the selected provider's slug into that provider's list. Because
"bedrock_mantle".startsWith("bedrock_") is true, bedrock_mantle/* models
(OpenAI-compatible, served at bedrock-mantle.{region}.api.aws) showed up
under plain Amazon Bedrock, where that model string routes to bedrock-runtime
and fails.
Exclude standalone sub-providers from the prefix rollup so bedrock_mantle/*
only appears under the Amazon Bedrock Mantle provider, while bedrock_converse
and other genuine sub-variants keep rolling up under Bedrock.
This commit is contained in:
parent
ec4e0146c7
commit
01efcc1b74
2 changed files with 10 additions and 6 deletions
|
|
@ -308,17 +308,17 @@ describe("provider_info_helpers", () => {
|
|||
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");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -218,6 +218,8 @@ export const provider_map: Record<string, string> = {
|
|||
ZAI: "zai",
|
||||
};
|
||||
|
||||
const standaloneSubproviderSlugs = new Set<string>(["bedrock_mantle"]);
|
||||
|
||||
const asset_logos_folder = "/ui/assets/logos/";
|
||||
|
||||
export const providerLogoMap: Record<string, string> = {
|
||||
|
|
@ -394,11 +396,13 @@ export const getProviderModels = (provider: Providers, modelMap: any): Array<str
|
|||
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"];
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue