mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
test(router): cover capability deployment registration
This commit is contained in:
parent
c17dc0bc6d
commit
187eacce94
1 changed files with 18 additions and 0 deletions
|
|
@ -11,6 +11,7 @@ from litellm.router_strategy.capability_router.config import (
|
|||
)
|
||||
from litellm.router_strategy.capability_router.policy import select_capability_model
|
||||
from litellm.router_strategy.capability_router.prompts import build_classifier_response_schema
|
||||
from litellm.types.router import Deployment, LiteLLM_Params
|
||||
|
||||
|
||||
def config() -> dict:
|
||||
|
|
@ -121,6 +122,23 @@ def test_router_registers_capability_strategy() -> None:
|
|||
assert len(router.capability_routers["cost-router"]) == 1
|
||||
|
||||
|
||||
def test_router_explicitly_initializes_capability_strategy() -> None:
|
||||
router = Router(model_list=[])
|
||||
deployment = Deployment(
|
||||
model_name="cost-router",
|
||||
litellm_params=LiteLLM_Params(
|
||||
model="auto_router/capability_router",
|
||||
capability_router_config=config(),
|
||||
),
|
||||
)
|
||||
|
||||
assert router._is_capability_router_deployment(deployment.litellm_params)
|
||||
|
||||
router.init_capability_router_deployment(deployment)
|
||||
|
||||
assert len(router.capability_routers["cost-router"]) == 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_same_user_turn_reuses_cached_decision() -> None:
|
||||
router = Router(model_list=[])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue