Skip to content

Commit f29cc4a

Browse files
committed
Documentation and fixes
Signed-off-by: Claudio Spiess <[email protected]>
1 parent 23c25d4 commit f29cc4a

File tree

10 files changed

+274
-345
lines changed

10 files changed

+274
-345
lines changed

contrib/prompt_library/CoT.pdl

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ defs:
2727
- model: ${ model }
2828
parameters:
2929
# decoding_method: "greedy"
30+
max_tokens: 1024
3031
temperature: 0
3132
stop:
3233
- "The answer is"
@@ -67,9 +68,11 @@ defs:
6768
- "Answer: Let's think step by step. "
6869
- model: ${ model }
6970
parameters:
71+
max_tokens: 1024
7072
temperature: 0
7173
stop:
7274
- "<|endoftext|>"
75+
- "Question:"
7376
include_stop_sequence: false
7477

7578
claim_cot:

contrib/prompt_library/PoT.pdl

-227
This file was deleted.

contrib/prompt_library/RAG.pdl

-26
This file was deleted.

contrib/prompt_library/ReAct.pdl

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ defs:
107107
model: str
108108
tools: { list: obj }
109109
trajectories: { list: list }
110+
system_prompt: str
110111
return:
111112
lastOf:
112113
- if: ${ system_prompt == "llama3"}

contrib/prompt_library/examples/evalplus/general.pdl

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ text:
8989
Assistant:
9090
<thought>
9191
- defs:
92-
temperature: 0.0
92+
temperature: 0
9393
SOLUTION: ""
9494
iterations: 0
9595
max_iterations: 5

contrib/prompt_library/examples/fever/general.pdl

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ text:
6868
model: ${ model }
6969
tools: ${ search_tools }
7070
trajectories: ${ demonstrations }
71+
system_prompt: ${ system_prompt }
7172

7273
# ReWOO
7374
- if: ${ prompt_pattern == 'rewoo' }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
description: Demo of template
2+
defs:
3+
cot:
4+
import: ../../CoT
5+
react:
6+
import: ../../ReAct
7+
rewoo:
8+
import: ../../ReWoo
9+
tools:
10+
import: ../../tools
11+
model: watsonx_text/ibm/granite-3-8b-instruct
12+
prompt_pattern: cot
13+
system_prompt: granite_llama
14+
question: "Jake earns thrice what Jacob does. If Jacob earns $6 per hour, how much does Jake earn in 5 days working 8 hours a day?"
15+
demonstrations:
16+
data:
17+
- question: |-
18+
Noah charges $60 for a large painting and $30 for a small painting.
19+
Last month he sold eight large paintings and four small paintings.
20+
If he sold twice as much this month, how much is his sales for this month?
21+
reasoning: |-
22+
He sold 8 large paintings and 4 small paintings last month.
23+
He sold twice as many this month.
24+
8 large paintings x $60 = << 8*60= 480 >> 480
25+
4 small paintings x $30 = << 4*30= 120 >> 120
26+
So he sold << 480+120= 600 >> 600 paintings last month.
27+
Therefore he sold << 600*2= 1200 >> this month.
28+
answer: $1200
29+
- question: |-
30+
Noah charges $30 for a large vases and $10 for a small vases.
31+
Last month he sold five large vases and three small vases.
32+
If he sold three times as much this month, how much is his sales for this month?
33+
reasoning: |-
34+
He sold 5 large vases and 3 small vases last month.
35+
He sold three times as many this month.
36+
5 large vases x $30 = << 5*30= 150 >> 150
37+
3 small vases x $10 = << 3*10= 30 >> 30
38+
So he sold << 150+30= 180 >> 180 vases last month.
39+
Therefore he sold << 180*3= 540 >> this month.
40+
answer: $540
41+
text:
42+
# CoT
43+
- if: "${ prompt_pattern == 'cot' }"
44+
then:
45+
text:
46+
- "Answer the questions to the best of your abilities.\n\n"
47+
- call: ${ cot.chain_of_thought }
48+
args:
49+
examples: "${ demonstrations }"
50+
question: "${ question|trim }"
51+
model: "${ model }"
52+
53+
# ReAct
54+
- if: "${ prompt_pattern == 'react' }"
55+
then:
56+
text:
57+
- call: ${ react.react }
58+
def: ANSWER
59+
args:
60+
task: "Question: ${ question|trim }"
61+
model: "${ model }"
62+
tools: ${ tools.tools }
63+
trajectories: ${ demonstrations }
64+
system_prompt: ${ system_prompt }
65+
- "\nThe answer is ${ ANSWER.answer|trim }"
66+
67+
# ReWOO
68+
- if: "${ prompt_pattern == 'rewoo' }"
69+
then:
70+
text:
71+
- call: ${ rewoo.rewoo }
72+
def: ANSWER
73+
args:
74+
task: "Task: ${ question }"
75+
model: "${ model }"
76+
tools: ${ tools.tools }
77+
trajectories: ${ demonstrations }
78+
show_plans: false
79+
- "\nThe answer is ${ ANSWER.answer|trim }"

0 commit comments

Comments
 (0)