Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,11 +107,11 @@ def tool_selector(state: AgentState) -> AgentState:
|
|
| 107 |
parsed = safe_json(raw)
|
| 108 |
# parsed = json.loads(raw)
|
| 109 |
# print("parsed : ", parsed)
|
| 110 |
-
print(f"Parsed: {parsed}")
|
| 111 |
if not parsed or "action" not in parsed:
|
| 112 |
state.next_action = "final"
|
| 113 |
return state
|
| 114 |
-
|
| 115 |
state.next_action = parsed["action"]
|
| 116 |
state.query = parsed.get("query")
|
| 117 |
return state
|
|
@@ -156,6 +156,7 @@ def excel_tool(state: AgentState) -> AgentState:
|
|
| 156 |
# ------------- final answer -------------
|
| 157 |
|
| 158 |
def final_node(state: AgentState) -> AgentState:
|
|
|
|
| 159 |
wrap = SystemMessage(
|
| 160 |
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."
|
| 161 |
"reply **only** with "
|
|
|
|
| 107 |
parsed = safe_json(raw)
|
| 108 |
# parsed = json.loads(raw)
|
| 109 |
# print("parsed : ", parsed)
|
| 110 |
+
print(f"Parsed: {parsed}, type: {type(parsed)}")
|
| 111 |
if not parsed or "action" not in parsed:
|
| 112 |
state.next_action = "final"
|
| 113 |
return state
|
| 114 |
+
# print("reached here")
|
| 115 |
state.next_action = parsed["action"]
|
| 116 |
state.query = parsed.get("query")
|
| 117 |
return state
|
|
|
|
| 156 |
# ------------- final answer -------------
|
| 157 |
|
| 158 |
def final_node(state: AgentState) -> AgentState:
|
| 159 |
+
print("reached final node")
|
| 160 |
wrap = SystemMessage(
|
| 161 |
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."
|
| 162 |
"reply **only** with "
|