friendlyName:'Get human interpretation from osquery sql',
description:'Infer policy information from osquery SQL.',
inputs:{
sql:{
type:'string',
required:true
},
},
exits:{
success:{
outputFriendlyName:'Humanesque interpretation',
outputDescription:'If the call to the LLM fails, then a success response is sent with an explanation about the failure (e.g. "under heavy load", etc)',
outputExample:{
risks:'Using an outdated macOS version risks exposure to security vulnerabilities and potential system instability.',
whatWillProbablyHappenDuringMaintenance:'We will update your macOS to version 14.4.1 to enhance security and stability.'
}
},
},
fn:asyncfunction({sql}){
if(!sails.config.custom.openAiSecret){
thrownewError('sails.config.custom.openAiSecret not set.');
}//•
// Build our prompt
letprompt=`Given this osquery policy: aka a query which either passes (≥1 row) or fails (0 rows) for a given laptop, what risks might we anticipate from that laptop having failed the policy?
sails.log.warn('When trying to parse a JSON report returned from the Open AI API, an error occurred. Error details from JSON.parse: '+err.stack+'\n Report returned from Open AI:'+openAiResponse.choices[0].message.content);