Commit c300cb0
committed
fix: populate required OpenResponses fields with non-null defaults
The OpenResponses conformance spec requires several response fields to
always be present as concrete non-null values. llama-stack was returning
null for these fields when not explicitly set, causing Zod schema
validation to fail on every conformance test.
For each affected field, the fix keeps the Python/OpenAPI schema
definition unchanged (preserving OpenAI spec conformance scores) while
ensuring the actual HTTP response body always carries a concrete value.
Fields fixed:
- background: always False for non-background responses (was None)
- tool_choice: defaults to "auto" when not specified (was None)
- truncation: defaults to "disabled" when not specified (was None)
- service_tier: defaults to "default" when not specified (was None)
- tools: always an array; available_tools() already returns [] not None
- temperature: defaults to 1.0 when not specified (was None)
- top_p: defaults to 1.0 when not specified (was None)
- logprobs: always an empty array when not requested (was None)
Changes are applied in _snapshot_response() and _create_refusal_response()
in the streaming orchestrator, and in convert_chat_choice_to_response_message()
for the non-streaming path.
Closes #4987
Closes #4988
Closes #4990
Signed-off-by: Charlie Doern <cdoern@redhat.com>1 parent 0fc1c91 commit c300cb0
4 files changed
Lines changed: 17 additions & 10 deletions
File tree
- src
- llama_stack_api
- llama_stack/providers/inline/agents/meta_reference/responses
- tests/integration/responses
Lines changed: 14 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
222 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
223 | 229 | | |
224 | 230 | | |
225 | | - | |
| 231 | + | |
226 | 232 | | |
227 | | - | |
228 | 233 | | |
229 | 234 | | |
230 | 235 | | |
| |||
250 | 255 | | |
251 | 256 | | |
252 | 257 | | |
| 258 | + | |
253 | 259 | | |
254 | 260 | | |
255 | 261 | | |
| |||
258 | 264 | | |
259 | 265 | | |
260 | 266 | | |
261 | | - | |
| 267 | + | |
| 268 | + | |
262 | 269 | | |
263 | | - | |
| 270 | + | |
264 | 271 | | |
265 | 272 | | |
266 | 273 | | |
| |||
271 | 278 | | |
272 | 279 | | |
273 | 280 | | |
274 | | - | |
| 281 | + | |
275 | 282 | | |
276 | | - | |
| 283 | + | |
277 | 284 | | |
278 | 285 | | |
279 | 286 | | |
| |||
1050 | 1057 | | |
1051 | 1058 | | |
1052 | 1059 | | |
1053 | | - | |
| 1060 | + | |
1054 | 1061 | | |
1055 | 1062 | | |
1056 | 1063 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
712 | 712 | | |
713 | 713 | | |
714 | 714 | | |
715 | | - | |
| 715 | + | |
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| |||
0 commit comments