mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-05 08:07:05 +00:00
Merge 342b93fe0a into 8a9d5b15b4
This commit is contained in:
commit
f88a7305ea
8 changed files with 47 additions and 0 deletions
|
|
@ -9806,6 +9806,10 @@ class Router:
|
|||
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 (
|
||||
|
|
@ -9910,6 +9914,7 @@ class Router:
|
|||
**{
|
||||
"model_group": user_facing_model_group_name,
|
||||
"providers": [llm_provider],
|
||||
"description": model_group_description,
|
||||
**model_info,
|
||||
"supported_reasoning_efforts": None,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -645,6 +645,7 @@ class ModelGroupInfo(BaseModel):
|
|||
supported_reasoning_efforts: tuple[str, ...] | None = Field(default=None)
|
||||
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():
|
||||
|
|
|
|||
|
|
@ -1637,6 +1637,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",
|
||||
[
|
||||
|
|
|
|||
|
|
@ -647,6 +647,12 @@ const ModelHubTable: React.FC<ModelHubTableProps> = ({ accessToken, publicPage,
|
|||
))}
|
||||
</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>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ export interface ModelHubData {
|
|||
supports_function_calling: boolean;
|
||||
supported_openai_params?: string[];
|
||||
is_public_model_group: boolean;
|
||||
description?: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ export interface ModelGroupInfo {
|
|||
health_status?: string;
|
||||
health_response_time?: number;
|
||||
health_checked_at?: string;
|
||||
description?: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -918,6 +918,12 @@ const PublicModelHub: React.FC<PublicModelHubProps> = ({ accessToken, isEmbedded
|
|||
})}
|
||||
</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 */}
|
||||
|
|
|
|||
2
ui/litellm-dashboard/src/lib/http/schema.d.ts
generated
vendored
2
ui/litellm-dashboard/src/lib/http/schema.d.ts
generated
vendored
|
|
@ -29537,6 +29537,8 @@ export interface components {
|
|||
ModelGroupInfoProxy: {
|
||||
/** Configurable Clientside Auth Params */
|
||||
configurable_clientside_auth_params?: (string | components["schemas"]["ConfigurableClientsideParamsCustomAuth-Output"])[] | null;
|
||||
/** Description */
|
||||
description?: string | null;
|
||||
/** Health Checked At */
|
||||
health_checked_at?: string | null;
|
||||
/** Health Response Time */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue