In the OpenAI API, I would like to run 3 prompts, add the results to a variable called text, and display them all at once. Right now, the problem is that I can only do 1 prompt at a time. Is there a way to run 3 prompts at once? If so, please add some example codes for me to use. Thanks.
import { Configuration, OpenAIApi } from "openai";
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
export default async function (req, res) {
const completion = await openai.createCompletion({
model: "text-davinci-002",
temperature: 1,
max_tokens: 3000,
top_p: 1,
frequency_penalty: 2,
presence_penalty: 2,
prompt: "tell me about one. tell me about two. tell me about three.",
});
res.status(200).json({ result: completion.data.choices[0].text });
}