Commit graph

33 commits

Author SHA1 Message Date
ryan-crabbe-berri
21e9632713
test: add six ruff rules that catch tests which cannot fail (#37709)
`assert False` inside a `try:` raises AssertionError, which the `except
Exception` right below it catches, so several tests reported green no matter
what the code did. `pytest.fail` raises Failed, a BaseException, and escapes.

A bare `a == b` statement is evaluated and discarded. Nine of those sat in
tests, and one was comparing against a model name the router never produces.

Selects B011, B015, B018, PT015, PLR0133 and PLW0127 in ruff-tests.toml
alongside F821, with all 50 existing violations fixed, so no budget file or
ratchet is needed. CI already runs this config over tests/.
2026-08-20 14:21:26 -07:00
Ishaan Jaffer
e8461b5b97
style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
yuneng-jiang
3ec7c2a81e [Fix] Fail fast when team member spend not flushed in time
Increase wait timeout to 90s and pytest.fail() instead of silently
continuing, so the failure message points at the real cause.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:40:17 -07:00
yuneng-jiang
e2779639c0 [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>
2026-03-13 12:35:20 -07:00
Ishaan Jaff
c5b695e71c
fix(test): skip 'projects' field in team update assertion (#21777) 2026-02-21 10:24:53 -08:00
Sameer Kankute
0f177a3b01 Fix: test_team_update_sc_2 2026-02-05 09:40:21 +05:30
Ishaan Jaffer
e4e76a4963 test_team_update_sc_2 2026-01-24 13:17:32 -08:00
Alexsander Hamir
699a91e031
fix(test): Fix test_users_in_team_budget to create user with team_id (#18297)
Previously, the test created a user first (without team_id), then added them
to a team. This caused the API key to have team_id=None, which broke team
budget tracking and enforcement.

The fix:
- Create team first, then create user with team_id parameter
- This ensures the API key gets team_id set from creation time
- Team budget tracking and enforcement now work correctly

Added comprehensive comments explaining why the order is critical and should
not be changed, as it tests the intended flow where keys are associated with
teams at creation time.

Also added extensive debugging output to help diagnose future issues.
2025-12-20 12:30:30 -08:00
Alexsander Hamir
5230e97448
[Fix] CI/CD - Add missing documentation for ENVs & Clean Functionality (#18211) 2025-12-18 13:16:15 -08:00
yuneng-jiang
a2e977b8e6 Fixing tests 2025-12-06 22:28:23 -08:00
Krrish Dholakia
95de41d10c build: publish new litellm-proxy-extras file 2025-05-27 17:44:23 -07:00
Ishaan Jaff
02efffcbcb fix: test_team_update_sc_2 2025-05-09 11:59:13 -07:00
Ishaan Jaff
1a42245da6 test: fix test_team_update_sc_2 2025-05-09 09:38:03 -07:00
Krish Dholakia
274147bc5e
fix(team_endpoints.py): ensure 404 raised when team not found (#9038)
* fix(team_endpoints.py): ensure 404 raised when team not found

* fix(key_management_endpoints.py): fix adding tags to key when metadata is empty

* fix(key_management_endpoints.py): refactor set metadata field to use common function across keys + teams

reduces scope for errors + easier testing

* fix: fix linting error
2025-03-06 22:04:36 -08:00
Krish Dholakia
2b7755f8d8
Litellm dev 02 18 2025 p3 (#8640)
* fix(team_endpoints.py): cleanup user <-> team association on team delete

Fixes issue where user table still listed team membership post delete

* test(test_team.py): update e2e test - ensure user/team membership is deleted on team delete

* fix(base_invoke_transformation.py): fix deepseek r1 transformation

remove deepseek name from model url

* test(test_completion.py): assert model route not in url

* feat(base_invoke_transformation.py): infer region name from model arn

prevent errors due to different region name in env var vs. model arn, respect if explicitly set in call though

* test: fix test

* test: skip on internal server error
2025-02-18 19:14:20 -08:00
Krish Dholakia
9e65f867ab
test: add more unit testing for team member endpoints (#8170)
* test: add more unit testing for team member add

* fix(team_endpoints.py): add validation check to prevent same user from being added to team again

prevents duplicates

* fix(team_endpoints.py): raise error if `/team/member_delete` called on member that's not in team

prevent being able to call delete on same member multiple times

* test: update initial tests

* test: fix test

* test: update test to handle no member duplication
2025-02-01 11:23:00 -08:00
Krish Dholakia
73531f4815
Litellm dev 11 08 2024 (#6658)
* fix(deepseek/chat): convert content list to str

Fixes https://github.com/BerriAI/litellm/issues/6642

* test(test_deepseek_completion.py): implement base llm unit tests

increase robustness across providers

* fix(router.py): support content policy violation fallbacks with default fallbacks

* fix(opentelemetry.py): refactor to move otel imports behing flag

Fixes https://github.com/BerriAI/litellm/issues/6636

* fix(opentelemtry.py): close span on success completion

* fix(user_api_key_auth.py): allow user_role to default to none

* fix: mark flaky test

* fix(opentelemetry.py): move otelconfig.from_env to inside the init

prevent otel errors raised just by importing the litellm class

* fix(user_api_key_auth.py): fix auth error
2024-11-08 22:07:17 +05:30
Krish Dholakia
9695c1af10
LiteLLM Minor Fixes & Improvements (10/08/2024) (#6119)
* refactor(cost_calculator.py): move error line to debug - https://github.com/BerriAI/litellm/issues/5683#issuecomment-2398599498

* fix(migrate-hidden-params-to-read-from-standard-logging-payload): Fixes https://github.com/BerriAI/litellm/issues/5546#issuecomment-2399994026

* fix(types/utils.py): mark weight as a litellm param

Fixes https://github.com/BerriAI/litellm/issues/5781

* feat(internal_user_endpoints.py): fix /user/info + show user max budget as default max budget

Fixes https://github.com/BerriAI/litellm/issues/6117

* feat: support returning team member budget in `/user/info`

Sets user max budget in team as max budget on ui

  Closes https://github.com/BerriAI/litellm/issues/6117

* bug fix for optional parameter passing to replicate (#6067)

Signed-off-by: Mandana Vaziri <mvaziri@us.ibm.com>

* fix(o1_transformation.py): handle o1 temperature=0

o1 doesn't support temp=0, allow admin to drop this param

* test: fix test

---------

Signed-off-by: Mandana Vaziri <mvaziri@us.ibm.com>
Co-authored-by: Mandana Vaziri <mvaziri@us.ibm.com>
2024-10-08 21:57:03 -07:00
Krrish Dholakia
a0a1feb7da fix(management/utils.py): fix add_member to team when adding user_email
Fixes https://github.com/BerriAI/litellm/issues/5112
2024-08-10 17:12:09 -07:00
Krrish Dholakia
575afa8029 fix(internal_user_endpoints.py): return all teams if user is admin 2024-08-10 16:36:43 -07:00
Krrish Dholakia
0ab0111d57 test(test_team.py): fix error string asserted 2024-06-11 18:05:20 -07:00
Krrish Dholakia
def648ed3f fix(proxy_server.py): allow passing in a list of team members
allows batch adding members to a team by passing in a list. fixes concurrency issue caused by calling team/member_add in parallel
2024-06-08 19:03:45 -07:00
Krrish Dholakia
5c4abcbdb4 fix(proxy_server.py): fix team member delete endpoint
fixes issue in for loop, removing member from team
2024-06-08 16:27:33 -07:00
Ishaan Jaff
20aa84e110 test - team member budgets 2024-05-22 19:19:51 -07:00
Krrish Dholakia
3f8abe2754 fix(proxy_server.py): secure /team/info endpoint
make sure user requesting team info is part of team or admin
2024-04-16 11:40:08 -07:00
Krrish Dholakia
8a32d8825c fix(proxy_server.py): fix /team/update endpoint
this also removes the functionality for modifying membership via `/team/update`. This is not considered a breaking change, as we've been pointing to usage of `/team/member_add` and `/team/member_delete` for this. Previous behaviour for this endpoint was causing it to be non-functional. If you're impacted, please let us know.
2024-04-15 10:29:21 -07:00
Krrish Dholakia
58bdbecbc6 fix(proxy_server.py): allow updating tpm/rpm limits via /team/update 2024-03-28 15:59:35 -07:00
Krrish Dholakia
dd78a1956a fix(proxy_server.py): fix model alias map + add back testing 2024-03-07 07:56:51 -08:00
Krrish Dholakia
6b8b0f40cf feat(proxy_server.py): add new team_member delete endpoint 2024-03-01 09:14:08 -08:00
Krrish Dholakia
a7229c9253 fix(proxy_server.py): enable proxy /team/delete endpoint 2024-02-21 16:53:12 -08:00
Krrish Dholakia
dca9103b09 refactor(test_team.py): trigger new devrelease 2024-02-16 09:57:51 -08:00
Krrish Dholakia
faa7892b4c test(test_team.py): trigger new build 2024-02-16 08:56:08 -08:00
Krrish Dholakia
3af2fb25be test(test_team.py): adding testing for team endpoints 2024-02-16 08:55:21 -08:00