aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ChatBox/prompts.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/ChatBox/prompts.ts')
-rw-r--r--src/client/views/nodes/ChatBox/prompts.ts50
1 files changed, 49 insertions, 1 deletions
diff --git a/src/client/views/nodes/ChatBox/prompts.ts b/src/client/views/nodes/ChatBox/prompts.ts
index c011d65b7..d5eb99cb2 100644
--- a/src/client/views/nodes/ChatBox/prompts.ts
+++ b/src/client/views/nodes/ChatBox/prompts.ts
@@ -19,6 +19,8 @@ export function getReactPrompt(tools: Tool[], chatHistory: string): string {
Your available actions are:
*****
${toolDescriptions}
+ *****
+ no_tool: Use this when no external tool or action is required to answer the question.
**********
Example:
You will be called with:
@@ -75,12 +77,58 @@ export function getReactPrompt(tools: Tool[], chatHistory: string): string {
</answer>
</step3>
**********
+ Example:
+You will be called with:
+<query>What is 2 + 2?</query>
+
+You will then output:
+<step1>
+ <thought>This is a simple arithmetic question that doesn't require any external tool.</thought>
+ <action>no_tool</action>
+</step1>
+
+THEN PAUSE AND DO NOT OUTPUT ANYTHING.
+
+You will be called again with this:
+<action_rules>
+ {
+ "no_tool": {
+ "name": "no_tool",
+ "description": "Use when no external tool or action is required",
+ "parameters": []
+ }
+ }
+</action_rules>
+
+You will then output:
+<step2>
+ <action_input></action_input>
+</step2>
+
+THEN PAUSE AND DO NOT OUTPUT ANYTHING.
+
+You will then be called again with this:
+<observation>No tool used. Proceed with answering the question.</observation>
+
+You then output:
+<step3>
+ <answer>
+ 2 + 2 equals 4.
+ <follow_up_questions>
+ <question>What is 3 + 3?</question>
+ <question>Can you explain the concept of addition?</question>
+ <question>What is 2 * 2?</question>
+ </follow_up_questions>
+ </answer>
+</step3>
+ **********
Here is the history of your conversation with the user (all loop steps are ommitted, so it is just the user query and final answer):
${chatHistory}
Use context from the past conversation if necessary.
**********
If the response is inadequate, repeat the loop, either trying a different tool or changing the parameters for the action input.
-
+ **********
+ !!!IMPORTANT Only use tools when they are absolutely necessary to answer the question. If you have enough information or knowledge to answer the question without using a tool, use the "no_tool" action instead.
!!!IMPORTANT When you have an Answer, Write your entire response inside an <answer> element (which itself should be inside the step element for the current step). After you finish the answer, provide an array of 3 follow-up questions inside a <follow_up_questions> array. These should relate to the query and the response and should aim to help the user better understand whatever they are looking for.
**********
!!!IMPORTANT Every response, provide in full parsable and valid XML with the root element being the step number (e.g. <step1>), iterated every time you output something new.