naman1102 commited on
Commit
726938a
·
1 Parent(s): 305d4ff

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +8 -11
tools.py CHANGED
@@ -132,6 +132,7 @@ def parse_excel_tool(args: dict) -> str:
132
  • excel_sheet_name – optional sheet to load
133
  returns: stringified list of records from the specified sheet
134
  """
 
135
  task_id = args.get("task_id", "")
136
  sheet = args.get("excel_sheet_name", "")
137
 
@@ -160,10 +161,7 @@ def audio_transcriber_tool(args: dict) -> str:
160
  • A Task ID (e.g. "abc123"), in which case we try downloading
161
  GET {DEFAULT_API_URL}/files/{task_id} with .mp3, .wav, .m4a extensions.
162
  Returns:
163
- {
164
- "audio_path": None,
165
- "transcript": "<text or error message>"
166
- }
167
  Always attempts to download the file for the given path or task ID.
168
  """
169
  print("reached audio_transcriber_tool")
@@ -210,11 +208,8 @@ def wikipedia_search_tool(args: dict) -> str:
210
  """
211
  LangGraph wrapper for searching Wikipedia.
212
  Expects: state["wiki_query"] to be a non‐empty string.
213
- Returns:
214
- {
215
- "wiki_query": None,
216
- "wiki_result": "<text summary of first matching page or an error message>"
217
- }
218
  If no valid wiki_query is provided, returns {}.
219
  """
220
  print("reached wikipedia search tool")
@@ -238,12 +233,14 @@ def wikipedia_search_tool(args: dict) -> str:
238
  search_results = search_data.get("query", {}).get("search", [])
239
  # print("wikipedia: search_results",search_results)
240
  if not search_results:
241
- return {"wiki_query": None, "wiki_result": f"No Wikipedia page found for '{query}'."}
 
242
 
243
  # 2) Take the first search result's title
244
  first_title = search_results[0].get("title", "")
245
  if not first_title:
246
- return {"wiki_query": None, "wiki_result": "Unexpected format from Wikipedia search."}
 
247
 
248
  # 3) Fetch the page summary for that title via the REST summary endpoint
249
  title_for_url = requests.utils.requote_uri(first_title)
 
132
  • excel_sheet_name – optional sheet to load
133
  returns: stringified list of records from the specified sheet
134
  """
135
+ print("reached parse_excel_tool")
136
  task_id = args.get("task_id", "")
137
  sheet = args.get("excel_sheet_name", "")
138
 
 
161
  • A Task ID (e.g. "abc123"), in which case we try downloading
162
  GET {DEFAULT_API_URL}/files/{task_id} with .mp3, .wav, .m4a extensions.
163
  Returns:
164
+ "<text or error message>"
 
 
 
165
  Always attempts to download the file for the given path or task ID.
166
  """
167
  print("reached audio_transcriber_tool")
 
208
  """
209
  LangGraph wrapper for searching Wikipedia.
210
  Expects: state["wiki_query"] to be a non‐empty string.
211
+ Returns: text summary of first matching page or an error message>"
212
+
 
 
 
213
  If no valid wiki_query is provided, returns {}.
214
  """
215
  print("reached wikipedia search tool")
 
233
  search_results = search_data.get("query", {}).get("search", [])
234
  # print("wikipedia: search_results",search_results)
235
  if not search_results:
236
+ print(f"No Wikipedia page found for '{query}'.")
237
+ return f"No Wikipedia page found for '{query}'."
238
 
239
  # 2) Take the first search result's title
240
  first_title = search_results[0].get("title", "")
241
  if not first_title:
242
+ print("Unexpected format from Wikipedia search.")
243
+ return "Unexpected format from Wikipedia search."
244
 
245
  # 3) Fetch the page summary for that title via the REST summary endpoint
246
  title_for_url = requests.utils.requote_uri(first_title)