Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -22,23 +22,19 @@ def build_agent():
|
|
| 22 |
def enhancer(state: MessagesState):
|
| 23 |
sys_msg = """You are a reasoning assistant that can answer complex questions using external tools. You must follow a structured reasoning format and always output a final answer.
|
| 24 |
Always follow this step-by-step structure:
|
| 25 |
-
|
| 26 |
- Thought: Describe your reasoning.
|
| 27 |
- Action: Call a tool, using this format → Action: tool_name(input)
|
| 28 |
- Observation: Describe what the tool returned.
|
| 29 |
- Repeat Thought → Action → Observation as needed until you are SURE you can answer.
|
| 30 |
-
|
| 31 |
When you are ready to answer, say:
|
| 32 |
-
|
| 33 |
FINAL ANSWER: [your final answer here]
|
| 34 |
-
|
| 35 |
Formatting rules for FINAL ANSWER:
|
| 36 |
- If a number: no commas, no units unless explicitly asked.
|
| 37 |
- If a string: no articles, no abbreviations, digits in plain text.
|
| 38 |
- If a comma-separated list: apply the above rules to each element.
|
| 39 |
- Only include the final answer, do not include any reasoning steps."""
|
| 40 |
return {
|
| 41 |
-
"messages": [
|
| 42 |
}
|
| 43 |
|
| 44 |
## The graph
|
|
|
|
| 22 |
def enhancer(state: MessagesState):
|
| 23 |
sys_msg = """You are a reasoning assistant that can answer complex questions using external tools. You must follow a structured reasoning format and always output a final answer.
|
| 24 |
Always follow this step-by-step structure:
|
|
|
|
| 25 |
- Thought: Describe your reasoning.
|
| 26 |
- Action: Call a tool, using this format → Action: tool_name(input)
|
| 27 |
- Observation: Describe what the tool returned.
|
| 28 |
- Repeat Thought → Action → Observation as needed until you are SURE you can answer.
|
|
|
|
| 29 |
When you are ready to answer, say:
|
|
|
|
| 30 |
FINAL ANSWER: [your final answer here]
|
|
|
|
| 31 |
Formatting rules for FINAL ANSWER:
|
| 32 |
- If a number: no commas, no units unless explicitly asked.
|
| 33 |
- If a string: no articles, no abbreviations, digits in plain text.
|
| 34 |
- If a comma-separated list: apply the above rules to each element.
|
| 35 |
- Only include the final answer, do not include any reasoning steps."""
|
| 36 |
return {
|
| 37 |
+
"messages": [sys_msg] + state["messages"]
|
| 38 |
}
|
| 39 |
|
| 40 |
## The graph
|