naman1102 commited on
Commit
958a56b
·
1 Parent(s): a59a680
Files changed (2) hide show
  1. app.py +3 -3
  2. tools.py +3 -2
app.py CHANGED
@@ -134,18 +134,18 @@ def finalize_node(state: AgentState) -> AgentState:
134
  )
135
 
136
  # Debug print
137
- print("\n>>> finalize_node JSON‐strict prompt:\n" + combined + "\n<<< end prompt >>>\n")
138
 
139
  llm_response = llm([SystemMessage(content=combined)])
140
  raw = llm_response.content.strip()
141
- print(">>> finalize_node got raw response:", raw)
142
 
143
  try:
144
  parsed = json.loads(raw)
145
  return {"final_answer": parsed["final_answer"]}
146
  except Exception as e:
147
  # If the LLM did not return valid JSON, store the error so you can see it
148
- print(">>> finalize_node JSON parse error:", e, "raw was:", raw)
149
  return {"final_answer": f"ERROR: invalid JSON from finalize_node: {raw}"}
150
 
151
  # ─── 4) Wrap tools in a ToolNode ───
 
134
  )
135
 
136
  # Debug print
137
+ # print("\n>>> finalize_node JSON‐strict prompt:\n" + combined + "\n<<< end prompt >>>\n")
138
 
139
  llm_response = llm([SystemMessage(content=combined)])
140
  raw = llm_response.content.strip()
141
+ # print(">>> finalize_node got raw response:", raw)
142
 
143
  try:
144
  parsed = json.loads(raw)
145
  return {"final_answer": parsed["final_answer"]}
146
  except Exception as e:
147
  # If the LLM did not return valid JSON, store the error so you can see it
148
+ # print(">>> finalize_node JSON parse error:", e, "raw was:", raw)
149
  return {"final_answer": f"ERROR: invalid JSON from finalize_node: {raw}"}
150
 
151
  # ─── 4) Wrap tools in a ToolNode ───
tools.py CHANGED
@@ -14,7 +14,7 @@ def web_search_tool(state: AgentState) -> AgentState:
14
  Returns: {"web_search_query": None, "web_search_result": <string>}
15
  We also clear web_search_query so we don’t loop forever.
16
  """
17
- print("reached web search tool")
18
  query = state.get("web_search_query", "")
19
  if not query:
20
  return {} # nothing to do
@@ -154,7 +154,7 @@ def audio_transcriber_tool(state: AgentState) -> AgentState:
154
  }
155
  If no valid audio_path is provided, returns {}.
156
  """
157
- print("reached audio transcriber tool")
158
  path = state.get("audio_path", "")
159
  if not path or not os.path.exists(path):
160
  return {}
@@ -214,6 +214,7 @@ def wikipedia_search_tool(state: AgentState) -> AgentState:
214
  search_data = search_resp.json()
215
 
216
  search_results = search_data.get("query", {}).get("search", [])
 
217
  if not search_results:
218
  return {"wiki_query": None, "wiki_result": f"No Wikipedia page found for '{query}'."}
219
 
 
14
  Returns: {"web_search_query": None, "web_search_result": <string>}
15
  We also clear web_search_query so we don’t loop forever.
16
  """
17
+ # print("reached web search tool")
18
  query = state.get("web_search_query", "")
19
  if not query:
20
  return {} # nothing to do
 
154
  }
155
  If no valid audio_path is provided, returns {}.
156
  """
157
+ # print("reached audio transcriber tool")
158
  path = state.get("audio_path", "")
159
  if not path or not os.path.exists(path):
160
  return {}
 
214
  search_data = search_resp.json()
215
 
216
  search_results = search_data.get("query", {}).get("search", [])
217
+ print("wikipedia: search_results",search_results)
218
  if not search_results:
219
  return {"wiki_query": None, "wiki_result": f"No Wikipedia page found for '{query}'."}
220