(perf sdk) - minor changes to cost calculator to run helpers only when necessary (#7704)

* use _get_model_info_helper

* fix _get_potential_model_names
This commit is contained in:
Ishaan Jaff 2025-01-11 21:10:37 -08:00 committed by GitHub
parent dab7bebaf2
commit 71e679246a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3890,9 +3890,11 @@ def _strip_model_name(model: str, custom_llm_provider: Optional[str]) -> str:
elif custom_llm_provider and (custom_llm_provider == "databricks"):
strip_version = _strip_stable_vertex_version(model_name=model)
return strip_version
else:
elif "ft:" in model:
strip_finetune = _strip_openai_finetune_model_name(model_name=model)
return strip_finetune
else:
return model
def _get_model_info_from_model_cost(key: str) -> dict:
@ -3969,7 +3971,7 @@ def _get_potential_model_names(
)
combined_stripped_model_name = "{}/{}".format(
custom_llm_provider,
_strip_model_name(model=model, custom_llm_provider=custom_llm_provider),
stripped_model_name,
)
return PotentialModelNamesAndCustomLLMProvider(