mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-14 20:22:20 +00:00
ddb90c9ad7
* perf(router): add model_name index for O(1) deployment lookups Add model_name_to_deployment_indices mapping to optimize _get_all_deployments() from O(n) to O(1) + O(k) lookups. - Add model_name_to_deployment_indices: Dict[str, List[int]] - Add _build_model_name_index() to build/maintain the index - Update _add_model_to_list_and_index_map() to maintain both indices - Refactor to use idx = len(self.model_list) before append (cleaner) - Optimize _get_all_deployments() to use index instead of linear scan * test(router): add test coverage for _build_model_name_index Add single comprehensive test for _build_model_name_index() function to fix code coverage CI failure. The test verifies: - Index correctly maps model_name to deployment indices - Handles multiple deployments per model_name - Clears and rebuilds index correctly Fixes: CI code coverage error for _build_model_name_index
In total litellm runs 1000+ tests
[02/20/2025] Update:
To make it easier to contribute and map what behavior is tested,
we've started mapping the litellm directory in tests/test_litellm
This folder can only run mock tests.