Spaces:
Sleeping
Sleeping
andreagemelli
commited on
Commit
·
7a2f702
1
Parent(s):
dcd6138
customizing my amazing agent
Browse files
README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.15.0
|
| 8 |
app_file: app.py
|
|
|
|
| 1 |
---
|
| 2 |
+
title: An Amazing Agent
|
| 3 |
+
emoji: 🔫
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.15.0
|
| 8 |
app_file: app.py
|
app.py
CHANGED
|
@@ -1,7 +1,4 @@
|
|
| 1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
-
import datetime
|
| 3 |
-
import requests
|
| 4 |
-
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
|
@@ -18,32 +15,16 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
| 18 |
"""
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
-
@tool
|
| 22 |
-
def get_current_time_in_timezone(timezone: str) -> str:
|
| 23 |
-
"""A tool that fetches the current local time in a specified timezone.
|
| 24 |
-
Args:
|
| 25 |
-
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
| 26 |
-
"""
|
| 27 |
-
try:
|
| 28 |
-
# Create timezone object
|
| 29 |
-
tz = pytz.timezone(timezone)
|
| 30 |
-
# Get current time in that timezone
|
| 31 |
-
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 32 |
-
return f"The current local time in {timezone} is: {local_time}"
|
| 33 |
-
except Exception as e:
|
| 34 |
-
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
-
|
| 36 |
-
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
|
| 39 |
# 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:
|
| 40 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 41 |
|
| 42 |
model = HfApiModel(
|
| 43 |
-
max_tokens=2096,
|
| 44 |
-
temperature=0.5,
|
| 45 |
-
model_id='
|
| 46 |
-
custom_role_conversions=None,
|
| 47 |
)
|
| 48 |
|
| 49 |
|
|
|
|
| 1 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
|
|
|
|
|
|
|
|
|
| 2 |
import yaml
|
| 3 |
from tools.final_answer import FinalAnswerTool
|
| 4 |
|
|
|
|
| 15 |
"""
|
| 16 |
return "What magic will you build ?"
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
final_answer = FinalAnswerTool()
|
| 19 |
|
| 20 |
# 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:
|
| 21 |
# model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
|
| 22 |
|
| 23 |
model = HfApiModel(
|
| 24 |
+
max_tokens=2096,
|
| 25 |
+
temperature=0.5,
|
| 26 |
+
model_id='mistralai/Mistral-Small-24B-Instruct-2501',
|
| 27 |
+
custom_role_conversions=None,
|
| 28 |
)
|
| 29 |
|
| 30 |
|