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?
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:
gpt-4o-mini-2024-07-18
(chat model),gpt-4o-2024-05-13
(chat model),gpt-4-0613
(chat model),gpt-3.5-turbo-0125
(chat model),gpt-3.5-turbo-1106
(chat model),gpt-3.5-turbo-0613
(chat model),babbage-002
(non-chat model), anddavinci-002
(non-chat model).Use the following rule:
/v1/chat/completions
API endpoint./v1/completions
API endpoint.In other words:
client.chat.completions.create
method.client.completions.create
method.