Cant use some gpt-3.5 api models

Cant use some gpt-3.5 api models. Like gpt-3.5-turbo , code-davinci-002.Getting server 500 error. But works fine with text-davinci-003.

require(“dotenv”).config();
const { Configuration, OpenAIApi } = require(“openai”);
const express = require(“express”);
const cors = require(“cors”);
const bodyParser = require(“body-parser”);

const configuration = new Configuration({
organization: “org-l0cNBbeMn1Rt9cabZOTLWYBr”,
apiKey: “■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■55ITgczH”,
});

const openai = new OpenAIApi(configuration);

const app = express();
const port = 3080;

app.use(cors());
app.use(bodyParser.json());

app.post(“/”, async (req, res) => {
try {
const { message } = req.body;
console.log(message);
const response = await openai.createCompletion({
model: “gpt-3.5-turbo”,
prompt: message,
max_tokens: 500,
temperature: 0,
});

res.json({
  data: response.data,
});

} catch (error) {
console.error(error);
res.status(500).send(“An error occurred”);
}
});

app.listen(port, () => {
console.log(Server listening on port ${port});
});

GPT is different endpoint than davinci. Use createChatCompletion

1 Like

Please use three back-ticks (```) before and after on a separate line to show your code. It makes it more legible. Use Markdown properly.

E.g

Code here

Also, cumon my friend we don’t need to see your “console.logs”. Remove those and don’t be lazy!