This package provides a SDK for the OpenAI API.
Note
This package is still in development and is not ready for production use.
It is proudly powered by Saloon by Sam Carré! 🤠
You can install the package via composer:
composer require chrisreedio/laravel-openai-sdk
You can publish and run the migrations with:
php artisan vendor:publish --tag="laravel-openai-sdk-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="laravel-openai-sdk-config"
This is the contents of the published config file:
return [
'max_per_page' => 100,
'api_key' => env('OPENAI_API_KEY'),
];
Optionally, you can publish the views using
php artisan vendor:publish --tag="laravel-openai-sdk-views"
use ChrisReedIO\OpenAI\Facades\OpenAI;
// Get a list of all the assistants
$assistants = OpenAI::assistants()->list()->collect()->all();
// or via a Lazy Collection
$assistants = OpenAI::assistants()->list()->collect();
$assistants->each(function ($assistant) {
// Do something with the assistant
});
// Create a thread
$thread = OpenAI::threads()->create();
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.