adrianmejias/laravel-open-ai

1.0.1 2022-01-19 16:16 UTC

This package is auto-updated.

Last update: 2022-06-19 17:06:23 UTC


README

security tests PHPStan PHP CS Fixer StyleCI Build Status codecov Downloads Packagist License: MIT Liberapay

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 OpenAiFacade as OpenAi;

$engines = OpenAi::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.