chrisreedio / laravel-openai-sdk
OpenAI integration for Laravel via Saloon
Requires
- php: ^8.1
- illuminate/contracts: ^10.0
- saloonphp/pagination-plugin: ^2.0
- saloonphp/saloon: ^3.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
This package is auto-updated.
Last update: 2024-10-08 21:04:35 UTC
README
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Ă©! đŸ¤
Installation
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"
Usage
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();
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.