fix(router): satisfy type discipline gate and sync generated API types

This commit is contained in:
Azmi Muwahid 2026-10-20 16:36:31 +07:00
parent d4c6831733
commit daf924c0ef
2 changed files with 14 additions and 10 deletions

View file

@ -3444,19 +3444,23 @@ class ComplexityRouter(CustomLogger):
model_id: Final = ResponsesAPIRequestUtils.get_model_id_from_response_id(previous_response_id)
if model_id is None:
return None
candidate_groups: list[str] = []
for pool in self._tier_pools().values():
candidate_groups.extend(pool)
if self.config.default_model and self.config.default_model not in candidate_groups:
candidate_groups.append(self.config.default_model)
for group in candidate_groups:
for deployment in self._group_deployments(group):
model_info: Final = deployment.get("model_info")
deployment_id: Final = model_info.get("id") if isinstance(model_info, Mapping) else None
if deployment_id is not None and str(deployment_id) == model_id:
for group in pool:
if self._group_has_deployment_id(group, model_id):
return group, self._tier_for_model(group)
default_model: Final = self.config.default_model
if default_model and self._group_has_deployment_id(default_model, model_id):
return default_model, self._tier_for_model(default_model)
return None
def _group_has_deployment_id(self, group: str, model_id: str) -> bool:
for deployment in self._group_deployments(group):
model_info: Final = deployment.get("model_info")
deployment_id: Final = model_info.get("id") if isinstance(model_info, Mapping) else None
if deployment_id is not None and str(deployment_id) == model_id:
return True
return False
def _group_deployments(self, group: str) -> Sequence[Mapping[str, object]]:
list_models: Final = getattr(self.litellm_router_instance, "get_model_list", None)
deployments: Final = list_models(model_name=group) if callable(list_models) else None

View file

@ -45617,7 +45617,7 @@ export interface components {
* Cause
* @enum {string}
*/
cause?: "prompt_cache_cost" | "heuristic_scorer" | "heuristic_v2" | "reasoning_override" | "llm_classifier" | "capability_classifier" | "jev_classifier" | "llm_v2_classifier" | "llm_v2_fallback" | "heuristic_first_short_circuit" | "hybrid_short_circuit" | "classifier_plugin" | "classifier_fallback" | "capability_classifier_fallback" | "default_model_fallback" | "literal_keyword_match" | "semantic_keyword_match" | "plan_mode" | "housekeeping" | "modality_escalation" | "modality_pin_override" | "health_failover" | "health_default_fallback" | "session_affinity_pin" | "session_affinity_escalation" | "user_turn_continuation" | "default_fallback" | "keyword" | "quality_tier" | "bandit" | "semantic_match" | "semantic_no_match" | "semantic_error";
cause?: "prompt_cache_cost" | "heuristic_scorer" | "heuristic_v2" | "reasoning_override" | "llm_classifier" | "capability_classifier" | "jev_classifier" | "llm_v2_classifier" | "llm_v2_fallback" | "heuristic_first_short_circuit" | "hybrid_short_circuit" | "classifier_plugin" | "classifier_fallback" | "capability_classifier_fallback" | "default_model_fallback" | "literal_keyword_match" | "semantic_keyword_match" | "plan_mode" | "housekeeping" | "modality_escalation" | "modality_pin_override" | "health_failover" | "health_default_fallback" | "session_affinity_pin" | "session_affinity_escalation" | "user_turn_continuation" | "previous_response_reuse" | "default_fallback" | "keyword" | "quality_tier" | "bandit" | "semantic_match" | "semantic_no_match" | "semantic_error";
/** Classifier Calibrated Capable P Solve */
classifier_calibrated_capable_p_solve?: number;
/** Classifier Calibrated Efficient P Solve */