Spaces:
Runtime error
Runtime error
Update basic_agent.py
Browse files- basic_agent.py +13 -13
basic_agent.py
CHANGED
|
@@ -9,17 +9,17 @@ class BasicAgent:
|
|
| 9 |
except Exception as e:
|
| 10 |
return f"Error: {e}"
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
|
|
|
| 9 |
except Exception as e:
|
| 10 |
return f"Error: {e}"
|
| 11 |
|
| 12 |
+
def select_tool(self, question: str):
|
| 13 |
+
q = question.lower()
|
| 14 |
+
|
| 15 |
+
if "youtube.com" in q or "youtu.be" in q or "in the video" in q:
|
| 16 |
+
return analyze_youtube_video # direct reference, not index
|
| 17 |
+
|
| 18 |
+
elif "how many" in q or "number of" in q:
|
| 19 |
+
return extract_number_from_text
|
| 20 |
+
|
| 21 |
+
elif "wikipedia" in q or "encyclopedia" in q or "who is" in q:
|
| 22 |
+
return search_wikipedia
|
| 23 |
+
|
| 24 |
+
return extract_number_from_text # fallback tool
|
| 25 |
|