Pull requests / #3167
#3167 serve: accept the three thinking-budget field names (pi's thinkingTokenBudgetField) as aliases
open · @shizhx · 0 commentaires · Sur GitHub
Server & APIAMD / HIPNVIDIA / CUDA
Description
## Summary
pi's `thinkingTokenBudgetField` can be any of the other providers' names for the same budget; clients send `thinking_token_budget` (vLLM), `thinking_budget` (Qwen) or `thinking_budget_tokens` (llama.cpp). Those fields were silently ignored, so the thinking budget never applied. The serve layer now copies the first alias present into `reasoning_budget_tokens` before dispatching; the request's own `reasoning_budget_tokens` wins.
```text
on(request, for /v1/chat/completions | /v1/messages | /v1/responses)
if request has no reasoning_budget_tokens
copy first present of
thinking_token_budget, thinking_budget, thinking_budget_tokens
→ reasoning_budget_tokens
dispatch # unchanged downstream: validation, budget, wrap-up
```
Serve layer only — 9 lines in `serve/server.py` plus tests and the DETAILS.md note. No engine change; the budget machinery itself (#123) is untouched.
## Evidence
- **Before:** parent commit `477ac13c`, same four tests — the alias is ignored, thinking runs to the end, a bad alias is not rejected:
```text
FAIL test_the_budget_alias_field_names
AssertionError: 'Let me think step by step about two plus two. ...' (full thinking, no wrap-up)
!= 'Let me think step by
I have thought about this long enough; time to give my answer.'
FAIL test_a_bad_alias_is_a_400
AssertionError: 200 != 400 : ('thinking_token_budget', 1.5)
```
- **After:**
```text
test_the_budget_alias_field_names ... ok
test_the_request_s_own_budget_wins_over_the_aliases ... ok
test_the_alias_field_order_wins ... ok
test_a_bad_alias_is_a_400 ... ok
Ran 4 tests in 2.250s — OK
python3 -m unittest serve.test_server
Ran 341 tests in 111.677s — OK
```
Measured on this PC with the mock engine (serve's tests run without a GPU or downloads). No backend files touched, so no CUDA/HIP/SYCL builds; the alias lands before the existing, separately-tested budget path.
## Merge Danger
**Door:** Two-way. Additive serve-layer normalization; rolling back is a revert, and nothing downstream knows the budget came from an alias. Default path stays byte-identical: a request without any of the three aliases has `reasoning_budget_tokens` left untouched.
**Blast Radius:** small — requests carrying one of the alias fields now have it applied as the thinking budget (previously ignored), and an invalid alias value now 400s like `reasoning_budget_tokens` does (previously 200 and ignored).Sur le site
Liens install, modèles, releases.