yetessam commited on
Commit
1d70844
·
verified ·
1 Parent(s): e8b3d80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -1,6 +1,6 @@
1
  from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
2
 
3
- # Google gemini
4
  # from litellm import LiteLLMModel, RateLimitError
5
 
6
  import datetime
@@ -31,9 +31,7 @@ def get_the_current_time_in_timezone(timezone: str) -> str:
31
  # Create timezone object
32
  tz = pytz.timezone(timezone)
33
  # Get current time in that timezone
34
- # Just get the time, not the entire date and time
35
  local_time = datetime.datetime.now(tz).strftime("%I:%M %p") # %I for 12-hour clock, %M for minutes, %p for AM/PM
36
- #local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
37
  return f"The current local time in {timezone} is: {local_time}"
38
  except Exception as e:
39
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
@@ -43,20 +41,21 @@ final_answer = FinalAnswerTool()
43
  polite_guard = PoliteGuardTool()
44
  web_search = DuckDuckGoSearchTool()
45
 
 
46
 
47
  model = HfApiModel(
48
  max_tokens=2096,
49
  temperature=0.5,
50
  model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
51
- # it is possible that this model may be overloaded
52
  custom_role_conversions=None,
53
  )
54
 
 
55
  #model = LiteLLMModel(
56
  # model_id="gemini/gemini-2.0-flash-exp",
57
  # max_tokens=2096,
58
- # temperature=0.6,
59
- # api_key=os.getenv("LITELLM_API_KEY")
60
  #)
61
 
62
 
@@ -73,7 +72,7 @@ with open("contentprompts.yml", 'r') as stream:
73
 
74
  combined_prompts = {**prompt_templates, **content_prompts}
75
 
76
- #
77
  # web_search, visit_webpage
78
 
79
  agent = CodeAgent(
 
1
  from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
2
 
3
+ # Google Gemini
4
  # from litellm import LiteLLMModel, RateLimitError
5
 
6
  import datetime
 
31
  # Create timezone object
32
  tz = pytz.timezone(timezone)
33
  # Get current time in that timezone
 
34
  local_time = datetime.datetime.now(tz).strftime("%I:%M %p") # %I for 12-hour clock, %M for minutes, %p for AM/PM
 
35
  return f"The current local time in {timezone} is: {local_time}"
36
  except Exception as e:
37
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
 
41
  polite_guard = PoliteGuardTool()
42
  web_search = DuckDuckGoSearchTool()
43
 
44
+ # Switch to Gemini if this model gets overloaded
45
 
46
  model = HfApiModel(
47
  max_tokens=2096,
48
  temperature=0.5,
49
  model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
 
50
  custom_role_conversions=None,
51
  )
52
 
53
+
54
  #model = LiteLLMModel(
55
  # model_id="gemini/gemini-2.0-flash-exp",
56
  # max_tokens=2096,
57
+ # temperature=0.6,
58
+ # api_key=os.getenv("LITELLM_API_KEY")
59
  #)
60
 
61
 
 
72
 
73
  combined_prompts = {**prompt_templates, **content_prompts}
74
 
75
+
76
  # web_search, visit_webpage
77
 
78
  agent = CodeAgent(