Download the PHP package sonichaos360/lugpt without Composer
On this page you can find all versions of the php package sonichaos360/lugpt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sonichaos360/lugpt
More information about sonichaos360/lugpt
Files in sonichaos360/lugpt
Package lugpt
Short Description A PHP library for interacting with OpenAI's Completions and ChatCompletions API.
License MIT
Informations about the package lugpt
LuGPT
A PHP library for interacting with OpenAI's Completions and ChatCompletions API.
Table of Contents
- Installation
- Usage
- Initialization
- Chat
- Completion
- Conversations
- Todo
- Issues
- Contributing
- License
Installation
Install the library using Composer:
Usage
Initialization
Initialize the LuGPT
class with your OpenAI API key:
In this example, we are using the gpt-3.5-turbo
model, which is optimized for chat. The chat-optimized models can be used with the chat()
method. If you want to use the completion()
method, you will need to use text-davinci-003
or another non-chat-optimized model. A list of all available OpenAI models can be found here.
Chat
Send a message using Chat Completions API:
Conversations
Create and manage conversations:
This example uses a conversationId
, which allows the API to remember the context of previous messages and responses. The conversations will be created as separate JSON files stored in the $conversationsPath
directory.
Completion
Send a prompt to the text-davinci-003
or other non chat completions optimized model:
TODO
Here are some upcoming features and improvements we have planned for the LuGPT library. We encourage contributors to take on these tasks or suggest new ones by creating issues on GitHub:
- Refactor the
saveTokens()
function, which was deactivated due to strange behavior with non-English language characters. - Improve error handling and provide more informative error messages.
- Implement unit tests for the library to ensure code quality and functionality.
Please consider contributing to the development of these features or suggesting new ones by creating an issue or submitting a pull request. Your input and collaboration are greatly appreciated.
Issues
If you encounter any problems or have suggestions for improvements, we welcome you to create an issue on GitHub. To do so, please follow these steps:
- Navigate to the Issues section of the LuGPT repository.
- Click on the "New issue" button.
- Provide a clear and descriptive title for the issue.
- In the description, include as much detail as possible, such as:
- A summary of the problem or suggestion.
- Steps to reproduce the issue, if applicable.
- The expected behavior and the actual behavior.
- Any error messages or logs, if available.
- The PHP version and operating system you are using.
- Attach any relevant screenshots or code snippets, if necessary.
When creating an issue, please keep the following recommendations in mind:
- Make sure to search the existing issues before submitting a new one, to avoid duplicates.
- Be respectful and courteous to other users and maintain a constructive discussion.
- Stay on topic and keep the conversation relevant to the issue at hand.
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your changes.
- Make your changes.
- Submit a pull request.
License
This library is released under the MIT License.