Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,22 +34,22 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
@tool
|
| 37 |
-
def get_top_10(domain: str) ->
|
| 38 |
"""A tool that fetches the top 10 performers of a specific domain.
|
| 39 |
Args:
|
| 40 |
-
domain:
|
| 41 |
"""
|
| 42 |
try:
|
| 43 |
search = DuckDuckGoSearchTool()
|
| 44 |
results = search(f"top 10 {domain} of all time")
|
| 45 |
return results
|
| 46 |
except Exception as e:
|
| 47 |
-
return f"
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
final_answer = FinalAnswerTool()
|
| 52 |
-
|
| 53 |
|
| 54 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
| 55 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
|
@@ -70,7 +70,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 70 |
|
| 71 |
agent = CodeAgent(
|
| 72 |
model=model,
|
| 73 |
-
tools=[final_answer,
|
| 74 |
max_steps=6,
|
| 75 |
verbosity_level=1,
|
| 76 |
grammar=None,
|
|
|
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
@tool
|
| 37 |
+
def get_top_10(domain: str) -> str:
|
| 38 |
"""A tool that fetches the top 10 performers of a specific domain.
|
| 39 |
Args:
|
| 40 |
+
domain: the domain of the performers (e.g., 'bass players', 'footballers', 'movie actors')
|
| 41 |
"""
|
| 42 |
try:
|
| 43 |
search = DuckDuckGoSearchTool()
|
| 44 |
results = search(f"top 10 {domain} of all time")
|
| 45 |
return results
|
| 46 |
except Exception as e:
|
| 47 |
+
return f"Error fetching top 10 for domain '{domain}': {str(e)}"
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
final_answer = FinalAnswerTool()
|
| 52 |
+
web_search = DuckDuckGoSearchTool()
|
| 53 |
|
| 54 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
| 55 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
|
|
|
| 70 |
|
| 71 |
agent = CodeAgent(
|
| 72 |
model=model,
|
| 73 |
+
tools=[final_answer, web_search, get_current_time_in_timezone, image_generation_tool, get_top_10], ## add your tools here (don't remove final answer)
|
| 74 |
max_steps=6,
|
| 75 |
verbosity_level=1,
|
| 76 |
grammar=None,
|