|
| 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