File size: 918 Bytes
c19d193
9754eed
aa31d0d
f4c5821
aa31d0d
 
f4c5821
aa31d0d
 
92091da
5a27523
ae7a494
e121372
bf6d34c
 
aa31d0d
 
13d500a
8c01ffb
aa31d0d
 
8c01ffb
 
aa31d0d
861422e
aa31d0d
8c01ffb
8fe992b
aa31d0d
 
8c01ffb
 
 
 
 
 
aa31d0d
8fe992b
aa31d0d
 
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
import yaml
import os
from smolagents import GradioUI, CodeAgent, HfApiModel

# Get current directory path
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))

from tools.search_arxiv import SimpleTool as SearchArxiv
from tools.final_answer import FinalAnswerTool as FinalAnswer



model = HfApiModel(
max_tokens=2096,
temperature=0.5,
model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
provider=None,
)

search_arxiv = SearchArxiv()
final_answer = FinalAnswer()


with open(os.path.join(CURRENT_DIR, "prompts.yaml"), 'r') as stream:
    prompt_templates = yaml.safe_load(stream)

agent = CodeAgent(
    model=model,
    tools=[search_arxiv],
    managed_agents=[],
    max_steps=6,
    verbosity_level=1,
    grammar=None,
    planning_interval=None,
    name=None,
    description=None,
    prompt_templates=prompt_templates
)
if __name__ == "__main__":
    GradioUI(agent).launch()