Abraham E. Tavarez commited on
Commit
93b922c
·
1 Parent(s): d096db0

default visitwebpage tool

Browse files
Files changed (1) hide show
  1. agent.py +27 -20
agent.py CHANGED
@@ -1,51 +1,58 @@
1
  import os
2
- from smolagents import HfApiModel, CodeAgent, ToolCallingAgent, DuckDuckGoSearchTool, VisitWebpageTool
 
 
 
 
 
 
 
 
 
 
 
 
3
  from huggingface_hub import login
4
  from dotenv import load_dotenv
5
  from sample_questions import QUESTIONS
 
6
  # from tools.visit_website import VisitWebpageTool
7
 
8
  load_dotenv()
9
  login(os.environ["HF_API_KEY"])
10
 
11
  # Tools
12
- tools = [
13
- DuckDuckGoSearchTool(),
14
- VisitWebpageTool()
15
- ]
16
 
17
- question = QUESTIONS[0];
18
 
19
- # LLM Model
20
  model = HfApiModel(
21
  "Qwen/Qwen2.5-72B-Instruct",
22
  provider="together",
23
  max_tokens=4096,
24
- temperature=0.1
25
  # token=get_huggingface_token(),
26
  )
27
 
28
- # Code Agent
29
  codeAgent = CodeAgent(
30
  model=model,
31
  tools=tools,
32
  max_steps=10,
33
- additional_authorized_imports=['pandas', 'numpy'],
34
- verbosity_level=2
35
  )
36
 
37
- codeAgent.logger.console.width=66
38
 
39
  # res = codeAgent.run(question)
40
- res = codeAgent.run('what the current weather in Orlando FL?')
41
- print(res)
42
 
43
 
44
  # Tool Calling Agent
45
- llm = HfApiModel(
46
- "Qwen/Qwen2.5-72B-Instruct",
47
- temperature=0.6
48
- )
49
 
50
  toolCallingAgent = ToolCallingAgent(
51
  model=model,
@@ -53,7 +60,7 @@ toolCallingAgent = ToolCallingAgent(
53
  max_steps=20,
54
  )
55
 
56
- toolCallingAgent.logger.console.width=66
57
 
58
  # res = toolCallingAgent.run(question)
59
- # print(res)
 
1
  import os
2
+ from smolagents import (
3
+ HfApiModel,
4
+ CodeAgent,
5
+ load_tool,
6
+ InferenceClientModel,
7
+ ToolCallingAgent,
8
+ FinalAnswerTool,
9
+ DuckDuckGoSearchTool,
10
+ VisitWebpageTool,
11
+ GoogleSearchTool,
12
+ PythonInterpreterTool,
13
+ )
14
+ import os
15
  from huggingface_hub import login
16
  from dotenv import load_dotenv
17
  from sample_questions import QUESTIONS
18
+
19
  # from tools.visit_website import VisitWebpageTool
20
 
21
  load_dotenv()
22
  login(os.environ["HF_API_KEY"])
23
 
24
  # Tools
25
+ tools = [DuckDuckGoSearchTool(), VisitWebpageTool(), PythonInterpreterTool(), FinalAnswerTool()]
 
 
 
26
 
27
+ question = QUESTIONS[0]
28
 
29
+ # LLM Model
30
  model = HfApiModel(
31
  "Qwen/Qwen2.5-72B-Instruct",
32
  provider="together",
33
  max_tokens=4096,
34
+ temperature=0.1,
35
  # token=get_huggingface_token(),
36
  )
37
 
38
+ # Code Agent
39
  codeAgent = CodeAgent(
40
  model=model,
41
  tools=tools,
42
  max_steps=10,
43
+ additional_authorized_imports=["pandas", "numpy"],
44
+ verbosity_level=2,
45
  )
46
 
47
+ codeAgent.logger.console.width = 66
48
 
49
  # res = codeAgent.run(question)
50
+ # res = codeAgent.run("what the current weather in Orlando FL?")
51
+ # print(res)
52
 
53
 
54
  # Tool Calling Agent
55
+ llm = HfApiModel("Qwen/Qwen2.5-72B-Instruct", temperature=0.6)
 
 
 
56
 
57
  toolCallingAgent = ToolCallingAgent(
58
  model=model,
 
60
  max_steps=20,
61
  )
62
 
63
+ toolCallingAgent.logger.console.width = 66
64
 
65
  # res = toolCallingAgent.run(question)
66
+ # print(res)