PHP-AutoGpt is a simple class implementation designed to showcase capabilities of LLMs in tasks creation and automation. The class generates initial tasks based on the objective, executes those tasks, generates new tasks based on the results, and reprioritizes tasks based on the most recent task completed.
First, you will need an API key. You can obtain one from your OpenAI. Once you have your key, include it when constructing the class.
$autogpt = new Pport\AutoGpt();
$agent->setApiKey('OPENAI_KEY');
$agent->setObjective("Create A Blog Post bout Artificial Intelligence");
$agent->setInitialTask("Research the best ideas");
$agent->run();
The run() method will loop through each task until the objective is reached. It will automatically generate new tasks based on the results of the previous task and prioritize the tasks accordingly.
Constructs the AutoGpt class with the given $objective and $apiKey.
Generates first task if none exists and then recursively executes the list of tasks until the objective is reached.
Generates the initial list of tasks based on the given objective.
Executes the given task.
Generates new tasks based on the result of the previous task.
Prioritizes the list of tasks based on the given current task.
Sends a request to the GPT-3 API with the given prompt.|