mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-10 08:28:25 +00:00
style: format modified files with ruff
This commit is contained in:
parent
577db03ef6
commit
491401c7fa
3 changed files with 3 additions and 10 deletions
|
|
@ -1659,9 +1659,7 @@ def completion_cost(
|
|||
)
|
||||
requested_model: Final = model
|
||||
request_pricing_provider: Final = (
|
||||
custom_llm_provider
|
||||
if isinstance(custom_llm_provider, str)
|
||||
else _get_provider_for_cost_calc(model)
|
||||
custom_llm_provider if isinstance(custom_llm_provider, str) else _get_provider_for_cost_calc(model)
|
||||
)
|
||||
raw_candidates: Final = (
|
||||
(
|
||||
|
|
@ -1686,9 +1684,7 @@ def completion_cost(
|
|||
|
||||
for idx, (model, candidate_pricing_provider) in enumerate(potential_model_names):
|
||||
try:
|
||||
candidate_custom_llm_provider: str | None = (
|
||||
candidate_pricing_provider or request_pricing_provider
|
||||
)
|
||||
candidate_custom_llm_provider: str | None = candidate_pricing_provider or request_pricing_provider
|
||||
if verbose_logger.isEnabledFor(logging.DEBUG):
|
||||
verbose_logger.debug("selected model name for cost calculation: %s", model)
|
||||
|
||||
|
|
|
|||
|
|
@ -151,9 +151,7 @@ class OpenAILikeChatConfig(OpenAIGPTConfig):
|
|||
json_mode: bool | None = None,
|
||||
) -> ModelResponse:
|
||||
resolved_custom_llm_provider = (
|
||||
litellm_params.get("custom_llm_provider")
|
||||
if isinstance(litellm_params, dict)
|
||||
else None
|
||||
litellm_params.get("custom_llm_provider") if isinstance(litellm_params, dict) else None
|
||||
) or (
|
||||
getattr(model_response, "_hidden_params", {}).get("custom_llm_provider")
|
||||
if hasattr(model_response, "_hidden_params") and isinstance(getattr(model_response, "_hidden_params"), dict)
|
||||
|
|
|
|||
|
|
@ -122,4 +122,3 @@ def test_groq_openai_aliased_completion_cost():
|
|||
)
|
||||
c_raw = litellm.completion_cost(completion_response=raw_resp, model="groq/openai/gpt-oss-120b")
|
||||
assert c_raw == pytest.approx(2.295e-05)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue