async function gptFunctions(prompts, model, functions){
const plan = readFile("public/generated/shared_deps.md")
await openai.chat.completions.create({
messages: [{ role: "system", content: s.appSystemPrompt+"Given the prompt and the plan, return a list of strings corresponding to the new files that will be generated."}
,
{
"role": "user",
"content": " I want a:" +s.prompt,
},
{
"role": "user",
"content": " The plan we have agreed on is:"+s.plan,
},
],
model: model,
functions: [{'name': 'file_paths', 'description': 'Construct a list of file names.', 'parameters': {'type': 'object', 'properties': {'files_to_edit': {'type': 'array', 'items': {'type': 'string'}}}, 'required': ['files_to_edit']}}],
function_call:{"name":"file_paths"}
}).then((response) => {
let temp = JSON.parse(response.choices[0].message.function_call.arguments).files_to_edit;
console.log(temp);
}).catch((error) => {
console.log(error);
});
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter