wt002 commited on
Commit
29304ec
·
verified ·
1 Parent(s): 67f0c93

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +16 -11
agent.py CHANGED
@@ -254,20 +254,25 @@ sys_msg = SystemMessage(content=system_prompt)
254
  # -----------------------------
255
  # Map tool names to functions
256
  # -----------------------------
257
- tool_map = {
258
- "math": calculator,
259
- "wiki_search": wiki_search,
260
- "web_search": web_search,
261
- "arvix_search": arvix_search,
262
- "get_youtube_transcript": get_youtube_transcript,
263
- "extract_video_id": extract_video_id,
264
- "analyze_attachment": analyze_attachment,
265
- "wikidata_query": wikidata_query
266
-
267
- }
268
 
269
  tools = [tool_map[name] for name in enabled_tool_names]
270
 
 
 
 
 
 
 
271
 
272
  # -------------------------------
273
  # Step 2: Load the JSON file or tasks (Replace this part if you're loading tasks dynamically)
 
254
  # -----------------------------
255
  # Map tool names to functions
256
  # -----------------------------
257
+ enabled_tool_names = [
258
+ "math",
259
+ "wiki_search",
260
+ "web_search",
261
+ "arvix_search",
262
+ "get_youtube_transcript",
263
+ "extract_video_id",
264
+ "analyze_attachment",
265
+ "wikidata_query"
266
+ ]
 
267
 
268
  tools = [tool_map[name] for name in enabled_tool_names]
269
 
270
+ tools = []
271
+ for name in enabled_tool_names:
272
+ if name in tool_map:
273
+ tools.append(tool_map[name])
274
+ else:
275
+ print(f"⚠️ Warning: Tool '{name}' not found in tool_map. Skipping.")
276
 
277
  # -------------------------------
278
  # Step 2: Load the JSON file or tasks (Replace this part if you're loading tasks dynamically)