@brief Configure chat engine parameters from options and request @param options the options JSON object @param request the request JSON object
| 463 | ///@param options the options JSON object |
| 464 | ///@param request the request JSON object |
| 465 | void RestHandler::configure_chat_engine_parameters(const json& options, const json& request) { |
| 466 | if (request.contains("temperature")) { |
| 467 | float temperature = request["temperature"]; |
| 468 | auto_chat_engine->set_temperature(temperature); |
| 469 | } |
| 470 | if (request.contains("top_p")) { |
| 471 | float top_p = request["top_p"]; |
| 472 | auto_chat_engine->set_topp(top_p); |
| 473 | } |
| 474 | if (request.contains("top_k")) { |
| 475 | int top_k = request["top_k"]; |
| 476 | auto_chat_engine->set_topk(top_k); |
| 477 | } |
| 478 | if (request.contains("min_p")) { |
| 479 | int min_p = request["min_p"]; |
| 480 | auto_chat_engine->set_minp(min_p); |
| 481 | } |
| 482 | if (request.contains("presence_penalty")) { |
| 483 | float presence_penalty = request["presence_penalty"]; |
| 484 | auto_chat_engine->set_presence_penalty(presence_penalty); |
| 485 | } |
| 486 | if (request.contains("frequency_penalty")) { |
| 487 | float frequency_penalty = request["frequency_penalty"]; |
| 488 | auto_chat_engine->set_frequency_penalty(frequency_penalty); |
| 489 | } |
| 490 | if (request.contains("repetition_penalty")) { |
| 491 | float repetition_penalty = request["repetition_penalty"]; |
| 492 | auto_chat_engine->set_repetition_penalty(repetition_penalty); |
| 493 | } |
| 494 | if (request.contains("think")) { |
| 495 | bool enable_thinking = request["think"]; |
| 496 | auto_chat_engine->configure_parameter("enable_think", enable_thinking); |
| 497 | } |
| 498 | if (request.contains("reasoning_effort")) { |
| 499 | std::string reasoning_effort = request["reasoning_effort"]; |
| 500 | auto_chat_engine->configure_parameter("reasoning_effort", reasoning_effort); |
| 501 | } |
| 502 | |
| 503 | if (request.contains("image-max-tokens")) { |
| 504 | int image_max_tokens = request["image-max-tokens"]; |
| 505 | auto_chat_engine->configure_parameter("image_max_tokens", image_max_tokens); |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | json RestHandler::build_nstream_response(std::string response_text) { |
| 510 | // Get tool info |
nothing calls this directly
no test coverage detected