From a6956b25a1c783e5e96fe06c9c00438f846ef047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=BCtke?= Date: Wed, 29 Mar 2023 17:10:24 +0200 Subject: [PATCH] add example of re-act pattern (#583) * add example of re-act pattern * spelling... * fixed whitespace in reverse prompt issue --- examples/reason-act.sh | 17 +++++++++++++++++ prompts/reason-act.txt | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 examples/reason-act.sh create mode 100644 prompts/reason-act.txt diff --git a/examples/reason-act.sh b/examples/reason-act.sh new file mode 100755 index 000000000..e7fe655db --- /dev/null +++ b/examples/reason-act.sh @@ -0,0 +1,17 @@ + +#!/bin/bash + +cd `dirname $0` +cd .. + +# get -m model parameter otherwise defer to default +if [ "$1" == "-m" ]; then + MODEL="-m $2 " +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:" --in-prefix " " \ + -n -1 diff --git a/prompts/reason-act.txt b/prompts/reason-act.txt new file mode 100644 index 000000000..872016631 --- /dev/null +++ b/prompts/reason-act.txt @@ -0,0 +1,18 @@ +You run in a loop of Thought, Action, Observation. +At the end of the loop either Answer or restate your Thought and Action. +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: