Download the PHP package lanos/laravel-open-ai-conversations without Composer
On this page you can find all versions of the php package lanos/laravel-open-ai-conversations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lanos/laravel-open-ai-conversations
More information about lanos/laravel-open-ai-conversations
Files in lanos/laravel-open-ai-conversations
Package laravel-open-ai-conversations
Short Description Adds persistent conversation functionality to the existing Laravel OpenAI Package
License MIT
Informations about the package laravel-open-ai-conversations
Laravel GPT Conversations
Intro
This package is built on top of the openai-php/laravel package to allow you to build conversation sessions where context is preserved using a database.
This package is just an extra layer on top of the amazing package developed by:
- Nuno Maduro: github.com/sponsors/nunomaduro
- Sandro Gehri: github.com/sponsors/gehrisandro
The openai-php/laravel is required and should be installed as part of this install.
Setup
Requires PHP 8.1+
Really simple. Install our package (if you don't have the openai-php/laravel installed, composer should try to install it)
Then you need to just run the migrations
If you haven't set up the OpenAI-PHP Laravel package you can publish their config like so:
Then add the environment variables as needed.
You can also override some of the default config variables in the .env for my plugin, such as setting the default model for a conversation.
Examples
Once you have fully configured both plugins you simply create a conversation using the eloquent interface.
The defaults are filled in for you, but you can override upon creation.
Once you have created the conversation you can ask questions. The plugin will automatically append all previous responses so that the model has consciousness of previous messages in the conversation. It also automatically ensures no token limits are hit by "forgetting" older messages as needed.
Forgotten messages
Due to token limits, when necessary the plugin will soft delete older messages, similar to how chat GPT does it. The difference is with this, it will do it less often, as the token limits are higher on the API depending on what model you use. Be wary that requests can become expensive.
You can use the withTrashed function on eloquent to get all the forgotten messages.
License
Please refer to the license.md in this repository.
All versions of laravel-open-ai-conversations with dependencies
guzzlehttp/guzzle Version ^7.0.1
illuminate/console Version ^8.37|^9.0
illuminate/contracts Version ^8.37|^9.0
illuminate/database Version ^8.37|^9.0
laravel/framework Version ^8.37|^9.0
illuminate/http Version ^8.37|^9.0
illuminate/log Version ^8.37|^9.0
illuminate/notifications Version ^8.37|^9.0
illuminate/routing Version ^8.37|^9.0
illuminate/support Version ^8.37|^9.0
illuminate/view Version ^8.37|^9.0