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
5 changes: 5 additions & 0 deletions litellm/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -9313,6 +9313,10 @@ def _set_model_group_info(self, model_group: str, user_facing_model_group_name:
model_list: Final = self.get_model_list(model_name=model_group)
if model_list is None:
return None
model_group_description: Final[str | None] = next(
(d for d in (m.get("model_info", {}).get("description") for m in model_list) if isinstance(d, str)),
None,
)
for model in model_list:
is_match = False
if (
Expand Down Expand Up @@ -9415,6 +9419,7 @@ def _set_model_group_info(self, model_group: str, user_facing_model_group_name:
**{
"model_group": user_facing_model_group_name,
"providers": [llm_provider],
"description": model_group_description,
**model_info,
}
)
Expand Down
1 change: 1 addition & 0 deletions litellm/types/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ class ModelGroupInfo(BaseModel):
supports_function_calling: bool = Field(default=False)
supported_openai_params: list[str] | None = Field(default=[])
configurable_clientside_auth_params: CONFIGURABLE_CLIENTSIDE_AUTH_PARAMS = None
description: str | None = None

def __init__(self, **data) -> None:
for field_name, field_type in get_type_hints(self.__class__).items():
Expand Down
25 changes: 25 additions & 0 deletions tests/test_litellm/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,31 @@ def test_model_group_info_cost_none_when_db_model_info_has_no_cost():
assert result.output_cost_per_token is None


def test_model_group_info_description_from_model_info():
"""
model_info.description set in the config should surface on ModelGroupInfo,
including when only a later deployment in the group carries it.
"""
router = litellm.Router(
model_list=[
{
"model_name": "gpt-4",
"litellm_params": {"model": "gpt-4", "api_key": "fake"},
"model_info": {},
},
{
"model_name": "gpt-4",
"litellm_params": {"model": "gpt-4", "api_key": "fake2"},
"model_info": {"description": "State-of-the-art language model."},
},
]
)

result = router.get_model_group_info("gpt-4")
assert result is not None
assert result.description == "State-of-the-art language model."


@pytest.mark.parametrize(
"value,expected",
[
Expand Down
6 changes: 6 additions & 0 deletions ui/litellm-dashboard/src/components/AIHub/ModelHubTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
);
}

const ModelHubTable: React.FC<ModelHubTableProps> = ({ accessToken, publicPage, premiumUser, userRole }) => {

Check warning on line 63 in ui/litellm-dashboard/src/components/AIHub/ModelHubTable.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Arrow function has a complexity of 88. Maximum allowed is 20
const syntaxTheme = useSyntaxTheme(prism);
// Admin Viewer follows the read-parity rule: see the AI Hub catalog, but
// cannot toggle public visibility (write).
Expand Down Expand Up @@ -177,7 +177,7 @@
setAgentLoading(true);
const response = await getAgentsList(accessToken);
let agents = response.agents;
let agent_card_list = agents.map((agent: any) => ({

Check warning on line 180 in ui/litellm-dashboard/src/components/AIHub/ModelHubTable.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
agent_id: agent.agent_id,
...agent.agent_card_params,
is_public: agent.litellm_params.is_public,
Expand Down Expand Up @@ -346,7 +346,7 @@
try {
const response = await getAgentsList(accessToken);
let agents = response.agents;
let agent_card_list = agents.map((agent: any) => ({

Check warning on line 349 in ui/litellm-dashboard/src/components/AIHub/ModelHubTable.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
agent_id: agent.agent_id,
...agent.agent_card_params,
is_public: agent.is_public,
Expand Down Expand Up @@ -647,6 +647,12 @@
))}
</div>
</div>
{selectedModel.description && (
<div className="col-span-2">
<p className="font-medium">Description:</p>
<p className="mt-1">{selectedModel.description}</p>
</div>
)}
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
supports_function_calling: boolean;
supported_openai_params?: string[];
is_public_model_group: boolean;
description?: string;
[key: string]: any;

Check warning on line 35 in ui/litellm-dashboard/src/components/AIHub/ModelHubTableColumns.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
}

const formatCapabilityName = (key: string) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
health_status?: string;
health_response_time?: number;
health_checked_at?: string;
description?: string;
[key: string]: any;

Check warning on line 28 in ui/litellm-dashboard/src/components/PublicModelHubTableColumns.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
}

export interface AgentCard {
Expand Down Expand Up @@ -52,7 +53,7 @@
url: string;
};
documentationUrl?: string;
[key: string]: any;

Check warning on line 56 in ui/litellm-dashboard/src/components/PublicModelHubTableColumns.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
}

export interface MCPServerData {
Expand All @@ -66,9 +67,9 @@
mcp_info: {
server_name: string;
description?: string;
mcp_server_cost_info?: any;

Check warning on line 70 in ui/litellm-dashboard/src/components/PublicModelHubTableColumns.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
};
[key: string]: any;

Check warning on line 72 in ui/litellm-dashboard/src/components/PublicModelHubTableColumns.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
}

const formatCapabilityName = (key: string) =>
Expand Down Expand Up @@ -117,7 +118,7 @@
return (
<span key={provider} className="flex items-center gap-1 rounded-md bg-muted px-2 py-1 text-xs">
{logo && (
<img

Check warning on line 121 in ui/litellm-dashboard/src/components/PublicModelHubTableColumns.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
src={logo}
alt={provider}
className="size-3 shrink-0 object-contain"
Expand Down
6 changes: 6 additions & 0 deletions ui/litellm-dashboard/src/components/public_model_hub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
);
}

const PublicModelHub: React.FC<PublicModelHubProps> = ({ accessToken, isEmbedded = false }) => {

Check warning on line 68 in ui/litellm-dashboard/src/components/public_model_hub.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Arrow function has a complexity of 70. Maximum allowed is 20
const anchor = useComboboxAnchor();
const [modelHubData, setModelHubData] = useState<ModelGroupInfo[] | null>(null);
const [agentHubData, setAgentHubData] = useState<AgentCard[] | null>(null);
Expand Down Expand Up @@ -918,6 +918,12 @@
})}
</div>
</div>
{selectedModel.description && (
<div className="col-span-2">
<p className="font-medium">Description:</p>
<p className="mt-1">{selectedModel.description}</p>
</div>
)}
</div>

{/* Wildcard Routing Note */}
Expand Down
2 changes: 2 additions & 0 deletions ui/litellm-dashboard/src/lib/http/schema.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading