crembelski / iacommunication
This package allows you to communicate with OpenAI via a simple interface.
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/crembelski/iacommunication
Requires
- php: >=8.3
- guzzlehttp/guzzle: >=7.8
Requires (Dev)
- mockery/mockery: ^1.6
- phpunit/phpunit: ^11.3
README
This package allows you to communicate with OpenAI via a simple interface.
Installation
-
Install the Package
Run the following command in your project root to install the package:composer require crembelski/iacommunication
-
Add the Service Provider
In yourconfig/app.php, add the following line to theprovidersarray:crembelski\iacommunication\IACommunicationServiceProvider::class,
-
Publish the Configuration
Run the following command to publish the configuration file:php artisan vendor:publish --tag=config --provider="crembelski\iacommunication\IACommunicationServiceProvider" -
Configure Your OpenAI
Add your OpenAI API Key and the service name in the.envfile of your Laravel application. Example:IA_API_KEY=your_openai_api_key_here IA_SERVICE=OpenAI
Replace
your_openai_api_key_herewith your actual API key from OpenAI.
Usage
Once installed and configured, you can use the completions method to send a message to OpenAI.
use crembelski\iacommunication\IACommunication; $iaComm = new IACommunication(); $response = $iaComm->completions("Hello AI!");
License
This package is open-sourced software licensed under the MIT license.