MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / set_option

Method set_option

subprojects/llama.cpp/common/preset.cpp:120–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120void common_preset::set_option(const common_preset_context & ctx, const std::string & env, const std::string & value) {
121 // try if option exists, update it
122 for (auto & [opt, val] : options) {
123 if (opt.env && env == opt.env) {
124 val = value;
125 return;
126 }
127 }
128 // if option does not exist, we need to add it
129 if (ctx.key_to_opt.find(env) == ctx.key_to_opt.end()) {
130 throw std::runtime_error(string_format(
131 "%s: option with env '%s' not found in ctx_params",
132 __func__, env.c_str()
133 ));
134 }
135 options[ctx.key_to_opt.at(env)] = value;
136}
137
138void common_preset::unset_option(const std::string & env) {
139 for (auto it = options.begin(); it != options.end(); ) {

Callers 3

update_argsMethod · 0.80
load_from_cacheMethod · 0.80
load_from_models_dirMethod · 0.80

Calls 4

string_formatFunction · 0.70
findMethod · 0.65
atMethod · 0.65
endMethod · 0.45

Tested by

no test coverage detected