I have a question regarding the GenAI Platform that DigitalOcean started recently.
I have a LAMP stack droplet that make extensive use of ChatGPT API (gpt-4o model) on our website. I want to know if using the GenAI Platform replacing (or as an alternative option) the ChatGPT API will require a whole lot of rewrite code in terms of API calls ?
This is what I have so far :
$client = OpenAI::client($OPENAI_API_KEY);
$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
]);
$answer = trim($response['choices'][0]['message']['content']);
Is DO’s GenAI’s API syntax as compatible as OpenAI ?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey!
DigitalOcean’s GenAI Platform offers API compatibility with OpenAI, allowing you to use existing OpenAI-compatible SDKs and libraries without significant code changes.
This means your current implementation with the OpenAI PHP client should work out of the box with the GenAI Platform.
Take a look at this guide here for more details:
Let me know how it goes!
- Bobby