mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
fix(main.py): fix retries being multiplied when using openai sdk (#7221)
* fix(main.py): fix retries being multiplied when using openai sdk Closes https://github.com/BerriAI/litellm/pull/7130 * docs(prompt_management.md): add langfuse prompt management doc * feat(team_endpoints.py): allow teams to add their own models Enables teams to call their own finetuned models via the proxy * test: add better enforcement check testing for `/model/new` now that teams can add their own models * docs(team_model_add.md): tutorial for allowing teams to add their own models * test: fix test
This commit is contained in:
parent
8060c5c698
commit
ec36353b41
16 changed files with 2439 additions and 1540 deletions
|
@ -107,6 +107,49 @@ async def test_add_new_model(prisma_client):
|
|||
assert _new_model_in_db is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"team_id, key_team_id, user_role, expected_result",
|
||||
[
|
||||
("1234", "1234", LitellmUserRoles.PROXY_ADMIN.value, True),
|
||||
(
|
||||
"1234",
|
||||
"1235",
|
||||
LitellmUserRoles.PROXY_ADMIN.value,
|
||||
True,
|
||||
), # proxy admin can add models for any team
|
||||
(None, "1234", LitellmUserRoles.PROXY_ADMIN.value, True),
|
||||
(None, None, LitellmUserRoles.PROXY_ADMIN.value, True),
|
||||
(
|
||||
"1234",
|
||||
"1234",
|
||||
LitellmUserRoles.INTERNAL_USER.value,
|
||||
True,
|
||||
), # internal users can add models for their team
|
||||
("1234", "1235", LitellmUserRoles.INTERNAL_USER.value, False),
|
||||
(None, "1234", LitellmUserRoles.INTERNAL_USER.value, False),
|
||||
(
|
||||
None,
|
||||
None,
|
||||
LitellmUserRoles.INTERNAL_USER.value,
|
||||
False,
|
||||
), # internal users cannot add models by default
|
||||
],
|
||||
)
|
||||
def test_can_add_model(team_id, key_team_id, user_role, expected_result):
|
||||
from litellm.proxy.proxy_server import check_if_team_id_matches_key
|
||||
|
||||
args = {
|
||||
"team_id": team_id,
|
||||
"user_api_key_dict": UserAPIKeyAuth(
|
||||
user_role=user_role,
|
||||
api_key="sk-1234",
|
||||
team_id=key_team_id,
|
||||
),
|
||||
}
|
||||
|
||||
assert check_if_team_id_matches_key(**args) is expected_result
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.skip(reason="new feature, tests passing locally")
|
||||
async def test_add_update_model(prisma_client):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue