fix(utils.py): fix linting errors

This commit is contained in:
Krrish Dholakia 2024-07-30 18:38:10 -07:00
parent 0bcfdafc58
commit dc58b9f33e
2 changed files with 4 additions and 3 deletions

View file

@ -3865,6 +3865,7 @@ class Router:
if supported_openai_params is None: if supported_openai_params is None:
supported_openai_params = [] supported_openai_params = []
model_info = ModelMapInfo( model_info = ModelMapInfo(
key=model_group,
max_tokens=None, max_tokens=None,
max_input_tokens=None, max_input_tokens=None,
max_output_tokens=None, max_output_tokens=None,

View file

@ -2148,7 +2148,7 @@ def supports_parallel_function_calling(model: str):
####### HELPER FUNCTIONS ################ ####### HELPER FUNCTIONS ################
def _update_dictionary(existing_dict: dict, new_dict: dict) -> dict: def _update_dictionary(existing_dict: Dict, new_dict: dict) -> dict:
for k, v in new_dict.items(): for k, v in new_dict.items():
existing_dict[k] = v existing_dict[k] = v
@ -2179,14 +2179,14 @@ def register_model(model_cost: Union[str, dict]):
for key, value in loaded_model_cost.items(): for key, value in loaded_model_cost.items():
## get model info ## ## get model info ##
try: try:
existing_model = get_model_info(model=key) existing_model: Union[ModelInfo, dict] = get_model_info(model=key)
model_cost_key = existing_model["key"] model_cost_key = existing_model["key"]
except Exception: except Exception:
existing_model = {} existing_model = {}
model_cost_key = key model_cost_key = key
## override / add new keys to the existing model cost dictionary ## override / add new keys to the existing model cost dictionary
litellm.model_cost.setdefault(model_cost_key, {}).update( litellm.model_cost.setdefault(model_cost_key, {}).update(
_update_dictionary(existing_model, value) _update_dictionary(existing_model, value) # type: ignore
) )
verbose_logger.debug(f"{key} added to model cost map") verbose_logger.debug(f"{key} added to model cost map")
# add new model names to provider lists # add new model names to provider lists