WebSearchAgent / app.py
ArunAIML's picture
Update app.py
8bce70c verified
raw
history blame contribute delete
649 Bytes
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()