(fix) update team_id

This commit is contained in:
ishaan-jaff 2024-03-05 19:09:19 -08:00
parent 92753f558c
commit c4e7c45c3a

View file

@ -1241,17 +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
if existing_spend_obj is None:
spend_per_model = {}
else:
spend_per_model = existing_spend_obj.model_spend or {}
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")