Super thankful for any clarity on completions - const response = await openai.completions.create({

I have tried a bunch of the different unofficial api’s for nextjs, and while the example works fine, as I expand it to handle a different prompt setup the API fails to work right. Could really use your help, anyone at all, hopefully I’m just being foolish and not seeing the forest thru the trees.

i also tried const instead of let, both failed to produce results, all the code right up til this line works, but fails still. any help would be massively appreciated.

async function summarizeStructure(**object,** objType) {
  // Generate a prompt for GPT-3 based on the structure
  let StructurePrompt = generateStructurePrompt(**object**);
  let prompt = `Please provide a detailed and explicit description of the following structure in a single paragraph:\n\n${StructurePrompt}`;

  // Generate a summary of the structure using the GPT-3 API
  let summary = await generateSummary(prompt);

  // Print the summary to the console
  console.log("Summary:", summary);

async function generateSummary(prompt) {
  // Call the GPT-3 API to generate a summary of the folder structure
  console.log("calling GPT");
  const response = await openai.completions.create({
    engine: "text-davinci-002",
    prompt: prompt,
    max_tokens: 1024,
    n: 1,
    stop: "\n",
    temperature: 0.5,
Console out:

calling GPT
error - pages\api\generate.js (52:44) @ create
error - unhandledRejection: TypeError: Cannot read properties of undefined (reading 'create')
    at generateSummary (webpack-internal:///(api)/./pages/api/generate.js:51:47)
    at summarizeStructure (webpack-internal:///(api)/./pages/api/generate.js:44:25)
    at main (webpack-internal:///(api)/./pages/api/generate.js:93:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  50 |   // Call the GPT-3 API to generate a summary of the structure
  51 |   /* eslint-disable */console.log(...oo_oo(`8b8ab41a_2`,"calling GPT"));
> 52 |   const response = await openai.completions.create({
     |                                            ^
  53 |     engine: "text-davinci-002",
  54 |     prompt: prompt,
  55 |     max_tokens: 1024,



{“error”:“Method GET is not allowed.”}

Did you solve this problem? I got same error.