Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,6 +24,22 @@ def fetch_marathon_plan(goal_time: str) -> str:
|
|
| 24 |
else:
|
| 25 |
return f"Could not find a specific plan for {goal_time}, but you can check Runner's World for more details."
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
final_answer = FinalAnswerTool()
|
| 28 |
|
| 29 |
model = HfApiModel(
|
|
@@ -38,7 +54,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 38 |
|
| 39 |
agent = CodeAgent(
|
| 40 |
model=model,
|
| 41 |
-
tools=[final_answer, fetch_marathon_plan],
|
| 42 |
max_steps=6,
|
| 43 |
verbosity_level=1,
|
| 44 |
grammar=None,
|
|
|
|
| 24 |
else:
|
| 25 |
return f"Could not find a specific plan for {goal_time}, but you can check Runner's World for more details."
|
| 26 |
|
| 27 |
+
@tool
|
| 28 |
+
def fetch_european_marathons_2025() -> str:
|
| 29 |
+
"""Fetches a list of marathons in Europe for 2025.
|
| 30 |
+
|
| 31 |
+
Returns:
|
| 32 |
+
A link to a webpage or a summary of key details.
|
| 33 |
+
"""
|
| 34 |
+
search_tool = DuckDuckGoSearchTool()
|
| 35 |
+
query = "marathons in Europe 2025 site:marathonrunnersdiary.com"
|
| 36 |
+
results = search_tool.search(query)
|
| 37 |
+
|
| 38 |
+
if results:
|
| 39 |
+
return f"Here is a list of marathons in Europe for 2025: {results[0]['url']}"
|
| 40 |
+
else:
|
| 41 |
+
return "Could not find any marathons for 2025 in Europe, but you can check Marathon Runner's Diary for more details."
|
| 42 |
+
|
| 43 |
final_answer = FinalAnswerTool()
|
| 44 |
|
| 45 |
model = HfApiModel(
|
|
|
|
| 54 |
|
| 55 |
agent = CodeAgent(
|
| 56 |
model=model,
|
| 57 |
+
tools=[final_answer, fetch_marathon_plan, fetch_european_marathons_2025],
|
| 58 |
max_steps=6,
|
| 59 |
verbosity_level=1,
|
| 60 |
grammar=None,
|