You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contrib/prompt_library/ReAct.pdl
+25-123
Original file line number
Diff line number
Diff line change
@@ -32,132 +32,29 @@ defs:
32
32
then: "${ type }: ${ trajectory[type]|trim }"
33
33
- "\n"
34
34
35
-
react_code_block:
36
-
function:
37
-
trajectory: { list: obj }
38
-
return:
39
-
text:
40
-
- for:
41
-
trajectory: ${ trajectory }
42
-
repeat:
43
-
text:
44
-
- def: type
45
-
text: ${ trajectory.keys()|first }
46
-
contribute: []
47
-
- if: ${ type == 'task'}
48
-
then: |
49
-
Task:
50
-
${ trajectory[type]|trim }
51
-
- if: ${ type == 'thought'}
52
-
then:
53
-
text:
54
-
- "\n"
55
-
- |
56
-
Assistant:
57
-
<thought>${ trajectory[type]|trim }</thought>
58
-
- if: ${ type == 'action'}
59
-
then: |
60
-
<execute>
61
-
${ trajectory[type]|trim }
62
-
</execute>
63
-
- if: ${ type == 'observation'}
64
-
then:
65
-
text:
66
-
- "\n"
67
-
- |
68
-
Observation:
69
-
${ trajectory[type]|trim }
70
-
- if: ${ type == 'solution'}
71
-
then: |-
72
-
<solution>
73
-
${ trajectory[type]|trim }
74
-
</solution>
75
-
- if: ${ type not in ['question', 'task', 'thought', 'action', 'observation', 'solution'] }
76
-
then: "${ type }: ${ trajectory[type]|trim }"
77
-
- "\n"
78
-
79
-
finish_action:
80
-
data:
81
-
display_name: Finish
82
-
pdl_function:
83
-
description: Respond with the Answer
84
-
parameters:
85
-
- name: answer
86
-
type: string
87
-
description: The answer
88
-
examples: []
89
-
90
-
demonstrate_tools:
91
-
function:
92
-
tools: { list: obj }
93
-
return:
94
-
for:
95
-
tool: ${ tools }
96
-
repeat:
97
-
for:
98
-
example: ${ tool.examples }
99
-
repeat:
100
-
call: ${ react_block }
101
-
args:
102
-
trajectory: ${ example }
103
-
104
35
react:
105
36
function:
106
37
task: str
107
38
model: str
108
-
tools: { list: obj }
39
+
tool_schema: { list: obj }
40
+
tools: obj
109
41
trajectories: { list: list }
110
-
system_prompt: str
111
42
return:
112
43
lastOf:
113
-
- if: ${ system_prompt == "llama3"}
114
-
then:
115
-
text:
116
-
- role: system
117
-
contribute: [context]
118
-
text:
119
-
- "Cutting Knowledge Date: December 2023\nToday Date: "
120
-
- lang: python
121
-
code: |
122
-
from datetime import datetime
123
-
result = datetime.today().strftime('%d %B %Y\n\n')
124
-
- role: system
125
-
text: You are a helpful assistant with tool calling capabilities. When you receive a tool call response, use the output to format an answer to the orginal use question.
126
-
contribute: [context]
127
-
- role: user
128
-
text: |
129
-
Given the following functions, please respond with a JSON for a function call with its proper arguments that best answers the given prompt.
130
-
131
-
Respond in the format {"name": function name, "arguments": dictionary of argument name and its value}. Do not use variables.
132
-
133
-
${ tools }
134
-
contribute: [context]
135
-
- if: ${ system_prompt == "granite_llama" }
136
-
then:
137
-
text:
138
-
- role: system
139
-
text: |
140
-
You are a helpful assistant with access to the following function calls. Your task is to produce a sequence of function calls necessary to generate response to the user utterance. Use the following function calls as required.
44
+
- role: system
45
+
text:
46
+
- "Today's Date: "
47
+
- lang: python
48
+
code: |
49
+
from datetime import datetime
50
+
result = datetime.today().strftime('%B %d, %Y.\n')
51
+
- |
52
+
You are a helpful assistant with access to the following function calls. Your task is to produce a sequence of function calls necessary to generate response to the user utterance. Use the following function calls as required.
141
53
142
-
Respond in the format {"name": function name, "arguments": dictionary of argument name and its value}. Do not use variables.
54
+
Respond in the format {"name": function name, "arguments": dictionary of argument name and its value}. Do not use variables.
143
55
144
-
${ tools }
145
-
contribute: [context]
146
-
- if: ${ system_prompt == "granite_tools" }
147
-
then:
148
-
text:
149
-
- role: system
150
-
contribute: [context]
151
-
text:
152
-
- "Knowledge Cutoff Date: April 2024.\nToday's Date: "
153
-
- lang: python
154
-
code: |
155
-
from datetime import datetime
156
-
result = datetime.today().strftime('%B %d, %Y.\n')
157
-
- |
158
-
You are Granite, developed by IBM. You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with a JSON object of the tool to use. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.
0 commit comments