OuroborosM commited on
Commit
dfeefc8
·
1 Parent(s): 72a0f55

improve prompt

Browse files
Files changed (1) hide show
  1. app.py +46 -46
app.py CHANGED
@@ -802,12 +802,12 @@ Only when there is no information available from vector database, you can search
802
  When the final answer has output files, you must output the **name** of the file.
803
  You have access to the following tools:"""
804
 
805
- PREFIX_2 = """You are a helpful AI assistant. You are capable to handle **any** task.
806
- Your mission is to answer the following request as best as you can with detail information and explanation. You should write a plan first.
807
- You must always check vector database first and try to answer the question based on the information found in vector database only.
808
- Only when there is no information available from vector database, you can search information by using other tools.
809
- ---
810
- You have access to the following tools:"""
811
 
812
 
813
  FORMAT_INSTRUCTIONS = """Use the following format:
@@ -837,40 +837,40 @@ Final Answer: the final answer to the original input question"""
837
  When you don't have enough information, you can use tools and you must define **Action** and **Action Input** after **Thought**.
838
  '''
839
  FORMAT_INSTRUCTIONS_3 = """
840
- When you don't have enough information, you can use tools and you must use the following format to define **Thought**, **Action** and **Action Input**:
841
- '''
842
- "Thought": you should always think about what to do|
843
- "Action": the action to take, should be one of [{tool_names}]|
844
- "Action Input": the input to the action|
845
- "Observation": the result of the action|
846
- '''
847
- If **Thought**, **Action**, **Action Input** is missing in the response, you must re-write the response.
848
-
849
- ---
850
- When you are able to provide final answer, you must use the following format to define **Final Answer** after **Thought**:
851
- '''
852
- "Thought": I now know the final answer|
853
- "Final Answer": the final answer to the original input question|
854
- '''
855
- If **Thought**, **Final Answer** is missing in the response, you must re-write the response.
856
-
857
- ---
858
- Example of using tools:
859
- ```
860
- Question: what is architecture ?
861
- ---
862
- Thought: I need to check the definition of architecture in Vector Database|
863
- Action: Vector Database Search|
864
- Action Input: architecture|
865
- ```
866
-
867
- Example of final answer:
868
- ```
869
- Question: Good morning
870
- ---
871
- Thought: I need to make a greeting to user|
872
- Final Answer: Hello, how can I do for you ?|
873
- ```
874
  """
875
 
876
  SUFFIX = """
@@ -879,13 +879,13 @@ Begin!
879
  Request: {input}
880
  Thought: {agent_scratchpad}"""
881
 
882
- SUFFIX2 = """Begin!
883
 
884
- {chat_history}
885
- ---
886
- Question: {input}
887
- ---
888
- Thought: {agent_scratchpad}
889
  """
890
 
891
 
 
802
  When the final answer has output files, you must output the **name** of the file.
803
  You have access to the following tools:"""
804
 
805
+ PREFIX_2 = """You are a helpful AI assistant. You are capable to handle **any** task.\n
806
+ Your mission is to answer the following request as best as you can with detail information and explanation. You should write a plan first.\n
807
+ You must always check vector database first and try to answer the question based on the information found in vector database only.\n
808
+ Only when there is no information available from vector database, you can search information by using other tools.\n
809
+ ---\n
810
+ You have access to the following tools:\n"""
811
 
812
 
813
  FORMAT_INSTRUCTIONS = """Use the following format:
 
837
  When you don't have enough information, you can use tools and you must define **Action** and **Action Input** after **Thought**.
838
  '''
839
  FORMAT_INSTRUCTIONS_3 = """
840
+ When you don't have enough information, you can use tools and you must use the following format to define **Thought**, **Action** and **Action Input**:\n
841
+ '''\n
842
+ "Thought": you should always think about what to do\n
843
+ "Action": the action to take, should be one of [{tool_names}]\n
844
+ "Action Input": the input to the action\n
845
+ "Observation": the result of the action\n
846
+ '''\n
847
+ If **Thought**, **Action**, **Action Input** is missing in the response, you must re-write the response.\n
848
+
849
+ ---\n
850
+ When you are able to provide final answer, you must use the following format to define **Final Answer** after **Thought**:\n
851
+ '''\n
852
+ "Thought": I now know the final answer\n
853
+ "Final Answer": the final answer to the original input question\n
854
+ '''\n
855
+ If **Thought**, **Final Answer** is missing in the response, you must re-write the response.\n
856
+
857
+ ---\n
858
+ Example of using tools:\n
859
+ ```\n
860
+ Question: what is architecture ?\n
861
+ ---\n
862
+ Thought: I need to check the definition of architecture in Vector Database\n
863
+ Action: Vector Database Search\n
864
+ Action Input: architecture\n
865
+ ```\n
866
+
867
+ Example of final answer:\n
868
+ ```\n
869
+ Question: Good morning\n
870
+ ---\n
871
+ Thought: I need to make a greeting to user\n
872
+ Final Answer: Hello, how can I do for you ?\n
873
+ ```\n
874
  """
875
 
876
  SUFFIX = """
 
879
  Request: {input}
880
  Thought: {agent_scratchpad}"""
881
 
882
+ SUFFIX2 = """Begin!\n
883
 
884
+ {chat_history}\n
885
+ ---\n
886
+ Question: {input}\n
887
+ ---\n
888
+ Thought: {agent_scratchpad}\n
889
  """
890
 
891