You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Managing GUC parameters in different places is hard to maintain. This
patch organizes GUC definitions in a single place. Also, we use
define_xxx_guc() APIs to define these parameters and it will allow us
to manage GucContext, GucFlags in future.
P.S., the test case test_trusted_model doesn't seem correct. I fixed it
in this patch.
let whitelisted_models = config_csv_list(CONFIG_HF_WHITELIST);
16
+
let whitelisted_models = config_csv_list(&PGML_HF_WHITELIST.1);
19
17
20
18
let model_is_allowed = whitelisted_models.is_empty() || whitelisted_models.contains(&task_model);
21
19
if !model_is_allowed {
22
-
bail!("model {task_model} is not whitelisted. Consider adding to {CONFIG_HF_WHITELIST} in postgresql.conf");
20
+
bail!(
21
+
"model {} is not whitelisted. Consider adding to {} in postgresql.conf",
22
+
task_model,
23
+
PGML_HF_WHITELIST.0
24
+
);
23
25
}
24
26
25
27
let task_trust = get_trust_remote_code(task);
26
-
let trust_remote_code = get_config(CONFIG_HF_TRUST_REMOTE_CODE_BOOL)
27
-
.map(|v| v == "true")
28
-
.unwrap_or(true);
28
+
let trust_remote_code = PGML_HF_TRUST_REMOTE_CODE.1.get();
29
29
30
-
let trusted_models = config_csv_list(CONFIG_HF_TRUST_WHITELIST);
30
+
let trusted_models = config_csv_list(&PGML_HF_TRUST_WHITELIST.1);
31
31
32
32
let model_is_trusted = trusted_models.is_empty() || trusted_models.contains(&task_model);
33
33
34
34
let remote_code_allowed = trust_remote_code && model_is_trusted;
35
35
if !remote_code_allowed && task_trust == Some(true){
36
-
bail!("model {task_model} is not trusted to run remote code. Consider setting {CONFIG_HF_TRUST_REMOTE_CODE_BOOL} = 'true' or adding {task_model} to {CONFIG_HF_TRUST_WHITELIST}");
36
+
bail!(
37
+
"model {} is not trusted to run remote code. Consider setting {} = 'true' or adding {} to {}",
0 commit comments