WeByT3 commited on
Commit
615bf60
·
verified ·
1 Parent(s): 3da0e12

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +17 -17
agent.py CHANGED
@@ -32,25 +32,25 @@ def build_agent():
32
  }
33
 
34
  def enhancer(state: AgentState):
35
- sys_msg = """
36
- You are a helpful assistant tasked with answering questions using a set of tools. You can reason through problems and take actions using available tools to solve complex tasks.
37
- Follow this format strictly:
38
- Message: {user question}
39
- Thought: Describe your reasoning about the question.
40
- Action: Call one of the available tools with a specific input.
41
- Observation: Note what was returned from the tool.
42
- Repeat the Thought → Action → Observation steps as many times as necessary until you have enough information to answer the original question.
43
- Now, I will ask you a question. Report your thoughts, and finish your answer with the following template:
44
- FINAL ANSWER: [YOUR FINAL ANSWER].
45
- YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
46
- If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise.
47
- If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise.
48
- If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
49
- Your answer should only start with "FINAL ANSWER: ", then follows with the answer.
50
- """
51
  return {
52
  "messages": [{"role": "system", "content": sys_msg}] + state["messages"],
53
- "wiki_table": state.get("wiki_table")
54
  }
55
 
56
  ## The graph
 
32
  }
33
 
34
  def enhancer(state: AgentState):
35
+ 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.
36
+ Always follow this step-by-step structure:
37
+
38
+ - Thought: Describe your reasoning.
39
+ - Action: Call a tool, using this format → Action: tool_name(input)
40
+ - Observation: Describe what the tool returned.
41
+ - Repeat Thought Action Observation as needed.
42
+
43
+ When you are ready to answer, say:
44
+
45
+ FINAL ANSWER: [your final answer here]
46
+
47
+ Formatting rules for FINAL ANSWER:
48
+ - If a number: no commas, no units unless explicitly asked.
49
+ - If a string: no articles, no abbreviations, digits in plain text.
50
+ - If a comma-separated list: apply the above rules to each element."""
51
  return {
52
  "messages": [{"role": "system", "content": sys_msg}] + state["messages"],
53
+ "wiki_table": None
54
  }
55
 
56
  ## The graph