open-ai: The model won't print/return any results.
Hi there, I’m trying to set up a working example using Laravel but when I dd($complete) I get false.
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Orhanerday\OpenAi\OpenAi;
class HomeController extends Controller
{
public function index() {
$open_ai = new OpenAi(env('OPEN_AI_API_KEY'));
$engines = $open_ai->engines();
$complete = $open_ai->complete([
'engine' => 'davinci',
'prompt' => 'Hello',
'temperature' => 0.9,
'max_tokens' => 150,
'frequency_penalty' => 0,
'presence_penalty' => 0.6,
]);
$data = json_decode($complete, true);
dd($engines);
}
}
$open_ai returns a collection with engine, headers and contentTypes
$engines returns false as well, it’s not even reading the library.
$data returns null
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (8 by maintainers)
Hello,
Had the same issue, it seems to be related to the SSL certificate as @silicahd mentioned, I managed to get around it by adding the following flags in the $curl_info variable:
at the end of the open-ai/src/OpenAi.php file
thank you @orhanerday for this amazing repo 👍
For anybody running into this if you are using something like aaPanel or others likely your certificate is expired.
Credit to this fix to the guys from the aaPanel forum. @orhanerday thank you for the support and the amazing package.
mkdir -p /etc/pki/tls/certs wget -O /etc/pki/tls/certs/ca-bundle.crt https://curl.se/ca/cacert.pem --no-check-certificate chmod 444 /etc/pki/tls/certs/ca-bundle.crtThat’s great to hear that! it’s not boring, so I don’t need any patience 😃. I feel glad while helping you guys.
Have a great day!
It finally worked! I got curl to finally work.
Thank you for your patience, I can’t wait to see the limits of this library.
Sorry about that, Let’s try with Docker then. I’ll be waiting for your response.