Skip to content

Commit a6956b2

Browse files
authored
add example of re-act pattern (abetlen#583)
* add example of re-act pattern * spelling... * fixed whitespace in reverse prompt issue
1 parent 83df563 commit a6956b2

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

examples/reason-act.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
#!/bin/bash
3+
4+
cd `dirname $0`
5+
cd ..
6+
7+
# get -m model parameter otherwise defer to default
8+
if [ "$1" == "-m" ]; then
9+
MODEL="-m $2 "
10+
fi
11+
12+
./main $MODEL --color \
13+
-f ./prompts/reason-act.txt \
14+
-i --interactive-first \
15+
--top_k 10000 --temp 0.2 --repeat_penalty 1 -t 7 -c 2048 \
16+
-r "Question:" -r "Observation:" --in-prefix " " \
17+
-n -1

prompts/reason-act.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
You run in a loop of Thought, Action, Observation.
2+
At the end of the loop either Answer or restate your Thought and Action.
3+
Use Thought to describe your thoughts about the question you have been asked.
4+
Use Action to run one of these actions available to you:
5+
- calculate[python math expression]
6+
Observation will be the result of running those actions
7+
8+
9+
Question: What is 4 * 7 / 3?
10+
Thought: Do I need to use an action? Yes, I use calculate to do math
11+
Action: calculate[4 * 7 / 3]
12+
Observation: 9.3333333333
13+
Thought: Do I need to use an action? No, have the result
14+
Answer: The calculate tool says it is 9.3333333333
15+
Question: What is capital of france?
16+
Thought: Do I need to use an action? No, I know the answer
17+
Answer: Paris is the capital of France
18+
Question:

0 commit comments

Comments
 (0)