From d09a4f48d405b2e746b9c630520230b81560ab36 Mon Sep 17 00:00:00 2001 From: pancake Date: Tue, 22 Oct 2024 00:56:44 +0200 Subject: [PATCH] Improve decai prompt --- decai/decai.r2.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/decai/decai.r2.js b/decai/decai.r2.js index 3f85b93..d8a1005 100644 --- a/decai/decai.r2.js +++ b/decai/decai.r2.js @@ -72,7 +72,7 @@ You can write your custom decai commands in your ~/.radare2rc file. let decaiModel = ""; let lastOutput = ""; let decaiCache = false; - let decprompt = "Respond with code and DO NOT explain or use markdown. Keep it simple and remove unnecessary statements, Rewrite the goto statements into higher level constructs using 'string:' and call arguments from comments, use better names for variables and remove unnecessary or confusing logic"; + let decprompt = "Do not explain, respond using ONLY code. Simplify and and make it more readable. Use better variable names, keep it simple and avoid unnecessary logic, rewrite 'goto' into higher level constructs, Use comments like 'string:' to resolve function call arguments"; function decaiEval(arg) { const [k, v] = arg.split("="); @@ -227,7 +227,7 @@ You can write your custom decai commands in your ~/.radare2rc file. // const hfModel = "meta-llama/Llama-3.1-8B-Instruct"; // const hfModel = "meta-llama/Llama-3.2-1B-Instruct"; // const hfModel = "Qwen/Qwen2.5-72B-Instruct"; - const query = hideprompt? msg: decprompt + ", Explain this pseudocode in " + decaiLanguage + "\n" + msg; + const query = hideprompt? msg: decprompt + ", Transform this pseudocode into " + decaiLanguage + "\n" + msg; const payload = JSON.stringify({ inputs: query, parameters: { @@ -267,7 +267,7 @@ You can write your custom decai commands in your ~/.radare2rc file. return "Cannot read ~/.r2ai.openai-key"; } const openaiModel = (decaiModel.length > 0)? decaiModel: "gpt-4"; - const query = hideprompt? msg: decprompt + ", Explain this pseudocode in " + decaiLanguage + "\n" + msg; + const query = hideprompt? msg: decprompt + ", Transform this pseudocode into " + decaiLanguage + "\n" + msg; const payload = JSON.stringify({ model: openaiModel, max_tokens: 5128, @@ -293,7 +293,7 @@ You can write your custom decai commands in your ~/.radare2rc file. return "error invalid response"; } function r2aiOpenAPI(msg, hideprompt) { - const query = hideprompt? msg: decprompt + ", Explain this pseudocode in " + decaiLanguage + "\n" + msg; + const query = hideprompt? msg: decprompt + ", Transform this pseudocode into " + decaiLanguage + "\n" + msg; const payload = JSON.stringify({ "prompt": query }); const curlcmd = `curl -s ${decaiHost}:${decaiPort}/completion -H "Content-Type: application/json"