mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-14 04:25:53 +00:00
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:
@@ -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}"
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user