I am trying to summarize chat transcripts in an excel file. It shows error for the following code:
`// Iterate over rows array using a for...of loop to maintain async/await context
for (let { row, rowNumber } of rows) {
let chatText = row.getCell(1).value;
if (chatText) { // Ensure there's text to summarize
try {
**const response = await openai.createCompletion({**
model: "text-davinci-003",
prompt: `Summarize this chat: ${chatText}`,
max_tokens: 100,
});
let summary = response.data.choices[0].text.trim();
row.getCell(2).value = summary; // Assign the summary to the next column
} catch (apiError) {
console.error(`Error processing row ${rowNumber}:`, apiError);
}`
Exepctation was that the rows in my excel sheet can be summarized using the openai api.