Right now I'm using createCompletion, but I'm wondering if something else might be more efficient/accurate. Doing something like this:
const analyzeText = async text => {
console.log('Analyzing text...')
const openai = new OpenAIApi(configuration)
const result = await openai.createCompletion({
model: 'text-davinci-edit-001',
prompt: `Analyze the text and extract mentions of movies, films, books, short stories, or articles. Then, categorize them into separate lists and return the lists.
Text: ${text}`,
max_tokens: 100,
n: 1,
stop: null,
temperature: 0.7
})
console.log('Text analyzed successfully!')
return result.data.choices[0].text.trim()
}