Created
June 28, 2023 13:06
-
-
Save Reine0017/895afa0f6105a5aa1ebb089525423201 to your computer and use it in GitHub Desktop.
How to call callOpenAI function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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