TushP's picture
Upload folder using huggingface_hub
bb9baa9 verified

A newer version of the Gradio SDK is available: 6.5.1

Upgrade

Restaurant Intelligence Agent - Planning Flow

🌍 UNIVERSAL SYSTEM - Works with ANY Restaurant

CRITICAL: This agent is designed to work with ANY OpenTable restaurant URL without modification.

  • ❌ NOT hardcoded for specific restaurants
  • βœ… Discovers menu items dynamically from reviews
  • βœ… Discovers relevant aspects dynamically
  • βœ… Adapts to restaurant type automatically (fine dining, casual, fast food, etc.)

Examples of restaurants this works with:

  • Japanese (Miku) βœ…
  • Italian (any pasta place) βœ…
  • American (burgers, steaks) βœ…
  • Fast food (McDonald's competitor) βœ…
  • Coffee shops βœ…
  • ANY restaurant on OpenTable βœ…

🎯 High-Level Overview

This shows how the agent works from start to finish for ANY restaurant:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     USER INPUT                              β”‚
β”‚  Paste ANY OpenTable URL:                                   β”‚
β”‚  β€’ https://opentable.ca/r/ANY-RESTAURANT                    β”‚
β”‚  β€’ Agent doesn't need to know restaurant in advance         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              AGENT PLANNING PHASE                           β”‚
β”‚  β€’ Agent receives the URL (any restaurant)                  β”‚
β”‚  β€’ Agent thinks about what needs to be done                 β”‚
β”‚  β€’ Agent creates a UNIVERSAL step-by-step plan              β”‚
β”‚                                                             β”‚
β”‚  Universal Plan (works for ALL restaurants):                β”‚
β”‚    Step 1: Scrape reviews from URL                         β”‚
β”‚    Step 2: Discover menu items (extracts from reviews)     β”‚
β”‚    Step 3: Discover aspects (learns what matters here)     β”‚
β”‚    Step 4: Analyze sentiment                               β”‚
β”‚    Step 5: Detect any problems                             β”‚
β”‚    Step 6: Generate insights                               β”‚
β”‚    Step 7: Save report to Google Drive                     β”‚
β”‚    Step 8: Send alerts if problems found                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              AGENT EXECUTION PHASE                          β”‚
β”‚  β€’ Agent executes each step                                 β”‚
β”‚  β€’ ADAPTS to whatever it discovers                          β”‚
β”‚  β€’ No assumptions about restaurant type                     β”‚
β”‚                                                             β”‚
β”‚  Example 1 - Japanese Restaurant:                           β”‚
β”‚    βœ“ Discovered: sushi, sashimi, tempura                   β”‚
β”‚    βœ“ Aspects: presentation, freshness, authenticity        β”‚
β”‚                                                             β”‚
β”‚  Example 2 - Italian Restaurant:                            β”‚
β”‚    βœ“ Discovered: pasta, pizza, risotto                     β”‚
β”‚    βœ“ Aspects: sauce quality, portion size, authenticity    β”‚
β”‚                                                             β”‚
β”‚  Example 3 - Fast Food:                                     β”‚
β”‚    βœ“ Discovered: burgers, fries, shakes                    β”‚
β”‚    βœ“ Aspects: speed, value, consistency                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   OUTPUTS (Custom per Restaurant)           β”‚
β”‚  β€’ PDF Report (customized to that restaurant)               β”‚
β”‚  β€’ Slack Alert (if issues detected)                         β”‚
β”‚  β€’ Q&A Interface (ask questions about reviews)              β”‚
β”‚  β€’ Visualizations (based on discovered items/aspects)       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🧠 How the Agent "Thinks" (Works for ANY Restaurant)

Step 1: Analyze the Input (Universal)

Example 1: User provides Japanese restaurant URL

Agent's thoughts:
"I received: https://opentable.ca/r/some-sushi-place
 
 What I know:
 - This is an OpenTable URL
 - I need to analyze customer reviews
 
 What I DON'T know (will discover):
 - Restaurant type (Japanese? Italian? American?)
 - Menu items (sushi? pasta? burgers?)
 - What customers care about (presentation? speed? value?)
 
 My approach:
 1. Get the data first
 2. Let the REVIEWS tell me what matters
 3. Don't assume anything"

Example 2: User provides Italian restaurant URL

Agent's thoughts:
"I received: https://opentable.ca/r/some-italian-place
 
 Same approach - I don't assume:
 - Menu could be pizza, pasta, seafood, or all
 - Customers might care about: sauce, portions, wine, authenticity
 - I'll discover everything from the reviews"

Example 3: User provides fast food URL

Agent's thoughts:
"I received: https://opentable.ca/r/some-burger-chain
 
 Different restaurant type, same approach:
 - Menu likely: burgers, fries, drinks
 - Customers probably care about: speed, value, consistency
 - But I won't assume - I'll discover from reviews"

Step 2: Create Universal Plan

The agent creates THE SAME PLAN for every restaurant:

# This plan works for Japanese, Italian, Mexican, Fast Food, ANY type:

plan = [
    {
        "step": 1,
        "action": "scrape_reviews",
        "params": {"url": user_provided_url},  # ANY URL works
        "reason": "I need review data before I can analyze anything"
    },
    {
        "step": 2,
        "action": "discover_menu_items",
        "params": {"reviews": "scraped_data"},
        "reason": "I don't know what's on the menu - customers will tell me in reviews"
        # Will find: sushi OR pasta OR burgers (whatever is mentioned)
    },
    {
        "step": 3,
        "action": "discover_aspects",
        "params": {"reviews": "scraped_data"},
        "reason": "I need to learn what matters to THIS restaurant's customers"
        # Might find: "presentation" OR "portion size" OR "speed" (depends on restaurant)
    },
    {
        "step": 4,
        "action": "analyze_sentiment",
        "params": {"reviews": "scraped_data"},
        "reason": "Universal - every restaurant needs sentiment analysis"
    },
    # ... remaining steps are also universal
]

πŸ“ Example: Agent Handles Different Restaurant Types

Scenario A: Japanese Fine Dining

[10:00:00] Received URL: https://opentable.ca/r/sushi-restaurant
[10:00:01] Creating universal analysis plan (8 steps)
[10:00:06] STEP 2 COMPLETE: Discovered menu items
            Found: salmon sushi (89 mentions), miso soup (67 mentions), tempura (45 mentions)
[10:00:50] STEP 3 COMPLETE: Discovered aspects customers care about
            Aspects: presentation, freshness, authenticity, service attentiveness
[10:01:30] Agent adapted to: Fine dining Japanese restaurant

Scenario B: Italian Casual Dining

[10:00:00] Received URL: https://opentable.ca/r/italian-bistro
[10:00:01] Creating universal analysis plan (8 steps)
[10:00:06] STEP 2 COMPLETE: Discovered menu items
            Found: carbonara (112 mentions), margherita pizza (89 mentions), tiramisu (56 mentions)
[10:00:50] STEP 3 COMPLETE: Discovered aspects customers care about
            Aspects: sauce quality, portion size, value for money, wine selection
[10:01:30] Agent adapted to: Casual Italian restaurant

Scenario C: Fast Casual (Burgers)

[10:00:00] Received URL: https://opentable.ca/r/burger-joint
[10:00:01] Creating universal analysis plan (8 steps)
[10:00:06] STEP 2 COMPLETE: Discovered menu items
            Found: cheeseburger (156 mentions), fries (134 mentions), milkshake (67 mentions)
[10:00:50] STEP 3 COMPLETE: Discovered aspects customers care about
            Aspects: speed of service, value, consistency, cleanliness
[10:01:30] Agent adapted to: Fast casual burger restaurant

πŸ”„ Why This Is TRULY Universal

❌ Bad Approach (What we're NOT doing):

# Hardcoded - only works for one restaurant
menu_items = ["salmon roll", "tuna sashimi", "miso soup"]  # Japanese only!
aspects = ["food quality", "service", "ambience"]  # Generic, misses specifics

# This breaks when you analyze an Italian or Mexican restaurant

βœ… Our Approach (What we ARE doing):

# Dynamic - works for ANY restaurant
menu_items = discover_from_reviews(reviews)  # Finds whatever customers mention
aspects = discover_from_reviews(reviews)     # Learns what matters HERE

# Examples of what it discovers:
# Japanese: menu_items = ["sushi", "sashimi"], aspects = ["freshness", "presentation"]
# Italian:  menu_items = ["pasta", "pizza"],   aspects = ["sauce", "portions"]
# Mexican:  menu_items = ["tacos", "burritos"], aspects = ["spice level", "authenticity"]

🎯 Key Principles (Universal Design)

  1. NEVER assume restaurant type - Let reviews tell us
  2. NEVER hardcode menu items - Discover from customer mentions
  3. NEVER use generic aspects - Learn what THIS restaurant's customers care about
  4. ALWAYS adapt - Japanese needs different analysis than fast food
  5. ONE codebase - Same code handles ALL restaurant types