Download the PHP package ogrre/laravel-chatgpt without Composer
On this page you can find all versions of the php package ogrre/laravel-chatgpt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ogrre/laravel-chatgpt
More information about ogrre/laravel-chatgpt
Files in ogrre/laravel-chatgpt
Package laravel-chatgpt
Short Description Library to add chat management for openai client
License MIT
Homepage https://github.com/ogrre/laravel-chatgpt
Informations about the package laravel-chatgpt
🐈 Laravel Chat for ChatGPT
Documentation
This libray need openai php client, so don't forget to add in your .env this variables:
Installation:
To install the Laravel Chat for ChatGPT library, run the following command:
After the installation, publish the vendor files by executing the command:
By default, the service provider will be automatically registered in the app.php
file. However, if needed, you can manually add the service provider in the config/app.php
file:
Finally, run the migration command to create the necessary database tables:
Usage instructions
To associate a chat with a model, the model must use the hasChat
trait. For example, in the User model:
Once the model is set up with the hasChat
trait, you can create a new chat using the following command:
After creating a new chat or retrieving an existing one, you have two options to interact with it:
Using the chat object directly:
Using the model directly (in this example, the User model):
The Chat model is a standard Laravel Model, so you can use all the usual functions, including delete and others.
Additionally, the library provides a ChatResource for displaying chats in an API, allowing for easy integration with API endpoints.
Contributing
Contributions are welcome and will be fully credited. I accept contributions via Pull Requests on Github.
Support me
All versions of laravel-chatgpt with dependencies
illuminate/database Version ^7.0|^8.0|^9.0|^10.0
illuminate/support Version ^7.0|^8.0|^9.0|^10.0
openai-php/client Version ^0.6.2