Patient Medication Review
Recommendations and Concerns:
"text-davinci-003",
"prompt" => $inputData['prompt'],
"max_tokens" => 100
));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.openai.com/v1/completions');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey
));
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo json_encode(array('error' => curl_error($ch)));
} else {
echo $response;
}
curl_close($ch);
} else {
echo json_encode(array('error' => 'Invalid request method.'));
}
?>