adrianmejias / laravel-open-ai
Open AI wrapper for Laravel Framework.
Fund package maintenance!
adrianmejias
Ko Fi
Liberapay
paypal.me/adrianmejias
Requires
- php: ^8.0|^8.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.4
- illuminate/support: ^8.42|^9.21
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.4
- mockery/mockery: ^1.4
- orchestra/testbench: ^6.23
- pestphp/pest: ^1.21
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/php-code-coverage: ^9.2
This package is auto-updated.
Last update: 2024-04-30 00:33:40 UTC
README
Open AI api wrapper for the Laravel Framework.
Installation
This version supports PHP 8.0. You can install the package via composer:
composer require adrianmejias/laravel-open-ai
To create the config/open-ai.php
configuration file:
php artisan vendor:publish --tag=open-ai
Usage
Example
<?php use AdrianMejias\OpenAi\Facades\OpenAiFacade; $engines = OpenAiFacade::engines();
Expected Output:
$engines = [ 'object' => 'list', 'data' => [ [ 'object' => 'engine', 'id' => 'ada', 'ready' => 1, 'owner' => 'openai', 'created' => '', 'permissions' => '', 'replicas' => '', 'ready_replicas' => '', 'max_replicas' => '', ], // ... ], ];
Api Requests
completions(array $options, string $engine = 'davinci')
- Get a list of completions.search(array $options, string $engine = 'davinci')
- Get a list of search results.answers(array $options)
- Get a list of answers.classifications(array $options)
- Get a list of classifications.files(string $file, string $purpose = 'classifications')
- Publish a training file (jsonl).engines()
- Get a list of engines.engine(string $engine)
- Get information for a specific engine.
Testing
composer test
Todo
- Add to packagist repo
- Add unit tests
- Add documentation for open source contributations
- Add GitHub Action for unit tests
- Add more unit test coverages
- Add more documentation to README.md
- Add API listing to README.md
Contributing
Thank you for considering contributing to Laravel Open Ai! You can read the contribution guide here.
Code of Conduct
In order to ensure that the community is welcoming to all, please review and abide by the Code of Conduct.
Security Vulnerabilities
Please see the security file for more information.
License
The MIT License (MIT). Please see the license file for more information.