New Instruct model names + CURL

I tried to switch from Davinci to Instruct-Davinci (text-davinci-001), but I couldn’t get it to work with CURL/PHP…

$ch = curl_init();

$mymodel = "text-davinci-001";

$payload = array( "prompt"=> $myprompt, "max_tokens"=> 250,"temperature"=> $temp, "model"=> $mymodel, "top_p"=> $top_p, "n"=> 1, "presence_penalty" => $pres,"frequency_penalty"=> $freq, "stream"=> false, "logprobs"=> null, "stop"=> "<|endoftext|>");

[SNIP]

curl_setopt($ch, CURLOPT_URL, "https://api.openai.com/v1/engines/davinci/completions");

That’s what I had before, I’ve tried various things for the CURLOPT_URL, but it would never process.

I’ve also tried…


curl_setopt($ch, CURLOPT_URL, "https://api.openai.com/v1/completions");

with both these new models…


$mymodel = "text-davinci-001"; 

$mymodel = "text-davinci-002";

I know I’m missing something small/stupid. Any help appreciated!

Okay, I think I have the CURLOPT_URL wrong as I suspected… I thought the $model variable would pop it into the right place, but it wasn’t… this looks like it works…

curl https://api.openai.com/v1/engines/text-davinci-002/completions

I’m gonna try to hard code the engine rather than having it as a variable…

Posting in case this helps someone else…

Okay looks like I had it wrong, but I was not reading error messages or looking at output… Turns out the prompt is very different on davinci vs text-davinci-002…

CURLOPT_URL, "https://api.openai.com/v1/engines/text-davinci-002/completions