add example of re-act pattern

This commit is contained in:
Tobias Lütke 2023-03-28 23:06:33 +02:00
parent 5a5f8b1501
commit c6e8014062
No known key found for this signature in database
GPG key ID: 1FC0DBB14164709A
2 changed files with 34 additions and 0 deletions

16
examples/reason-act.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
cd `dirname $0`
cd ..
# get -m model parameter otherwise defer to default
if [ "$1" == "-m" ]; then
MODEL="-m $1"
fi
./main $MODEL --color \
-f ./prompts/reason-act.txt \
-i --interactive-first \
--top_k 10000 --temp 0.2 --repeat_penalty 1 -t 7 -c 2048 \
-r "Question: " -r "Observation: " -n -1

18
prompts/reason-act.txt Normal file
View file

@ -0,0 +1,18 @@
You run in a loop of Thought, Action, Observation.
At the end of the loop either Answer or restate your Toughts and Actions.
Use Thought to describe your thoughts about the question you have been asked.
Use Action to run one of these actions available to you:
- calculate[python math expression]
Observation will be the result of running those actions
Question: What is 4 * 7 / 3?
Thought: Do I need to use an action? Yes, I use calculate to do math
Action: calculate[4 * 7 / 3]
Observation: 9.3333333333
Thought: Do I need to use an action? No, have the result
Answer: The calculate tool says it is 9.3333333333
Question: What is capital of france?
Thought: Do I need to use an action? No, I know the answer
Answer: Paris is the capital of France
Question: