This PowerShell script allows you to interact with OpenAI's GPT-4 model through the ChatGPT API as an agent that can execute a series of PowerShell commands based on the given instructions. The agent can also browse the internet by making HTTP requests.
You will need an OpenAI API key to use this script. PowerShell should be installed on your machine.
Clone this repository or copy the code above into a new PowerShell script file (e.g. GPT4Agent.ps1). Replace with your OpenAI API key. Open a PowerShell terminal and navigate to the directory containing the script. Execute the script using the following command: .\GPT4Agent.ps1 Call the beginProcess() function with your initial command as a parameter.
beginProcess "Create a node.js app that will return the reverse of a provided input in a GET request"
The agent will then provide a thought process, action description, and command to be executed. It will continue executing commands until it reaches a conclusion or until you stop the script.
Figure: Running a series of commands to create a node.js app
Figure: And...it works!