mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-16 10:23:14 +00:00
Merge pull request #2345 from BerriAI/litellm_fix_update_team_db
(fix) Update Team DB
This commit is contained in:
@@ -1241,12 +1241,16 @@ async def update_database(
|
||||
f"_update_team_db: existing spend: {existing_spend_obj}"
|
||||
)
|
||||
if existing_spend_obj is None:
|
||||
existing_spend = 0
|
||||
# the team does not exist in the db - return
|
||||
verbose_proxy_logger.debug(
|
||||
"team_id does not exist in db, not tracking spend for team"
|
||||
)
|
||||
return
|
||||
else:
|
||||
existing_spend = existing_spend_obj.spend
|
||||
# Calculate the new cost by adding the existing cost and response_cost
|
||||
new_spend = existing_spend + response_cost
|
||||
|
||||
spend_per_model = getattr(existing_spend_obj, "model_spend", {})
|
||||
# track cost per model, for the given team
|
||||
spend_per_model = existing_spend_obj.model_spend or {}
|
||||
current_model = kwargs.get("model")
|
||||
|
||||
Reference in New Issue
Block a user