Hi
I have calling API but when asked in spanish text then it disturb some UI in long text and also point 10th comes within point 9th . image below you see
and in english it is ok no ui disturb
and the last thing is its take response time too long like one mint even two mint
here it is my code
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.openai.com/v1/completions');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n \"model\": \"text-davinci-003\",\n \"prompt\": \"$request->aitopic\",\n \"temperature\": 0.6,\n \"max_tokens\": 2048,\n \"top_p\": 1,\n \"frequency_penalty\": 1,\n \"presence_penalty\": 1\n}");
$headers = array();
$headers[] = 'Content-Type: application/json';
$headers[] = 'Authorization: Bearer sk-ZrDc9eizI*****************************';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
/*if (curl_errno($ch)) {
return response()->json();
}*/
$data = json_decode($result,true);
$ai = nl2br($data['choices'][0]['text']) ?? NULL;
curl_close($ch);
if(is_null()){
return response()->json($ai);
}
return response()->json([$ai,$request->aitopic]);
Thanks