From 38bf86d3aedcc11e84b308c005478b66bd0a57e8 Mon Sep 17 00:00:00 2001 From: Allan Tatter Date: Thu, 22 Feb 2024 08:46:46 +0200 Subject: [PATCH] initial release --- README.md | 36 ++++++++++++++++++++++++++++++- composer.json | 5 +++-- src/NovaOpenAIServiceProvider.php | 2 +- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6f117b7..43b2682 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,40 @@ # Nova OpenAI -## Testing +OpenAI SDK for a Laravel application that also stores OpenAI communication and presents it in a Laravel Nova admin panel. + +This is currently an **unstable** package, breaking changes are to be expected. The main objective at the moment is to make it easier to include it as a dependency in our own client projects. This way we can make it more mature and have a v1 release when we feel it suits our needs in practice. This is why we haven't implemented all OpenAI endpoints yet and will add them one-by-one when they are actually needed. + +If you need any features to be implemented or bump its priority in our backlog then feel free to make an inquiry via email at info@outl1ne.com. + +## Requirements + +- `php: >=8.1` +- `laravel/nova: ^4.0` + +## Installation + +```bash +composer require outl1ne/nova-openai + +// optional +php artisan vendor:publish --tag=nova-openai-config +``` + +## Usage + +```php +$response = OpenAI::chat()->create( + model: 'gpt-3.5-turbo', + messages: (new Messages)->system('You are a helpful assistant.')->user('Hello!'), +); + +$response = OpenAI::embeddings()->create( + 'text-embedding-3-small', + 'The food was delicious and the waiter...' +); +``` + +## Contributing ``` composer install diff --git a/composer.json b/composer.json index 56d7f7c..619eada 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,10 @@ { "name": "outl1ne/nova-openai", - "description": "Abstraction layer to store OpenAI communication, pricing and to present it in Laravel Nova environment.", + "description": "OpenAI SDK for a Laravel application that also stores OpenAI communication and presents it in a Laravel Nova admin panel.", "keywords": [ "laravel", - "nova" + "nova", + "openai" ], "license": "MIT", "require": { diff --git a/src/NovaOpenAIServiceProvider.php b/src/NovaOpenAIServiceProvider.php index d23bb15..d9d4f30 100644 --- a/src/NovaOpenAIServiceProvider.php +++ b/src/NovaOpenAIServiceProvider.php @@ -29,7 +29,7 @@ public function boot() $this->publishes([ __DIR__ . '/../config/nova-openai.php' => config_path('nova-openai.php'), - ], 'config'); + ], 'nova-openai-config'); // Register resources Nova::resources(array_filter([