node.jsopenai-apifine-tuning

OpenAI API error when fine-tuning: "This is not a chat model and thus not supported in the v1/chat/completions endpoint"


I've fine-tuned a model using the OpenAI API. Now I want to use this fine-tuned model.

This is my code:

 const response = await openai.chat.completions.create({
    model: process.env.FINE_TUNE_MODEL,
    messages: [
      {
        role: "system",
        content: prompt,
      },
      {
        role: "user",
        content: inputText,
      },
    ],
    temperature: 0,
    top_p: 1,
    frequency_penalty: 0,
    presence_penalty: 0,
});

But there's a 404 error while executing this function.

This is the error message:

NotFoundError: 404 This is not a chat model and thus not supported in the v1/chat/completions endpoint. Did you mean to use v1/completions?

How can I use the fine-tuned model to generate a text?


Solution

  • Problem

    You fine-tuned one of the non-chat models but wanted to use the API endpoint, which is compatible only with the chat models.

    The API endpoint you need to use for a fine-tuned model depends on the model you fine-tune.

    As of today, you can fine-tune the following models:

    Solution

    Use the following rule:

    In other words: