#Hey everyone I m writing some code to

10 messages · Page 1 of 1 (latest)

shell hill
#

I have googled this, as well as asked ChatGPT and turned up with nothing very helpful. I believe my whole function is correct:

app.post('/request_answer', async (req, res) => {
    // Get the prompt and temperature from the form
      const prompt = req.body.prompt;
      console.log(req.body);
      console.log(req.body.prompt);
      const temperature = Number(req.body.temperature);
      console.log(temperature);
      const endpoint = 'https://api.openai.com/v1/generations';
      const response = await axios.post(endpoint, {
          model: 'text-davinci-003',
          prompt: prompt,
          temperature: temperature,
          max_tokens: 250,
        }, {
          headers: {
            'Content-Type': 'application/json',
            'Authorization': 'API_KEY',
          }
      });
        //console.log(response.data);
        //res.send(response.data);
    });

I have replaced API_KEY with my key and am commenting out the log plus response as it's not even able to execute that code right now.

Has anyone else seen this error or can they see where I went wrong?

#

looks like generations is the issue haha. Tried completions and now it is giving a new error (PROGRESS!)

hushed summit
#

Remove model

#

Wait

#

What are you doing

#

Isn’t generations for dalle

#

Oh you’re on completions now. What’s the error?

low zealotBOT
#
<:attention:1046329820331646986> Fisheye#1162 said:

Thanks for trying to help @hushed summit I've got it working

The issue is that I was using
https://api.openai.com/v1/generations
instead of
https://api.openai.com/v1/completions

Once I had that working I was able to debug some more minor things and it is working now.

||1038910656985968751||

shell hill