Luis commited on
Commit
9902f94
·
verified ·
1 Parent(s): a36e0b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -14
app.py CHANGED
@@ -1,5 +1,6 @@
 
 
1
  from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
2
- from smolagents.model import AnthropicModel
3
  import datetime
4
  import requests
5
  import pytz
@@ -8,6 +9,7 @@ from tools.final_answer import FinalAnswerTool
8
 
9
  from Gradio_UI import GradioUI
10
 
 
11
  @tool
12
  def my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
@@ -20,13 +22,9 @@ def my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
23
- """Get the current time in the specified timezone.
24
-
25
  Args:
26
- timezone: The timezone name as a string (e.g., 'UTC', 'America/New_York', 'Europe/London')
27
-
28
- Returns:
29
- str: The current time formatted as a string in the specified timezone
30
  """
31
  try:
32
  # Create timezone object
@@ -39,15 +37,14 @@ def get_current_time_in_timezone(timezone: str) -> str:
39
 
40
 
41
  final_answer = FinalAnswerTool()
42
- model = AnthropicModel(
43
- model="claude-3-sonnet-20240229", # or any other Claude model
44
- max_tokens=2096,
45
- temperature=0.5
 
46
  )
47
 
48
 
49
-
50
-
51
  # Import tool from Hub
52
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
53
 
@@ -56,7 +53,7 @@ with open("prompts.yaml", 'r') as stream:
56
 
57
  agent = CodeAgent(
58
  model=model,
59
- tools=[final_answer, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
60
  max_steps=6,
61
  verbosity_level=1,
62
  grammar=None,
 
1
+ #Just havinfg the original template here, in case we need to duplicate
2
+
3
  from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
 
4
  import datetime
5
  import requests
6
  import pytz
 
9
 
10
  from Gradio_UI import GradioUI
11
 
12
+ # Below is an example of a tool that does nothing. Amaze us with your creativity !
13
  @tool
14
  def my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
15
  #Keep this format for the description / args / args description but feel free to modify the tool
 
22
 
23
  @tool
24
  def get_current_time_in_timezone(timezone: str) -> str:
25
+ """A tool that fetches the current local time in a specified timezone.
 
26
  Args:
27
+ timezone: A string representing a valid timezone (e.g., 'America/New_York').
 
 
 
28
  """
29
  try:
30
  # Create timezone object
 
37
 
38
 
39
  final_answer = FinalAnswerTool()
40
+ model = HfApiModel(
41
+ max_tokens=2096,
42
+ temperature=0.5,
43
+ model_id='https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud',# it is possible that this model may be overloaded
44
+ custom_role_conversions=None,
45
  )
46
 
47
 
 
 
48
  # Import tool from Hub
49
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
50
 
 
53
 
54
  agent = CodeAgent(
55
  model=model,
56
+ tools=[final_answer], ## add your tools here (don't remove final answer)
57
  max_steps=6,
58
  verbosity_level=1,
59
  grammar=None,