fix(litellm_logging.py): use 1 cost calc function across response headers + logging integrations

Ensures consistent cost calculation when azure base models are used
This commit is contained in:
Krrish Dholakia 2024-08-01 10:26:59 -07:00
parent d02d3d9712
commit 10b571ca42
3 changed files with 40 additions and 24 deletions

View file

@ -1368,15 +1368,7 @@ def client(original_function):
optional_params=kwargs,
)
result._hidden_params["response_cost"] = (
litellm.response_cost_calculator(
response_object=result,
model=getattr(logging_obj, "model", ""),
custom_llm_provider=getattr(
logging_obj, "custom_llm_provider", None
),
call_type=getattr(logging_obj, "call_type", "completion"),
optional_params=getattr(logging_obj, "optional_params", {}),
)
logging_obj._response_cost_calculator(result=result)
)
if (
isinstance(result, ModelResponse)