PS also thanks for this genuine LOL moment from the intro:
> A popular nightmare scenario for AI is giving it access to tools, so it can make API calls and execute its own code and generally break free of the constraints of its initial environment.
> Let's do that now!
Is that prompt in your TIL really all it takes to inform it of these 3 actions? That's pretty impressive. I wonder how many actions it can scale to? I kind of expected some kind of classifier layer to predict if an action was necessary!
The ReAct paper talks about fine-tuning to teach a model actions. I'd be interested to see an experiment that fine-tunes the LLaMA model to teach it actions - I have a hunch that might work really well, and save a bunch of token space in the actual execution phase.
I took your example and added a couple other "actions" like searching a searxng instance and returning the markdown version of a certain url. It's surprising how much more useful it can be when it has the ability to look stuff up on the internet.
The code seems fine, even if clearly not structured the way a “production” product would be. The prompt can definitely use tweaking to improve the ability of ChatGPT to make best use of the actions – particularly, I’ve found it needs a firmer reminder to use valid Python expressions or its tends to pass math-in-English – e.g., with thousands separators, for instance – or other syntactically invalid things to the ‘calculate’ action, but once you’ve got the code and the prompt you’ve done as a starting point, adding actions, tweaking the prompt, etc., is pretty straightforward.