fix: increase health check max_tokens from 1 to 16 (#23836) - #26217
fix: increase health check max_tokens from 1 to 16 (#23836)#26217hannahmadison wants to merge 1 commit into
Conversation
Greptile SummaryThis PR increases the health check Confidence Score: 5/5Safe to merge — minimal, well-tested change with no functional regressions. The change is a single-line bump of a default constant from 1 to 16. Tests are properly updated, the wildcard assertion is now stricter (not weaker), and all tests remain mock-only. No security, data, or backwards-compatibility concerns. No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/proxy/health_check.py | Single-line change: max_tokens default for non-wildcard health checks raised from 1 to 16. Logic and branching are unchanged. |
| tests/test_litellm/proxy/test_health_check_max_tokens.py | Assertions updated to match new default (16) and wildcard test tightened to strict key-absence; all tests use mocks with no real network calls. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[_update_litellm_params_for_health_check] --> B{health_check_max_tokens\nin model_info?}
B -- Yes --> C[max_tokens = health_check_max_tokens]
B -- No --> D{"'*' in model or\nhealth_check_model?"}
D -- Yes wildcard --> E[max_tokens not set]
D -- No non-wildcard --> F[max_tokens = 16\npreviously 1]
C --> G[proceed with health check call]
E --> G
F --> G
Reviews (3): Last reviewed commit: "fix: increase health check max_tokens fr..." | Re-trigger Greptile
adcea76 to
d53528a
Compare
Models like GPT-5 have minimum token requirements that cause health checks to fail when max_tokens=1. Increase to 16, which is enough for a valid response while keeping health checks lightweight. Also tighten the wildcard test assertion to verify max_tokens is not set at all (not just != 1), preventing false passes if a future bug sets it to an arbitrary value. Fixes BerriAI#23836
d53528a to
6b9e934
Compare
|
Hey @Sameerlite Quick check: was #26217 closed intentionally, or as a side effect of |
|
It is the latter, please create a new one |
|
@Sameerlite Will do! Thanks for the quick response! |
Relevant issues
Fixes #23836
Pre-Submission checklist
tests/test_litellm/directorymake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewType
🐛 Bug Fix
Changes
Problem
Health checks set
max_tokens=1for non-wildcard models, which causes failures with newer models like GPT-5 that have minimum token requirements. A single token is insufficient for these models to generate a valid response.Solution
Increased the default
max_tokensfrom 1 to 16 for health check requests. This provides enough tokens for models to generate a meaningful response while keeping the health check lightweight.Also tightened the wildcard test assertion from a weak disjunctive check (
not in or != 1) to strict key-absence (not in), preventing false passes if a future bug setsmax_tokensto an arbitrary value for wildcard models.Changes Made
litellm/proxy/health_check.py: Changedmax_tokensdefault from 1 to 16tests/test_litellm/proxy/test_health_check_max_tokens.py: Updated default assertion to expect 16, tightened wildcard assertion to strict key-absence checkSupersedes #24893 (closed due to branch contamination from upstream merge).