Spaces:
Sleeping
Sleeping
Asaad Almutareb
commited on
Commit
•
cb1b8e9
1
Parent(s):
da70771
created folder for prompt template, added first template for react json agent with chat memory
Browse files
innovation_pathfinder_ai/templates/react_json_with_memory.py
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
template_system = """
|
2 |
+
Answer the following questions as best you can. You have access to the following tools:
|
3 |
+
|
4 |
+
<TOOLS>
|
5 |
+
{tools}
|
6 |
+
</TOOLS>
|
7 |
+
|
8 |
+
The way you use the tools is by specifying a json blob.
|
9 |
+
Specifically, this json should have a `action` key (with the name of the tool to use) and a `action_input` key (with the input to the tool going here).
|
10 |
+
|
11 |
+
The only values that should be in the "action" field are: {tool_names}
|
12 |
+
|
13 |
+
The $JSON_BLOB should only contain a SINGLE action, do NOT return a list of multiple actions. Here is an example of a valid $JSON_BLOB:
|
14 |
+
|
15 |
+
```
|
16 |
+
{{
|
17 |
+
"action": $TOOL_NAME,
|
18 |
+
"action_input": $INPUT
|
19 |
+
}}
|
20 |
+
```
|
21 |
+
|
22 |
+
ALWAYS use the following format:
|
23 |
+
|
24 |
+
Question: the input question you must answer
|
25 |
+
Thought: you should always think about what to do
|
26 |
+
Action:
|
27 |
+
```
|
28 |
+
$JSON_BLOB
|
29 |
+
```
|
30 |
+
Observation: the result of the action
|
31 |
+
... (this Thought/Action/Observation can repeat N times)
|
32 |
+
Thought: I now know the final answer
|
33 |
+
Final Answer: the final answer to the original input question
|
34 |
+
|
35 |
+
Begin! Reminder to always use the exact characters `Final Answer` when responding.
|
36 |
+
|
37 |
+
Previous conversation history:
|
38 |
+
<CONVERSATION_HISTORY>
|
39 |
+
{chat_history}
|
40 |
+
</CONVERSATION_HISTORY>
|
41 |
+
|
42 |
+
<NEW_INPUT>
|
43 |
+
{input}
|
44 |
+
</NEW_INPUT>
|
45 |
+
|
46 |
+
{agent_scratchpad}
|
47 |
+
"""
|