mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
Ensure cost per token is float.
This commit is contained in:
parent
7550aba474
commit
95bfb230e4
1 changed files with 5 additions and 0 deletions
|
@ -1972,6 +1972,11 @@ def register_model(model_cost: Union[str, dict]): # noqa: PLR0915
|
|||
loaded_model_cost = litellm.get_model_cost_map(url=model_cost)
|
||||
|
||||
for key, value in loaded_model_cost.items():
|
||||
## Change, if present, input_cost_per_token and output_cost_per_token to float
|
||||
if "input_cost_per_token" in value:
|
||||
value["input_cost_per_token"] = float(value["input_cost_per_token"])
|
||||
if "output_cost_per_token" in value:
|
||||
value["output_cost_per_token"] = float(value["output_cost_per_token"])
|
||||
## get model info ##
|
||||
try:
|
||||
existing_model: Union[ModelInfo, dict] = get_model_info(model=key)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue