A Node.js script implementation of the SmartGPT prompting system by AI Explained on youtube, see the video here
- Node.js (
node >= 18to support chatgpt lib) installed on your machine. You can download it from here. - An OpenAI API key. You can get one by signing up on the OpenAI platform.
-
Clone this repository or download the files.
-
In the directory containing the
smartgpt.jsfile, run the following command to install the required dependencies:npm install
-
Create a copy of the
.example.envfile in the same directory assmartgpt.jsand rename it to.env(literally nothing before the dot). -
Open the
.envfile and replaceyour_api_key_herewith your actual OpenAI API key.
To run the script, execute the following command:
node smartgpt.js "Your prompt goes here" [options]Outputs are logged to console and the entire conversations are saved in the output folder for later review.
-
--model: Specify the model name to use (default: "gpt-4"). Example:--model "gpt-3.5-turbo" -
--numAsks: Specify the number of response options to generate (default: 3). Example:--numAsks 4 -
--logging: Enable verbose logging (default: false). Example:--logging
node smartgpt.js "I left 5 clothes out to dry in the sun. It took them 5 hours to dry completely. How long would it take to dry 30 clothes?" --model "gpt-3.5-turbo" --numAsks 4 --loggingThis command will use the "gpt-3.5-turbo" model, generate 4 response options, and enable verbose logging.