Commit 0f22862
committed
fix(inference): reject a reply whose only message field is null
`hasValidChatMessageFields` set `recognizedField` on the mere presence of a
`content`, `reasoning_content`, or `refusal` key, before the value was read.
`isValidChatContent` admits `null` because that is the shape OpenAI uses for a
pure tool call, so `{"choices":[{"message":{"role":"assistant","content":null}}]}`
satisfied the validator with no tool call anywhere in the message. `doctor` and
`status` reported "model-invocation probe succeeded" for a reply that carried
nothing, which is the shape a quota-exhausted or truncated hosted turn returns.
The same function already rejects the message when the key is absent, and its
own failure text states the rule it means to enforce: "no choice carried a
message with text content, a refusal, or tool calls". A nulled key carries
exactly as much proof as a missing one.
The flag now moves behind the value check, matching the rule the `tool_calls`
branch adopted in NVIDIA#9124: presence claims nothing, only a value does. A reply
that pairs `"content": null` with a real tool call still validates, because the
`tool_calls` branch sets the flag.
Signed-off-by: Udaya Tejas <udayatejas2004@gmail.com>1 parent 7d516f2 commit 0f22862
2 files changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| 297 | + | |
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
222 | 221 | | |
223 | 222 | | |
224 | 223 | | |
225 | 224 | | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| |||
0 commit comments