/GPT-Agent

A GPT powered agent to achieve tasks

Primary LanguagePowerShell

GPT-Agent

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.

⚠️ Use this at your own risk - it is going to execute random PowerShell commands on your machine

Requirements

You will need an OpenAI API key to use this script. PowerShell should be installed on your machine.

How to Use

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.

Example:

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.

Screenshot 2023-04-05 142018

Figure: Running a series of commands to create a node.js app

Screenshot 2023-04-05 135216

Figure: And...it works!