File size: 1,465 Bytes
93b922c
 
 
 
9cb9227
93b922c
 
 
 
 
 
 
 
 
8d6bd5c
 
342da0c
93b922c
d096db0
8d6bd5c
 
 
 
 
9cb9227
 
 
233fe2e
 
 
 
 
9cb9227
233fe2e
8d6bd5c
93b922c
342da0c
93b922c
8d6bd5c
 
 
0c83fed
93b922c
8d6bd5c
 
 
93b922c
8d6bd5c
 
 
 
93b922c
 
8d6bd5c
 
93b922c
8d6bd5c
233fe2e
 
 
9cb9227
233fe2e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from smolagents import (
    HfApiModel,
    CodeAgent,
    load_tool,
    Tool,
    InferenceClientModel,
    ToolCallingAgent,
    FinalAnswerTool,
    DuckDuckGoSearchTool,
    VisitWebpageTool,
    GoogleSearchTool,
    PythonInterpreterTool,
)
import os
from huggingface_hub import login
from dotenv import load_dotenv
from sample_questions import QUESTIONS

# from tools.visit_website import VisitWebpageTool

load_dotenv()
login(os.environ["HF_API_KEY"])

# Tools

# wikipedia = Tool.from_langchain(load_tool("wikipedia", trust_remote_code=True))

tools = [
    DuckDuckGoSearchTool(),
    VisitWebpageTool(),
    PythonInterpreterTool(),
    FinalAnswerTool(),
    # wikipedia
]

question = QUESTIONS[0]

# LLM Model
model = HfApiModel(
    "Qwen/Qwen2.5-72B-Instruct",
    provider="together",
    # max_tokens=40096,
    temperature=0.1,
    # token=get_huggingface_token(),
)

# Code Agent
codeAgent = CodeAgent(
    model=model,
    tools=tools,
    max_steps=10,
    additional_authorized_imports=["pandas", "numpy"],
    verbosity_level=2,
)

codeAgent.logger.console.width = 66

# answer = codeAgent.run(
#     "Who are the pitchers with the number before and after Taishō Tamai's number as of July 2023? Give them to me in the form Pitcher Before, Pitcher After, use their last names only, in Roman characters."
# )
# answer = codeAgent.run("search wikipedia for: what the name of the main character of the fast and furious movie")
# print(answer)