Skip to content

Instantly share code, notes, and snippets.

@Reine0017
Created June 28, 2023 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Reine0017/895afa0f6105a5aa1ebb089525423201 to your computer and use it in GitHub Desktop.
Save Reine0017/895afa0f6105a5aa1ebb089525423201 to your computer and use it in GitHub Desktop.
How to call callOpenAI function
app.post("/plan", function(req, res) {
let occasion = req.body.occasion;
let pax = req.body.pax;
let budget = req.body.budget;
let theme = req.body.theme;
let country = req.body.theme
const prompt = `Teach me how to plan for ${occasion}, for ${pax} people. I have a budget of ${budget} dollars. My theme is ${theme}. I am in ${country}.`
callOpenAI(prompt).then(response => {
console.log("Response", response)
res.json(response)
}).catch(error => {
console.log("ERROR", error)
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment