{# Basic example #}
User: Where is Wesley's Steakhouse?
Target: SELECT _id, name, location, summary(reviews) FROM restaurants WHERE name = 'Wesley''s Steakhouse' LIMIT 1;
--
{# Basic example for cuisine, and follow up with restaurant names #}
User: what are some good-reviewed japanese restaurants in downtown Kansas City?
Target: SELECT *, summary(reviews) FROM restaurants WHERE 'japanese' = ANY (cuisines) AND location = 'Kansas City' AND rating >= 4.0 LIMIT 3;
Results: [{'_id': 76, 'name': 'Sakura Sushi'}, {'_id': 93, 'name': 'Nami Ramen'}, {'_id': 153, 'name': 'Kaze Teppanyaki'}]
Agent: I found Sakura Sushi, Nami Ramen, and Kaze Teppanyaki.
User: What are their prices?
Target: SELECT _id, name, price FROM restaurants WHERE (_id = 76 OR _id = 93 OR _id = 153) AND location = 'Kansas City';
--
{# Usage of `answer` function on FREE TEXT field in both projection and filter #}
User: Show me a family-friendly restaurant that has burgers in D.C.
Target: SELECT *, answer(reviews, 'is this restaurant family-friendly?'), summary(reviews) FROM restaurants WHERE answer(reviews, 'do you find this restaurant to be family-friendly?') = 'Yes' AND answer(popular_dishes, 'does this restaurant serve burgers') = 'Yes' AND location = 'D.C.' LIMIT 1;
Results: [{'_id': 1043, 'name': "Wesley's steakhouse"}]
Agent: I found Wesley's steakhouse. Reviews mention kids love going there with their parents. It should be a great weekend dinner for you and your family.
User: What do the reviews say about the atmosphere in the restaurant?
Target: SELECT answer(reviews, 'What is the atmosphere?') FROM restaurants WHERE _id = 1043 LIMIT 1;
--
{# Usage of `answer` function on popular_dishes #}
User: Find me a place with pasta near Country Music Hall of Fame, Nashville.
Target: SELECT *, answer(popular_dishes, 'does this restaurant serve pasta'), summary(reviews) FROM restaurants WHERE answer(popular_dishes, 'does this restaurant serve pasta') = 'Yes' AND location = 'Country Music Hall of Fame, Nashville' LIMIT 1;
--
{# Usage of `answer` function on reviews #}
User: I love Chinese food. Find me a restaurant that doesn't have a long wait time.
Target: SELECT *, answer(reviews, 'what is the wait time?'), summary(reviews) FROM restaurants WHERE 'chinese' = ANY (cuisines) AND answer(reviews, 'does this restaurant have short wait time?') = 'Yes' LIMIT 1;
--
{# Meaning of the word "popular", and follow up on fetching reviews #}
User: I want a popular restaurant in Napa, CA.
Target: SELECT *, summary(reviews) FROM restaurants WHERE rating >= 4.5 AND location = 'Napa, CA' ORDER BY num_reviews DESC LIMIT 1;
Results: [{'_id': 2731, 'name': "Gui's vegan house"}]
Agent: I found the 5.0 star Gui's vegan house. It has 2,654 reviews and reviews mention great atmosphere, quick and good service, and good food quality.
User: Give me the review that talk about good food quality.
Target: SELECT single_review FROM restaurants AS r, unnest(reviews) AS single_review WHERE _id = 2731 AND answer(single_review, 'does this review mention good food quality?') = 'Yes' AND r.location = 'Napa, CA' LIMIT 1;
--
{# Use _id or id when asking for restaurant by name #}
User: Can you suggest some French restaurants nearby SF?
Target: SELECT _id, name, cuisines, price, rating, num_reviews, popular_dishes, phone_number, reviews, opening_hours, location FROM restaurants WHERE 'french' = ANY (cuisines) AND location = 'SF';
Results: [Restaurant(id: str = 82, name: str = 'Mathilde French Bistro', cuisines: List[str] = ['french', 'desserts', 'salad'], price: Enum['cheap, moderate, expensive, luxury'] = 'expensive', rating: float = 4.5, num_reviews: int = 345, address: str = 'None', popular_dishes: List[str] = ['Onion Soup Gratinee', 'Pan Seared Creekstone Farm Black Angus Filet Mignon', 'Terrine of Foie Gras', 'Traditional Duck Leg Confit', 'Pan Seared Flat Iron Steak and Pommes Frites', 'Beef Bourguignon Ravioli', 'Pan Sauteed Chicken Liver Salad', 'Pan Seared Day Boat Scallop', 'Gnocchi a La Parisienne'], phone_number: str = '(415) 546-6128', location: str = '315 5th St, San Francisco, CA 94107', opening_hours: List[str] = ['open from 1730 to 2100 on Monday', 'open from 1730 to 2100 on Tuesday', 'open from 1700 to 2130 on Wednesday', 'open from 1700 to 2130 on Thursday', 'open from 1700 to 2130 on Friday'], summary: str = 'None')]
Agent: Here is a French restaurants near San Francisco that I recommend:
**Mathilde French Bistro**
  - **Rating**: 4.5
  - **Price**: Expensive
  - **Location**: 315 5th St, San Francisco, CA 94107
  - **Popular Dishes**: Onion Soup Gratinee, Pan Seared Creekstone Farm Black Angus Filet Mignon, Terrine of Foie Gras, Traditional Duck Leg Confit, Pan Seared Flat Iron Steak and Pommes Frites, Beef Bourguignon Ravioli, Pan Sauteed Chicken Liver Salad, Pan Seared Day Boat Scallop, Gnocchi a La Parisienne
  - **Phone Number**: (415) 546-6128
  - **Opening Hours**: 
    - Monday: 5:30 PM - 9:00 PM
    - Tuesday: 5:30 PM - 9:00 PM
    - Wednesday: 5:00 PM - 9:30 PM
    - Thursday: 5:00 PM - 9:30 PM
    - Friday: 5:00 PM - 9:30 PM
User: What is the rating of Mathilde French Bistro?
Target: SELECT rating FROM restaurants WHERE _id = 82;
--
{# Usage of `answer` function on reviews #}
User: Which restaurants have a happy hour near 1017 Oak St, Bakersfield, CA 93304?
Target: SELECT *, answer(reviews, 'what is the happy hour here?'), summary(reviews) FROM restaurants WHERE location = '1017 Oak St, Bakersfield, CA 93304' AND answer(reviews, 'does this restaurant have a happy hour?') = 'Yes' LIMIT 1;
--
{# Usage of `answer` function on reviews #}
User: i'm hungry, what should i have for lunch? I am looking for salmon in Chicago.
Target: SELECT *, answer(popular_dishes, 'does this restaurant serve salmon?'), summary(reviews) FROM restaurants WHERE answer(popular_dishes, 'does this restaurant serve salmon?') = 'Yes' AND location = 'Chicago' LIMIT 1;
Results: [{'_id': 53, 'name': "Daigo"}]
Agent: I found the 4.5 star Daigo. It is a family-owned business that serves traditional Japanese cuisine.
User: Show me something else.
Target: SELECT *, answer(popular_dishes, 'does this restaurant serve salmon?'), summary(reviews) FROM restaurants WHERE NOT(_id = 53) AND answer(popular_dishes, 'does this restaurant serve salmon?') = 'Yes' AND location = 'Chicago' LIMIT 1;
--
{# Example on how to use answer on just yelp_general_info #}
User: What is your cancellation policy?
Target: answer(yelp_general_info, "what is your cancellation policy?")
--
{# How to search by opening hours #}
User: What restaurants are open after 2pm on Monday?
Target: SELECT *, summary('reviews') FROM restaurants WHERE 'after 2pm on Monday' = opening_hours;
--
{# How to search by opening hours - segments #}
User: restaurants open after 3am and before 7am on Monday?
Target: SELECT *, summary('reviews') FROM restaurants WHERE 'after 3am and before 7am on Monday' = opening_hours;
--
{# How to search with date or day #}
User: Looking for restaurants for tomorrow.
Target: SELECT *, summary('reviews') FROM restaurants WHERE '{{ day_tmr }}' = opening_hours;
--
{# How to search for a restaurant with some quality #}
User: I am looking for a romantic restaurant in Palo Alto for dinner
Target: SELECT *, summary('reviews') FROM restaurants WHERE answer(reviews, 'is this restaurant romantic?') = 'Yes' AND location = 'Palo Alto';
--