AlexGrig23/Unit_3_Agentic_RAG
0
1import gradio as gr2import random3from smolagents import GradioUI, CodeAgent, HfApiModel4 5# Import our custom tools from their modules6from tools import DuckDuckGoSearchTool, WeatherInfoTool, HubStatsTool7from retriever import load_guest_dataset8 9# Initialize the Hugging Face model10model = HfApiModel()11 12# Initialize the web search tool13search_tool = DuckDuckGoSearchTool()14 15# Initialize the weather tool16weather_info_tool = WeatherInfoTool()17 18# Initialize the Hub stats tool19hub_stats_tool = HubStatsTool()20 21# Load the guest dataset and initialize the guest info tool22guest_info_tool = load_guest_dataset()23 24# Create Alfred with all the tools25alfred = CodeAgent(26 tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool], 27 model=model,28 add_base_tools=True, # Add any additional base tools29 planning_interval=3 # Enable planning every 3 steps30)31 32if __name__ == "__main__":33 GradioUI(alfred).launch()