diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-12-20 17:31:52 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-12-20 17:31:52 +0000 |
commit | c753f9cec9cff599d7d12e63358d31d03db9fb0f (patch) | |
tree | 8e7e1917dbdbd014b69810324ca7c5ee595c48d0 /lualib/rspamadm | |
parent | 11841911583fab8f480ba9c419d495946c159ba6 (diff) | |
download | rspamd-c753f9cec9cff599d7d12e63358d31d03db9fb0f.tar.gz rspamd-c753f9cec9cff599d7d12e63358d31d03db9fb0f.zip |
[Feature] Preliminary implementation of LLM based anonymizing
Diffstat (limited to 'lualib/rspamadm')
-rw-r--r-- | lualib/rspamadm/mime.lua | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lualib/rspamadm/mime.lua b/lualib/rspamadm/mime.lua index f8c7fc4f7..f8fba59e5 100644 --- a/lualib/rspamadm/mime.lua +++ b/lualib/rspamadm/mime.lua @@ -193,6 +193,14 @@ anonymize:option "--include-header -I" :description "Include specific headers from anonymization" :argname "<header>" :count "*" +anonymize:flag "--gpt" + :description "Use LLM model for anonymization (requires GPT plugin to be configured)" +anonymize:option "--model" + :description "Model to use for anonymization" + :argname "<model>" +anonymize:option "--prompt" + :description "Prompt to use for anonymization" + :argname "<prompt>" local sign = parser:command "sign" :description "Performs DKIM signing" @@ -267,21 +275,27 @@ local function load_config(opts) end end -local function load_task(opts, fname) +local function load_task(_, fname) if not fname then fname = '-' end - local res, task = rspamd_task.load_from_file(fname, rspamd_config) + local task = rspamd_task:create(rspamd_config, rspamadm_ev_base) + task:set_session(rspamadm_session) + task:set_resolver(rspamadm_dns_resolver) + + local res = task:load_from_file(fname) if not res then parser:error(string.format('cannot read message from %s: %s', fname, task)) + return nil end if not task:process_message() then parser:error(string.format('cannot read message from %s: %s', fname, 'failed to parse')) + return nil end return task |