mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
fix - show correct base_model in slack alerts
This commit is contained in:
parent
943c8a4dad
commit
f92dd0ec9b
3 changed files with 16 additions and 3 deletions
|
@ -671,10 +671,18 @@ class SlackAlerting(CustomLogger):
|
|||
)
|
||||
await _cache.async_set_cache(key=message, value="SENT", ttl=2419200)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
async def model_added_alert(self, model_name: str, litellm_model_name: str):
|
||||
async def model_added_alert(
|
||||
self, model_name: str, litellm_model_name: str, passed_model_info: Any
|
||||
):
|
||||
base_model_from_user = getattr(passed_model_info, "base_model", None)
|
||||
model_info = {}
|
||||
base_model = ""
|
||||
if base_model_from_user is not None:
|
||||
model_info = litellm.model_cost.get(base_model_from_user, {})
|
||||
base_model = f"Base Model: `{base_model_from_user}`\n"
|
||||
else:
|
||||
model_info = litellm.model_cost.get(litellm_model_name, {})
|
||||
model_info_str = ""
|
||||
for k, v in model_info.items():
|
||||
|
@ -687,6 +695,7 @@ class SlackAlerting(CustomLogger):
|
|||
message = f"""
|
||||
*🚅 New Model Added*
|
||||
Model Name: `{model_name}`
|
||||
{base_model}
|
||||
|
||||
Usage OpenAI Python SDK:
|
||||
```
|
||||
|
|
|
@ -8088,6 +8088,7 @@ async def add_new_model(
|
|||
await proxy_logging_obj.slack_alerting_instance.model_added_alert(
|
||||
model_name=model_params.model_name,
|
||||
litellm_model_name=_orignal_litellm_model_name,
|
||||
passed_model_info=model_params.model_info,
|
||||
)
|
||||
except:
|
||||
pass
|
||||
|
|
|
@ -76,6 +76,9 @@ class ModelInfo(BaseModel):
|
|||
db_model: bool = (
|
||||
False # used for proxy - to separate models which are stored in the db vs. config.
|
||||
)
|
||||
base_model: Optional[str] = (
|
||||
None # specify if the base model is azure/gpt-3.5-turbo etc for accurate cost tracking
|
||||
)
|
||||
|
||||
def __init__(self, id: Optional[Union[str, int]] = None, **params):
|
||||
if id is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue