forked from phoenix/litellm-mirror
(fix) update team_id
This commit is contained in:
parent
92753f558c
commit
c4e7c45c3a
1 changed files with 6 additions and 7 deletions
|
@ -1241,17 +1241,16 @@ async def update_database(
|
||||||
f"_update_team_db: existing spend: {existing_spend_obj}"
|
f"_update_team_db: existing spend: {existing_spend_obj}"
|
||||||
)
|
)
|
||||||
if existing_spend_obj is None:
|
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:
|
else:
|
||||||
existing_spend = existing_spend_obj.spend
|
existing_spend = existing_spend_obj.spend
|
||||||
# Calculate the new cost by adding the existing cost and response_cost
|
# Calculate the new cost by adding the existing cost and response_cost
|
||||||
new_spend = existing_spend + response_cost
|
new_spend = existing_spend + response_cost
|
||||||
|
spend_per_model = getattr(existing_spend_obj, "model_spend", {})
|
||||||
if existing_spend_obj is None:
|
|
||||||
spend_per_model = {}
|
|
||||||
else:
|
|
||||||
spend_per_model = existing_spend_obj.model_spend or {}
|
|
||||||
|
|
||||||
# track cost per model, for the given team
|
# track cost per model, for the given team
|
||||||
spend_per_model = existing_spend_obj.model_spend or {}
|
spend_per_model = existing_spend_obj.model_spend or {}
|
||||||
current_model = kwargs.get("model")
|
current_model = kwargs.get("model")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue