Web App vs API results, web app is great, API is pretty awful

I am using the gpt-3.5-turbo model in the API and I am comparing the results between that and putting my prompts directly into the web app.

When I ask factual questions about analyzing information located in the prompt itself, the API does a very poor job of responding correctly, whereas the web app gets it perfectly right every time.

What enhancements have been done to the web app version of the model over the API, and will they release those enhancements to the API? Right now the API seems almost unusable for me because of how wrong the answers often are.

1 Like

@ben1787 hey, you lucky, at least your gpt-3.5-turbo model works on your API, am trying to use it on mine but it does not return a response, but the text-davinci-003 model works, I don’t know if you could help me out, what should I change to make a text-davinci-003 model set up work on gpt-3.5-turbo

@ejosephrogo Could you show your code or the method you have been trying?

@jeong

$apiKey = “Api key”;

// Get the user’s message from the POST data
$userMessage = $_POST[“message”];

// Set up the cURL request
$ch = curl_init(“https://api.openai.com/v1/completions”);
curl_setopt_array($ch, array(
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer " . $apiKey,
“Content-Type: application/json”
),
CURLOPT_POSTFIELDS => json_encode(array(
“model” => “text-davinci-003”,
“prompt” => $userMessage,
“max_tokens” => 500,
“n” => 1,
“stop” => null,
“temperature” => 0.6,
“presence_penalty” => 0.0,
“best_of” => 1,
“stream” => false,
“stop” => “”,
“echo” => false,
“temperature” => 0.5
))
));

// Execute the cURL request and get the response
$response = curl_exec($ch);

// Check if the cURL request returned an error
if ($response === false) {
//echo $userMessage;
$error = curl_error($ch);
echo $error." - Error";
// Output the error message
error_log('cURL error: ’ . curl_error($ch));
} else {
// Decode the response from the API
$response_data = json_decode($response, true);
if (isset($response_data[‘choices’][0][‘text’])) {
echo $response_data[‘choices’][0][‘text’];
} else {
echo ‘Error: No answer returned, please try again’;
}
}

// Close the cURL handle
curl_close($ch);

Under normal circumstances all I needed to do was to change the text-davinci-003 model id to gpt-3.5-turbo, but when I do the Error: no answer returned… Get showed, but if I change it back then it works well

Answer to your question in on this thread

I am also facing similar issue. GPT 3.5 turbo model provided by api and playground seems to perform much worse than ChatGPT web app. Even simple tasks seem to be a challenge to the api.