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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test: ensure model_names is a O(1) datastructure
AlexsanderHamire154ab6a6611
diff --git a/tests/router_unit_tests/test_router_index_management.py b/tests/router_unit_tests/test_router_index_management.pyindex 28a48604a01..3d446841de3 100644--- a/tests/router_unit_tests/test_router_index_management.py+++ b/tests/router_unit_tests/test_router_index_management.py@@ -179,6 +179,14 @@ class TestRouterIndexManagement:assert "claude-3" in router.model_name_to_deployment_indicesassert router.model_name_to_deployment_indices["claude-3"] == [0]+ def test_model_names_is_set(self):+ """Verify that model_names uses a set for O(1) lookups, not a list (O(n))"""+ router = Router(model_list=[])++ assert isinstance(router.model_names, set), (+ f"model_names should be a set for O(1) lookups, but got {type(router.model_names)}"+ )+def test_no_linear_scans_in_router(self):"""Static analysis test to ensure Router doesn't use O(n) linear scans.