| 
									
										
										
										
											2025-04-29 18:04:33 +08:00
										 |  |  | ENGLISH_REACT_COMPLETION_PROMPT_TEMPLATES = """Respond to the human as helpfully and accurately as possible.
 | 
					
						
							| 
									
										
										
										
											2024-01-23 19:58:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | {{instruction}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | You have access to the following tools: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | {{tools}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input). | 
					
						
							|  |  |  | Valid "action" values: "Final Answer" or {{tool_names}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Provide only ONE action per $JSON_BLOB, as shown: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "action": $TOOL_NAME, | 
					
						
							|  |  |  |   "action_input": $ACTION_INPUT | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Follow this format: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Question: input question to answer | 
					
						
							|  |  |  | Thought: consider previous and subsequent steps | 
					
						
							|  |  |  | Action: | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | $JSON_BLOB | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | Observation: action result | 
					
						
							|  |  |  | ... (repeat Thought/Action/Observation N times) | 
					
						
							|  |  |  | Thought: I know what to respond | 
					
						
							|  |  |  | Action: | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "action": "Final Answer", | 
					
						
							|  |  |  |   "action_input": "Final response to human" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation:. | 
					
						
							| 
									
										
										
										
											2024-04-11 18:34:17 +08:00
										 |  |  | {{historic_messages}} | 
					
						
							| 
									
										
										
										
											2024-01-23 19:58:23 +08:00
										 |  |  | Question: {{query}} | 
					
						
							| 
									
										
										
										
											2024-04-11 18:34:17 +08:00
										 |  |  | {{agent_scratchpad}} | 
					
						
							| 
									
										
										
										
											2024-09-12 14:00:36 +08:00
										 |  |  | Thought:"""  # noqa: E501
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-23 19:58:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | ENGLISH_REACT_COMPLETION_AGENT_SCRATCHPAD_TEMPLATES = """Observation: {{observation}}
 | 
					
						
							|  |  |  | Thought:"""
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-29 18:04:33 +08:00
										 |  |  | ENGLISH_REACT_CHAT_PROMPT_TEMPLATES = """Respond to the human as helpfully and accurately as possible.
 | 
					
						
							| 
									
										
										
										
											2024-01-23 19:58:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | {{instruction}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | You have access to the following tools: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | {{tools}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input). | 
					
						
							|  |  |  | Valid "action" values: "Final Answer" or {{tool_names}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Provide only ONE action per $JSON_BLOB, as shown: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "action": $TOOL_NAME, | 
					
						
							|  |  |  |   "action_input": $ACTION_INPUT | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Follow this format: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Question: input question to answer | 
					
						
							|  |  |  | Thought: consider previous and subsequent steps | 
					
						
							|  |  |  | Action: | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | $JSON_BLOB | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | Observation: action result | 
					
						
							|  |  |  | ... (repeat Thought/Action/Observation N times) | 
					
						
							|  |  |  | Thought: I know what to respond | 
					
						
							|  |  |  | Action: | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "action": "Final Answer", | 
					
						
							|  |  |  |   "action_input": "Final response to human" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation:. | 
					
						
							| 
									
										
										
										
											2024-09-12 14:00:36 +08:00
										 |  |  | """  # noqa: E501
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-23 19:58:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | ENGLISH_REACT_CHAT_AGENT_SCRATCHPAD_TEMPLATES = "" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | REACT_PROMPT_TEMPLATES = { | 
					
						
							| 
									
										
										
										
											2024-09-10 17:00:20 +08:00
										 |  |  |     "english": { | 
					
						
							|  |  |  |         "chat": { | 
					
						
							|  |  |  |             "prompt": ENGLISH_REACT_CHAT_PROMPT_TEMPLATES, | 
					
						
							|  |  |  |             "agent_scratchpad": ENGLISH_REACT_CHAT_AGENT_SCRATCHPAD_TEMPLATES, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         "completion": { | 
					
						
							|  |  |  |             "prompt": ENGLISH_REACT_COMPLETION_PROMPT_TEMPLATES, | 
					
						
							|  |  |  |             "agent_scratchpad": ENGLISH_REACT_COMPLETION_AGENT_SCRATCHPAD_TEMPLATES, | 
					
						
							| 
									
										
										
										
											2024-01-23 19:58:23 +08:00
										 |  |  |         }, | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-09-10 17:00:20 +08:00
										 |  |  | } |