26 lines
818 B
Plaintext
26 lines
818 B
Plaintext
enabled = true;
|
|
type = "openai";
|
|
url = "http://litellm.litellm.svc.cluster.local:4000/v1/chat/completions";
|
|
api_key = "{= env.LITELLM_API_KEY =}";
|
|
model = "claude-haiku-4-5";
|
|
model_parameters = {
|
|
"claude-haiku-4-5" = {
|
|
max_tokens = 400,
|
|
temperature = 0.0,
|
|
}
|
|
};
|
|
timeout = 10s;
|
|
# Only ask the model about inbound mail whose score is uncertain (2 <= score < 12).
|
|
condition = <<EOD
|
|
return function(task)
|
|
if task:get_user() then return false, 'authenticated' end
|
|
local ip = task:get_from_ip()
|
|
if ip and ip:is_local() then return false, 'local sender' end
|
|
local res = task:get_metric_result()
|
|
if not res then return false, 'no result' end
|
|
if res.passthrough then return false, 'passthrough' end
|
|
if res.score < 2 or res.score >= 12 then return false, 'score not uncertain' end
|
|
return true
|
|
end
|
|
EOD
|