minhnguyent546 commited on
Commit
46afd09
·
verified ·
1 Parent(s): ae7a494
Files changed (3) hide show
  1. .python-version +1 -0
  2. app.py +21 -11
  3. requirements.txt +5 -5
.python-version ADDED
@@ -0,0 +1 @@
 
 
1
+ 3.12
app.py CHANGED
@@ -1,17 +1,26 @@
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
 
8
  from Gradio_UI import GradioUI
 
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
- def my_custom_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
14
- """A tool that does nothing yet
 
15
  Args:
16
  arg1: the first argument
17
  arg2: the second argument
@@ -21,6 +30,7 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
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
  """
@@ -40,10 +50,10 @@ final_answer = FinalAnswerTool()
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='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
46
- custom_role_conversions=None,
47
  )
48
 
49
 
@@ -55,7 +65,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
@@ -66,4 +76,4 @@ agent = CodeAgent(
66
  )
67
 
68
 
69
- GradioUI(agent).launch()
 
 
1
  import datetime
 
2
  import pytz
3
  import yaml
4
+
5
+ import requests
6
+ from smolagents import (
7
+ CodeAgent,
8
+ DuckDuckGoSearchTool,
9
+ HfApiModel,
10
+ load_tool,
11
+ tool,
12
+ )
13
 
14
  from Gradio_UI import GradioUI
15
+ from tools.final_answer import FinalAnswerTool
16
+
17
 
18
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
19
  @tool
20
+ def my_custom_tool(arg1: str, arg2: int)-> str: #it's import to specify the return type
21
  #Keep this format for the description / args / args description but feel free to modify the tool
22
+ """A tool that does nothing yet .
23
+
24
  Args:
25
  arg1: the first argument
26
  arg2: the second argument
 
30
  @tool
31
  def get_current_time_in_timezone(timezone: str) -> str:
32
  """A tool that fetches the current local time in a specified timezone.
33
+
34
  Args:
35
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
36
  """
 
50
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
51
 
52
  model = HfApiModel(
53
+ max_tokens=2096,
54
+ temperature=0.5,
55
+ model_id='Qwen/Qwen2.5-Coder-32B-Instruct', # it is possible that this model may be overloaded
56
+ custom_role_conversions=None,
57
  )
58
 
59
 
 
65
 
66
  agent = CodeAgent(
67
  model=model,
68
+ tools=[final_answer, get_current_time_in_timezone], # add your tools here (don't remove final answer)
69
  max_steps=6,
70
  verbosity_level=1,
71
  grammar=None,
 
76
  )
77
 
78
 
79
+ GradioUI(agent).launch()
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
- markdownify
2
- smolagents
3
- requests
4
- duckduckgo_search
5
- pandas
 
1
+ markdownify==1.0.0
2
+ smolagents==1.9.2
3
+ requests==2.32.3
4
+ duckduckgo_search==7.5.0
5
+ pandas==2.2.3