naman1102 commited on
Commit
f1bb56b
·
1 Parent(s): ac343ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -72,6 +72,7 @@ def tool_selector(state: AgentState) -> AgentState:
72
  )
73
  )
74
  raw = LLM(state.messages + [prompt]).content.strip()
 
75
  state.add(AIMessage(content=raw))
76
  parsed = safe_json(raw)
77
  if not parsed or "action" not in parsed:
@@ -124,6 +125,8 @@ def excel_tool(state: AgentState) -> AgentState:
124
  def final_node(state: AgentState) -> AgentState:
125
  wrap = SystemMessage(
126
  content="Using everything so far, reply ONLY with {'final_answer':'…'}. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. 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. 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. 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."
 
 
127
  )
128
  raw = LLM(state.messages + [wrap]).content.strip()
129
  state.add(AIMessage(content=raw))
 
72
  )
73
  )
74
  raw = LLM(state.messages + [prompt]).content.strip()
75
+ print(f"Tool selector response: {raw}")
76
  state.add(AIMessage(content=raw))
77
  parsed = safe_json(raw)
78
  if not parsed or "action" not in parsed:
 
125
  def final_node(state: AgentState) -> AgentState:
126
  wrap = SystemMessage(
127
  content="Using everything so far, reply ONLY with {'final_answer':'…'}. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. 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. 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. 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."
128
+ "reply **only** with "
129
+ "{\"final_answer\":\"…\"} (no markdown, no commentary)."
130
  )
131
  raw = LLM(state.messages + [wrap]).content.strip()
132
  state.add(AIMessage(content=raw))