File size: 1,102 Bytes
09d74de
8ab5bd9
09d74de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8ab5bd9
 
 
09d74de
 
 
 
 
 
 
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
# app.py - Clean version
import gradio as gr
from smolagents import GradioUI, CodeAgent, InferenceClientModel

# Import our custom tools
from tools import DuckDuckGoSearchTool, WeatherInfoTool, HubStatsTool
from retriever import load_guest_dataset

# Initialize
model = InferenceClientModel()  # Updated
search_tool = DuckDuckGoSearchTool()
weather_info_tool = WeatherInfoTool()
hub_stats_tool = HubStatsTool()
guest_tool = load_guest_dataset()

# Enhance tool descriptions
guest_tool.description = "USE THIS FOR GALA GUESTS! Database with names, relations, descriptions, emails of attendees. Examples: 'Lady Ada Lovelace', 'guest list', 'who is coming'. NEVER use web search for guests."

# Create agent
alfred = CodeAgent(
    tools=[guest_tool, weather_info_tool, hub_stats_tool, search_tool], 
    model=model,
    add_base_tools=True,
    planning_interval=3
)

if __name__ == "__main__":
    # Quick test
    print("Testing...")
    response = alfred.run("Tell me about Lady Ada Lovelace at the gala")
    print(f"Response: {response[:300]}...")
    
    # Launch UI
    GradioUI(alfred).launch()