ReAct: Synergizing Reasoning and Acting in Language Models
react-lm.github.io
react-lm.github.io
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.
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.
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.
https://langchain.readthedocs.io/en/latest/modules/agents/im...
https://langchain.readthedocs.io/en/latest/modules/agents/ex...
Clicked a lot faster reading his code than digging through langchain (though I'd still use langchain now that I understand how this works).
The LangChainHub repo seems dead (last commit 2 months ago).
Do you know of any alternative repos/marketplaces of chains/tools/prompts for LangChain?
Also, man, what an annoying context to see “As a language model I cannot…”.
Anyone who figures out a way to "establish truthfulness of arbitrary statements" in large language models will be making a HUGE breakthrough.
And you can test this quite easily with a prompt like this. gpt-4 answers this correctly without any tuning:
you have 2 boxes, box a and box b. Box a has 3 index cards, each with a giant letter printed in the middle
with a small caption below the letter. Based on the contents of Box A and Box B, infer what the blank
index card in Box B should most likely say
The contents of box a:
letter P, caption P:O
letter T, caption T:S
letter J, caption J:K
The contents of box b:
index card with O printed in the middle
index card with S printed in the middle
blank index card