Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Open AI wrapper for the Laravel Framework.

License

Notifications You must be signed in to change notification settings

adrianmejias/laravel-open-ai

Repository files navigation

Open AI Package for Laravel

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 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.