I’m on a $12 droplet (2 GiB , 1 vCPU) at DigitalOcean and quite often my script times out or returns 500 or some other server error. I found out that this is not 100% so my code itself calling the API doesn’t seem to the issue.
$response = $client->chat()->create([
'model' => $model,
'messages' => [
['role' => 'user', 'content' => $prompt],
],
'temperature' => $temperature,
'max_tokens' => $max_tokens,
'top_p' => $top_p,
'frequency_penalty' => $frequency_penalty,
'presence_penalty' => $presence_penalty
]);
The prompt is often a very large paragraphs which is asking to summarize it.
I want to know if I serve this PHP script from a DigitalOcean function, will it serve better ?
Since it would be isolated and scale according to the need, chances of the the response from the function will always be 200 outputting the JSON ?