| 400 | } |
| 401 | |
| 402 | std::string task_result_json(const engine::runtime::TaskResult & result, double wall_ms) { |
| 403 | if (result.audio_output.has_value()) { |
| 404 | return task_result_json_with_timing(result, timing_json(wall_ms, *result.audio_output)); |
| 405 | } |
| 406 | if (result.named_audio_outputs.size() == 1) { |
| 407 | return task_result_json_with_timing(result, timing_json(wall_ms, result.named_audio_outputs.front().audio)); |
| 408 | } |
| 409 | return task_result_json_with_timing(result, timing_json(wall_ms)); |
| 410 | } |
| 411 | |
| 412 | std::string streaming_task_result_json( |
| 413 | const engine::runtime::TaskResult & result, |
| 414 | const std::optional<double> & ttft_ms) { |
| 415 | return task_result_json_with_timing(result, ttft_timing_json(require_ttft_ms(ttft_ms))); |
| 416 | } |
| 417 | |
| 418 | std::string stream_event_json(const engine::runtime::StreamEvent & event) { |
| 419 | std::ostringstream out; |
| 420 | out << "{"; |
| 421 | bool first = true; |
| 422 | auto field = [&](const char * name) { |
| 423 | if (!first) { |
| 424 | out << ","; |
| 425 | } |
nothing calls this directly
no test coverage detected