mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
Litellm dev 12 31 2024 p1 (#7488)
* fix(internal_user_endpoints.py): fix team list sort - handle team_alias being set + None * fix(key_management_endpoints.py): allow team admin to create key for member via admin ui Fixes https://github.com/BerriAI/litellm/issues/7482 * fix(proxy_server.py): allow querying info on specific model group via `/model_group/info` allows client-side user to get model info from proxy * fix(proxy_server.py): add docstring on `/model_group/info` showing how to filter by model name * test(test_proxy_utils.py): add unit test for returning model group info filtered * fix(proxy_server.py): fix query param * fix(test_Get_model_info.py): handle no whitelisted bedrock modells
This commit is contained in:
parent
080de89cfb
commit
39cbd9d878
9 changed files with 124 additions and 18 deletions
|
@ -295,6 +295,7 @@ from fastapi import (
|
|||
Header,
|
||||
HTTPException,
|
||||
Path,
|
||||
Query,
|
||||
Request,
|
||||
Response,
|
||||
UploadFile,
|
||||
|
@ -6622,6 +6623,20 @@ async def model_info_v1( # noqa: PLR0915
|
|||
return {"data": all_models}
|
||||
|
||||
|
||||
def _get_model_group_info(
|
||||
llm_router: Router, all_models_str: List[str], model_group: Optional[str]
|
||||
) -> List[ModelGroupInfo]:
|
||||
model_groups: List[ModelGroupInfo] = []
|
||||
for model in all_models_str:
|
||||
if model_group is not None and model_group != model:
|
||||
continue
|
||||
|
||||
_model_group_info = llm_router.get_model_group_info(model_group=model)
|
||||
if _model_group_info is not None:
|
||||
model_groups.append(_model_group_info)
|
||||
return model_groups
|
||||
|
||||
|
||||
@router.get(
|
||||
"/model_group/info",
|
||||
tags=["model management"],
|
||||
|
@ -6629,14 +6644,17 @@ async def model_info_v1( # noqa: PLR0915
|
|||
)
|
||||
async def model_group_info(
|
||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||
model_group: Optional[str] = None,
|
||||
):
|
||||
"""
|
||||
Get information about all the deployments on litellm proxy, including config.yaml descriptions (except api key and api base)
|
||||
|
||||
- /models returns all deployments. Proxy Admins can use this to list all deployments setup on the proxy
|
||||
- /model_group/info returns all model groups. End users of proxy should use /model_group/info since those models will be used for /chat/completions, /embeddings, etc.
|
||||
- /model_group/info?model_group=rerank-english-v3.0 returns all model groups for a specific model group (`model_name` in config.yaml)
|
||||
|
||||
|
||||
|
||||
Example Request (All Models):
|
||||
```shell
|
||||
curl -X 'GET' \
|
||||
'http://localhost:4000/model_group/info' \
|
||||
|
@ -6644,6 +6662,24 @@ async def model_group_info(
|
|||
-H 'x-api-key: sk-1234'
|
||||
```
|
||||
|
||||
Example Request (Specific Model Group):
|
||||
```shell
|
||||
curl -X 'GET' \
|
||||
'http://localhost:4000/model_group/info?model_group=rerank-english-v3.0' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Authorization: Bearer sk-1234'
|
||||
```
|
||||
|
||||
Example Request (Specific Wildcard Model Group): (e.g. `model_name: openai/*` on config.yaml)
|
||||
```shell
|
||||
curl -X 'GET' \
|
||||
'http://localhost:4000/model_group/info?model_group=openai/tts-1'
|
||||
-H 'accept: application/json' \
|
||||
-H 'Authorization: Bearersk-1234'
|
||||
```
|
||||
|
||||
Learn how to use and set wildcard models [here](https://docs.litellm.ai/docs/wildcard_routing)
|
||||
|
||||
Example Response:
|
||||
```json
|
||||
{
|
||||
|
@ -6796,13 +6832,9 @@ async def model_group_info(
|
|||
infer_model_from_keys=general_settings.get("infer_model_from_keys", False),
|
||||
)
|
||||
|
||||
model_groups: List[ModelGroupInfo] = []
|
||||
|
||||
for model in all_models_str:
|
||||
|
||||
_model_group_info = llm_router.get_model_group_info(model_group=model)
|
||||
if _model_group_info is not None:
|
||||
model_groups.append(_model_group_info)
|
||||
model_groups: List[ModelGroupInfo] = _get_model_group_info(
|
||||
llm_router=llm_router, all_models_str=all_models_str, model_group=model_group
|
||||
)
|
||||
|
||||
return {"data": model_groups}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue