joemiller88
03/24/2024, 7:29 PMmodule.exports = function (varName, prompt, otherVars) {
// Example logic to return a value based on the varName
var output = `You are a helpful assistant with a bunch of rules
- you like bananas
- you hate rude people`
output = output.replace(/\n/g, "\\n");
return { "output": output };
};
Might be worth updating promptfoo to replace new lines on every imported text file, unless there is a use case where you wouldn't want this.ian
03/24/2024, 8:32 PM.json file with a {role, content} array?joemiller88
03/25/2024, 3:06 PMdefaultTest:
vars:
system_message: file://../prompts/system_message.txtjoemiller88
03/25/2024, 3:13 PMjoemiller88
03/25/2024, 3:13 PMjoemiller88
03/25/2024, 3:38 PMoutput = output.replace(/"/g, '\\"');ian
03/26/2024, 2:17 PMian
03/30/2024, 5:36 PMsystem_message) will be properly escaped as strings. If this behavior isn't working for you for some reason, a small example would be really helpful