Merge pull request #22892 from BerriAI/fix/greptile-type-safety-improvements

fix(types): address type-safety issues from mypy PR review
This commit is contained in:
Julio Quinteros Pro
2026-03-05 14:06:17 -03:00
committed by GitHub
2 changed files with 6 additions and 6 deletions
@@ -10,7 +10,7 @@ PATCH /config/cost_margin_config - Update cost margin configuration
POST /cost/estimate - Estimate cost for a given model and token counts
"""
from typing import Dict, Optional, Tuple, Union, cast
from typing import Dict, Optional, Tuple, Union
from fastapi import APIRouter, Depends, HTTPException
@@ -66,8 +66,8 @@ def _resolve_model_for_cost_lookup(model: str) -> Tuple[str, Optional[str]]:
verbose_proxy_logger.debug(
f"Resolved model '{model}' to base_model '{base_model}' from router"
)
custom_llm_provider = cast(Optional[str], litellm_params.get("custom_llm_provider"))
return cast(str, base_model), custom_llm_provider
custom_llm_provider = litellm_params.get("custom_llm_provider")
return str(base_model), str(custom_llm_provider) if custom_llm_provider is not None else None
resolved_model = litellm_params.get("model")
@@ -75,8 +75,8 @@ def _resolve_model_for_cost_lookup(model: str) -> Tuple[str, Optional[str]]:
verbose_proxy_logger.debug(
f"Resolved model '{model}' to '{resolved_model}' from router"
)
custom_llm_provider = cast(Optional[str], litellm_params.get("custom_llm_provider"))
return cast(str, resolved_model), custom_llm_provider
custom_llm_provider = litellm_params.get("custom_llm_provider")
return str(resolved_model), str(custom_llm_provider) if custom_llm_provider is not None else None
except Exception as e:
verbose_proxy_logger.debug(
f"Could not resolve model '{model}' from router: {e}"
+1 -1
View File
@@ -424,7 +424,7 @@ class CreateBatchRequest(TypedDict, total=False):
endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions"]
input_file_id: str
metadata: Optional[Dict[str, str]]
output_expires_after: Optional[FileExpiresAfter]
output_expires_after: FileExpiresAfter
extra_headers: Optional[Dict[str, str]]
extra_body: Optional[Dict[str, str]]
timeout: Optional[float]