mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
[Fix] Fix test_users_in_team_budget using model with no pricing data
gpt-3.5-turbo-0301 was removed from the model cost map, so every call had response_cost=0 and team member spend never increased. The wait helper also returned True after 3s regardless of whether spend updated. - Switch fake-openai-endpoint to gpt-3.5-turbo (has pricing in cost map) - Remove premature early-return in wait_for_team_member_spend_update Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4e70254d56
commit
e2779639c0
2 changed files with 4 additions and 16 deletions
|
|
@ -46,7 +46,7 @@ model_list:
|
|||
model: dall-e-3
|
||||
- model_name: fake-openai-endpoint
|
||||
litellm_params:
|
||||
model: openai/gpt-3.5-turbo-0301
|
||||
model: openai/gpt-3.5-turbo
|
||||
api_key: fake-key
|
||||
api_base: https://exampleopenaiendpoint-production.up.railway.app/
|
||||
- model_name: fake-openai-endpoint-2
|
||||
|
|
|
|||
|
|
@ -45,9 +45,6 @@ async def wait_for_team_member_spend_update(
|
|||
Wait for the team member spend update to be committed to the database.
|
||||
Polls the user info endpoint until the spend is updated.
|
||||
This is needed because spend updates are queued asynchronously and committed periodically.
|
||||
|
||||
Note: If the model has no pricing (cost = 0), the spend will remain 0.0.
|
||||
In that case, we just wait a bit to ensure the spend update queue has been processed.
|
||||
"""
|
||||
start_time = time.time()
|
||||
initial_spend = None
|
||||
|
|
@ -62,21 +59,12 @@ async def wait_for_team_member_spend_update(
|
|||
if initial_spend is None:
|
||||
initial_spend = spend
|
||||
print(f"Initial team member spend: {spend}")
|
||||
|
||||
# If spend has been updated (even if still 0), the queue has been processed
|
||||
# For models with no pricing, spend will be 0, but we still need to wait
|
||||
# for the update to be committed so the budget check sees the current state
|
||||
|
||||
if spend >= expected_min_spend:
|
||||
print(f"[OK] Team member spend updated: {spend} >= {expected_min_spend}")
|
||||
return True
|
||||
|
||||
# If we've waited a reasonable amount and spend is still 0,
|
||||
# it likely means the model has no pricing, but we should still
|
||||
# wait a bit more to ensure the update queue has been processed
|
||||
elapsed = time.time() - start_time
|
||||
if elapsed > 3.0: # Wait at least 3 seconds for queue processing
|
||||
print(f"[OK] Waited {elapsed:.1f}s for spend update queue processing (spend: {spend})")
|
||||
return True
|
||||
|
||||
print(f"[WAITING] Team member spend: {spend}, expected >= {expected_min_spend}, elapsed: {time.time() - start_time:.1f}s")
|
||||
await asyncio.sleep(0.5)
|
||||
except Exception as e:
|
||||
print(f"Error checking team member spend: {e}")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue