File size: 649 Bytes
8bce70c
290edeb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94a937b
290edeb
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
from smolagents import (
    CodeAgent,
    ToolCallingAgent,
    DuckDuckGoSearchTool,
    VisitWebpageTool,
    HfApiModel,
    GradioUI,
)
from huggingface_hub import InferenceClient

"""
For more information on `huggingface_hub` Inference API support, please check the docs:
https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
"""

model = HfApiModel(model_id="mistralai/Mistral-7B-Instruct-v0.3", token=os.environ.get("HF_TOKEN"))  # Pass the InferenceClient to HfApiModel
search_agent = ToolCallingAgent(
    tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
    model=model,
)

GradioUI(search_agent).launch()