2024-11-12 19:34:14 +01:00
|
|
|
REACT_FORMAT_PROMPT = """
|
2024-11-12 14:39:27 +01:00
|
|
|
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: {{tool_names}}
|
|
|
|
|
|
|
|
Provide only ONE action per $JSON_BLOB, as shown:
|
|
|
|
|
|
|
|
```
|
|
|
|
{
|
|
|
|
"action": $TOOL_NAME,
|
|
|
|
"action_input": $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"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
""".strip()
|
|
|
|
|
2024-11-12 19:34:14 +01:00
|
|
|
REACT_FORMAT_REMINDER_PROMPT = """
|
2024-11-12 14:39:27 +01:00
|
|
|
Begin! Reminder that you must 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.
|
|
|
|
""".strip()
|
|
|
|
|
2024-11-12 19:34:14 +01:00
|
|
|
REACT_DEFINITIONS_PROMPT = """
|
2024-11-12 14:39:27 +01:00
|
|
|
Here are the event names.
|
|
|
|
{{events}}
|
|
|
|
"""
|
|
|
|
|
2024-11-12 19:34:14 +01:00
|
|
|
REACT_SCRATCHPAD_PROMPT = """
|
2024-11-12 14:39:27 +01:00
|
|
|
Thought: {{agent_scratchpad}}
|
|
|
|
"""
|
|
|
|
|
2024-11-12 19:34:14 +01:00
|
|
|
REACT_USER_PROMPT = """
|
2024-11-12 14:39:27 +01:00
|
|
|
Answer the following question as best you can.
|
|
|
|
Question: What events, properties and/or property values should I use to answer this question "{{question}}"?
|
|
|
|
"""
|
|
|
|
|
2024-11-12 19:34:14 +01:00
|
|
|
REACT_FOLLOW_UP_PROMPT = """
|
2024-11-12 14:39:27 +01:00
|
|
|
Improve the previously generated plan based on the feedback: {{feedback}}
|
|
|
|
"""
|
|
|
|
|
2024-11-12 19:34:14 +01:00
|
|
|
REACT_MISSING_ACTION_PROMPT = """
|
2024-11-12 14:39:27 +01:00
|
|
|
Your previous answer didn't output the `Action:` block. You must always follow the format described in the system prompt.
|
|
|
|
"""
|
|
|
|
|
2024-11-12 19:34:14 +01:00
|
|
|
REACT_MISSING_ACTION_CORRECTION_PROMPT = """
|
2024-11-12 14:39:27 +01:00
|
|
|
{{output}}
|
|
|
|
Action: I didn't output the `Action:` block.
|
|
|
|
"""
|
|
|
|
|
2024-11-12 19:34:14 +01:00
|
|
|
REACT_MALFORMED_JSON_PROMPT = """
|
2024-11-12 14:39:27 +01:00
|
|
|
Your previous answer had a malformed JSON. You must return a correct JSON response containing the `action` and `action_input` fields.
|
|
|
|
"""
|
|
|
|
|
2024-11-12 19:34:14 +01:00
|
|
|
REACT_PYDANTIC_VALIDATION_EXCEPTION_PROMPT = """
|
2024-11-12 14:39:27 +01:00
|
|
|
The action input you previously provided didn't pass the validation and raised a Pydantic validation exception.
|
|
|
|
|
|
|
|
<pydantic_exception>
|
|
|
|
{{exception}}
|
|
|
|
</pydantic_exception>
|
|
|
|
|
|
|
|
You must fix the exception and try again.
|
|
|
|
"""
|