Commit a6c71ed
fix: change logprobs type from bool to int in Completions endpoint (#5343)
Fixes #5253
The `logprobs` field in `OpenAICompletionRequestWithExtraBody` was typed
as `bool` but the OpenAI Completions API expects an integer (0–5)
indicating how many top log probabilities to include per output token.
This caused a 400 error when callers passed an int:
```
openai.BadRequestError: ... 'Input should be a valid boolean, unable to interpret input'
```
Changes:
- `models.py`: `logprobs: bool | None` → `logprobs: int | None` with
`ge=0, le=5`
- `llama-stack-spec.yaml`: matching schema update (`boolean` → `integer`
with min/max)
The Chat Completions model (`OpenAIChatCompletionRequestWithExtraBody`)
is unchanged — its `logprobs` is correctly a boolean there.
---------
Signed-off-by: Extra Small <littleshuai.bot@gmail.com>
Signed-off-by: Sébastien Han <seb@redhat.com>
Co-authored-by: Sébastien Han <seb@redhat.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 9ed901b commit a6c71ed
6 files changed
Lines changed: 27 additions & 11 deletions
File tree
- client-sdks/stainless
- docs/static
- src/ogx_api/inference
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5008 | 5008 | | |
5009 | 5009 | | |
5010 | 5010 | | |
5011 | | - | |
| 5011 | + | |
| 5012 | + | |
| 5013 | + | |
5012 | 5014 | | |
5013 | | - | |
| 5015 | + | |
5014 | 5016 | | |
5015 | 5017 | | |
5016 | 5018 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1311 | 1311 | | |
1312 | 1312 | | |
1313 | 1313 | | |
1314 | | - | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
1315 | 1317 | | |
1316 | | - | |
| 1318 | + | |
1317 | 1319 | | |
1318 | 1320 | | |
1319 | 1321 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1752 | 1752 | | |
1753 | 1753 | | |
1754 | 1754 | | |
1755 | | - | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
1756 | 1758 | | |
1757 | | - | |
| 1759 | + | |
1758 | 1760 | | |
1759 | 1761 | | |
1760 | 1762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4565 | 4565 | | |
4566 | 4566 | | |
4567 | 4567 | | |
4568 | | - | |
| 4568 | + | |
| 4569 | + | |
| 4570 | + | |
4569 | 4571 | | |
4570 | | - | |
| 4572 | + | |
4571 | 4573 | | |
4572 | 4574 | | |
4573 | 4575 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5008 | 5008 | | |
5009 | 5009 | | |
5010 | 5010 | | |
5011 | | - | |
| 5011 | + | |
| 5012 | + | |
| 5013 | + | |
5012 | 5014 | | |
5013 | | - | |
| 5015 | + | |
5014 | 5016 | | |
5015 | 5017 | | |
5016 | 5018 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
948 | 948 | | |
949 | 949 | | |
950 | 950 | | |
951 | | - | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
952 | 958 | | |
953 | 959 | | |
954 | 960 | | |
| |||
0 commit comments