MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / cmd_set

Method cmd_set

src/runner/runner.cpp:513–612  ·  view source on GitHub ↗

\brief Set the model parameters \param input_list, std::vector

Source from the content-addressed store, hash-verified

511/// \brief Set the model parameters
512/// \param input_list, std::vector<std::string>
513void Runner::cmd_set(std::vector<std::string>& input_list) {
514 // remove the /set
515 if (input_list.size() < 3){
516 std::cout << "Usage: /set [context] [value]" << std::endl;
517 std::cout << "Available parameters: " << std::endl;
518 std::cout << " /set topk [value] - set the top-k" << std::endl;
519 std::cout << " /set topp [value] - set the top-p" << std::endl;
520 std::cout << " /set minp [value] - set the min-p" << std::endl;
521 std::cout << " /set temp [value] - set the temperature" << std::endl;
522 std::cout << " /set rep-pen [value] - set the repetition penalty" << std::endl;
523 std::cout << " /set freq-pen [value] - set the frequency penalty" << std::endl;
524 std::cout << " /set pres-pen [value] - set the presence penalty" << std::endl;
525 std::cout << " /set sys-msg [value] - set the system message" << std::endl;
526 std::cout << " /set ctx-len [value] - set the max context length" << std::endl;
527 std::cout << " /set gen-lim [value] - Limit tokens generated per round" << std::endl;
528 std::cout << " /set r-eff [low|medium|high] - set the reasoning effort level (GPT-OSS only, default = medium)" << std::endl;
529 return;
530 }
531
532 std::string set_context = input_list[1];
533
534 // Handle system_prompt specially since it can be multi-line
535 if (set_context == "sys-msg") {
536 // Reconstruct the original input to get the full system prompt
537 std::string full_input;
538 for (size_t i = 2; i < input_list.size(); i++) {
539 if (i > 2) full_input += " ";
540 full_input += input_list[i];
541 }
542 this->system_prompt = full_input;
543 this->auto_chat_engine->configure_parameter("system_prompt", this->system_prompt);
544 return;
545 }
546
547 // For other parameters, use the third token as the value
548 if (input_list.size() < 3) {
549 std::cout << "Usage: /set [context] [value]" << std::endl;
550 return;
551 }
552
553 std::string set_value = input_list[2];
554
555 if (set_context == "topk"){
556 this->auto_chat_engine->set_topk(std::stoi(set_value));
557 }
558 else if (set_context == "topp"){
559 this->auto_chat_engine->set_topp(std::stof(set_value));
560 }
561 else if (set_context == "minp") {
562 this->auto_chat_engine->set_minp(std::stof(set_value));
563 }
564 else if (set_context == "temp"){
565 this->auto_chat_engine->set_temperature(std::stof(set_value));
566 }
567 else if (set_context == "rep-pen"){
568 this->auto_chat_engine->set_repetition_penalty(std::stof(set_value));
569 }
570 else if (set_context == "freq-pen"){

Callers 1

runMethod · 0.95

Calls 11

set_topkMethod · 0.80
set_toppMethod · 0.80
set_minpMethod · 0.80
set_temperatureMethod · 0.80
set_frequency_penaltyMethod · 0.80
set_presence_penaltyMethod · 0.80
set_max_lengthMethod · 0.80
sizeMethod · 0.45
configure_parameterMethod · 0.45
get_current_modelMethod · 0.45

Tested by

no test coverage detected