mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-13 08:52:02 +00:00
test(passthrough): type the team deployment helper and mark test locals Final
This commit is contained in:
parent
78f53a1a5e
commit
689494ad5f
2 changed files with 14 additions and 8 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import asyncio
|
||||
import os
|
||||
import unittest
|
||||
from typing import Final
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
|
@ -60,12 +61,12 @@ def test_credential_loaded_after_deployment_registration_still_resolves():
|
|||
)
|
||||
|
||||
|
||||
def _team_deployment(model: str, team_id: str, **litellm_params) -> dict:
|
||||
def _team_deployment(model: str, team_id: str, **litellm_params: str) -> dict[str, object]:
|
||||
return {**_flagged_deployment(model, **litellm_params), "model_info": {"team_id": team_id}}
|
||||
|
||||
|
||||
def test_proxy_wide_deployment_credentials_skip_a_team_deployment_for_the_proxy_wide_one():
|
||||
llm_router = litellm.Router(
|
||||
def test_proxy_wide_deployment_credentials_skip_a_team_deployment_for_the_proxy_wide_one() -> None:
|
||||
llm_router: Final = litellm.Router(
|
||||
model_list=[
|
||||
_team_deployment(
|
||||
"watsonx/ibm/granite-3-8b-instruct",
|
||||
|
|
@ -81,14 +82,16 @@ def test_proxy_wide_deployment_credentials_skip_a_team_deployment_for_the_proxy_
|
|||
]
|
||||
)
|
||||
|
||||
credentials = _passthrough_router(llm_router).get_proxy_wide_deployment_credentials(custom_llm_provider="watsonx")
|
||||
credentials: Final = _passthrough_router(llm_router).get_proxy_wide_deployment_credentials(
|
||||
custom_llm_provider="watsonx"
|
||||
)
|
||||
|
||||
assert credentials is not None
|
||||
assert (credentials.api_key, credentials.api_base) == ("wx-proxy-wide-key", "https://eu-de.ml.cloud.ibm.com")
|
||||
|
||||
|
||||
def test_proxy_wide_deployment_credentials_are_none_when_only_a_team_deployment_is_flagged():
|
||||
llm_router = litellm.Router(
|
||||
def test_proxy_wide_deployment_credentials_are_none_when_only_a_team_deployment_is_flagged() -> None:
|
||||
llm_router: Final = litellm.Router(
|
||||
model_list=[_team_deployment("watsonx/ibm/granite-3-8b-instruct", "team-a", api_key="wx-team-a-key")]
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ and version parameter injection.
|
|||
"""
|
||||
|
||||
import json
|
||||
from typing import Final
|
||||
from unittest.mock import AsyncMock, MagicMock, Mock, patch
|
||||
|
||||
import pytest
|
||||
|
|
@ -557,8 +558,10 @@ async def test_watsonx_route_falls_back_to_env_when_no_deployment_is_flagged(mon
|
|||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_watsonx_route_falls_back_to_env_when_the_only_flagged_deployment_belongs_to_a_team(monkeypatch):
|
||||
llm_router = litellm.Router(
|
||||
async def test_watsonx_route_falls_back_to_env_when_the_only_flagged_deployment_belongs_to_a_team(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
llm_router: Final = litellm.Router(
|
||||
model_list=[
|
||||
{
|
||||
**_watsonx_deployment("wx-team-a-key", "https://team-a.ml.cloud.ibm.com", use_in_pass_through=True),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue