Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test(router): cover realtime session model resolver directly

mateoe5b54620a4fc
diff --git a/tests/test_litellm/test_router.py b/tests/test_litellm/test_router.py
index fbefcc59477..99e7e9ad6bc 100644
--- a/tests/test_litellm/test_router.py
+++ b/tests/test_litellm/test_router.py
@@ -1374,6 +1374,21 @@ async def test_ageneric_api_call_does_not_add_session_model():
assert captured["session"] == {"type": "realtime"}
+ "session, expected",
+ [
+ ({"type": "realtime", "model": "my-realtime-group"}, {"session": {"type": "realtime", "model": "resolved"}}),
+ ({"type": "realtime"}, {}),
+ (None, {}),
+ ("not-a-session", {}),
+ ],
+)
+def test_with_router_resolved_session_model(session, expected):
+ from litellm.router import _with_router_resolved_session_model
+
+ assert dict(_with_router_resolved_session_model(session, "resolved")) == expected
+
+
def test_router_get_model_access_groups_team_only_models():
"""
Test that Router.get_model_access_groups returns the correct response for team-only models