Download the PHP package sabir/chatgpt without Composer

On this page you can find all versions of the php package sabir/chatgpt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package chatgpt

To integrate the ChatGPT package with PHP and Laravel, please follow these steps:

Install the package: Install the package via Composer by running the following command in your project directory:

composer require sabir/chatgpt:dev-master Publish configuration file: Run the following command to publish the package's configuration file:

php artisan vendor:publish --tag=chatgpt-config --ansi --force This command will create a configuration file named chatgpt.php in your Laravel project's config directory.

Set API key and model: Open the .env file in your project's root folder and set the values for the following environment variables:

CHAT_API=YOUR_CHAT_API_KEY CHAT_MODEL=YOUR_CHAT_MODEL_ID Replace YOUR_CHAT_API_KEY with your OpenAI Chat API key and YOUR_CHAT_MODEL_ID with the model ID you want to use (e.g., "davinci", "curie", "babbage", or "ada").

Create an instance and call the chat method: In your Laravel code, you can now create an instance of the ChatGPT class and call the chat method to interact with the ChatGPT model. Here's an example:

use Sabir\ChatGPT\Facades\ChatGPT;

// ...

$s = new ChatGPT(); $response = $s->chat('hi, how are you?'); dd($response);

The chat method accepts three parameters:

message (required): The message or prompt to send to the ChatGPT model. type (optional): The API type to use for the chat. If left blank or set to "devinci", "curie", "babbage", or "ada", it will use the OpenAI models. You can extend this functionality to include other types if needed. options (optional): An array of additional options for the API request, such as temperature, max_tokens, top_p, etc. The chat method will return the response from the ChatGPT model.

Note: The provided code snippet is a simplified example. You may need to adjust it based on your project structure and requirements.

Ensure that you have properly configured the API key, model ID, and other settings according to your OpenAI account and desired behavior.


All versions of chatgpt with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
guzzlehttp/guzzle Version ^7.0.1
illuminate/support Version ^8.77|^9.27
symfony/console Version ^5.0|^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sabir/chatgpt contains the following files

Loading the files please wait ....