| 389 | int resolve_max_output_tokens(const json & body, int default_max_tokens) { |
| 390 | if (body.contains("max_tokens")) { |
| 391 | return body.at("max_tokens").get<int>(); |
| 392 | } |
| 393 | if (body.contains("max_output_tokens")) { |
| 394 | return body.at("max_output_tokens").get<int>(); |
| 395 | } |
| 396 | if (body.contains("max_completion_tokens")) { |
| 397 | return body.at("max_completion_tokens").get<int>(); |
| 398 | } |
| 399 | return default_max_tokens; |
| 400 | } |
| 401 | |
| 402 | // Sampler parameters. When the request omits a value, fall back to the |
| 403 | // model card's sampling defaults (spec §3.3); when the card doesn't |
| 404 | // supply one either, use the hard-coded default. |
| 405 | SamplerCfg parse_request_sampler(const json & body, |
no test coverage detected