AI Functions
Learn how to create functions to extract AI functions from user input, parsing the desired actions for the AutoGPT agent.
As previously discussed, AI functions, implemented as procedural macros, convert function bodies into strings. We do this so that we can feed the function body to a LLM and ask it to predict the output. A LLM cannot exactly predict the output of a function without a compiler but what it can do is
We’ll create multiple AI functions for all of our agents in the project. Each AI function will serve its own purpose and function as an input to the LLM. They will contain precise instructions for the LLM to produce a certain output and will also contain measures to verify if the output is correct because an LLM is prone to making mistakes despite being told not to do things a certain way.
Extracting AI functions
Let’s begin by creating files for our agents within the ai_functions
folder. We’ll create three files, each for one agent. Shown below is what the ai_functions
folder will look like after the new files have been created.
Get hands-on with 1400+ tech skills courses.