tianyang/spider2-aifunc huggingface dataset:
Database: BANK_SALES_TRADING
Task: For products with page_id NOT in (1, 2, 12, 13), provide a breakdown of shopping cart metrics: view count, cart additions, cart abandonments (items left in cart without purchase), and actual purchases. Only include products where the condition 'The product name "{product_name}" refers to a seafood or marine-based food item' evaluates to true. Classify each product into exactly one of ['Fish', 'Shellfish', 'Luxury'] based on product name, and order results first by this classification alphabetically, then by product_id. Return product_id, product_name, the AI-derived product_type classification, view_count, cart_additions, cart_abandonments, and actual_purchases.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: BANK_SALES_TRADING
Task: For each product category (Fish, Luxury, Shellfish), provide a breakdown of shopping engagement metrics for products not on pages 1, 2, 12, or 13. For each product, show the product name, product category, total views (event_type=1), total cart additions (event_type=2), cart abandonments (cart additions that were not followed by a purchase event_type=3 in the same visit), and actual purchases. Additionally, for each category, aggregate the product performance descriptions formatted as 'Product: {page_name} | Views: {views} | Adds: {adds} | Purchases: {purchases} | Abandonment Rate: {abandonment_rate}%' using the instruction: 'Identify the top performer (highest purchase count) and bottom performer (lowest purchase count) in this category, formatted as: Top: [product name]; Bottom: [product name]'. Order results by product_id.
Required AI functions: AI_AGG
Database: BANK_SALES_TRADING
Task: For each month from September 2018 to August 2019, calculate the average composition for each interest by dividing composition by index value. Identify the interest with the highest average composition each month. Classify each top interest into exactly one of ['Travel', 'Lifestyle', 'Technology', 'Shopping', 'Research', 'Other'] based on the interest name. Report the month (formatted as YYYY-MM-DD), interest name, interest category, max index composition (rounded to 4 decimal places), 3-month rolling average of max compositions (calculated over the current and two preceding months, rounded to 4 decimal places), and the names and max compositions (rounded to 4 decimal places) of the top interests from one month ago and two months ago. Order results chronologically by month, with secondary ordering by semantic similarity to 'consumer trends and market behavior' descending for any ties.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: BANK_SALES_TRADING
Task: Analyze interest data from September 2018 to August 2019. For each month, calculate the average composition (composition divided by index_value) for each interest and identify the interest with the highest average composition as that month's top interest. For each top interest, extract structured information from the interest_summary field using AI extraction with these fields and questions: 'primary_activity' using 'What is the main activity these consumers do? Answer in 2-3 words such as booking hotels, researching attractions, shopping products, or reading news', and 'focus_area' using 'What is the specific topic, product category, or geographic location these consumers focus on? Answer in 1-3 words'. Report the month date (formatted as YYYY-MM-DD), interest name, extracted primary activity, extracted focus area, max index composition rounded to 4 decimal places, three-month rolling average of max index compositions rounded to 4 decimal places (computed over the current month and up to 2 preceding months, showing partial averages when fewer than 3 months are available), and include historical context: the previous month's top interest name and its max index composition rounded to 4 decimal places, plus two months ago's top interest name and its max index composition rounded to 4 decimal places. Order results by month date ascending.
Required AI functions: AI_EXTRACT
Database: BANK_SALES_TRADING
Task: Among interest categories classified into ['Lifestyle & Travel', 'Shopping & Retail', 'Entertainment & Gaming', 'Sports & Fitness', 'Other'] based on interest name, identify the 10 interests most semantically similar to 'luxury consumer lifestyle and premium shopping' and the 10 least similar. If there are ties in similarity, break them alphabetically by interest name. For each interest, display the month (MM-YYYY) when it achieved its peak composition value (if an interest achieves the same peak composition in multiple months, use the most recent month), the interest name, the composition value, and its semantic category. Present the most similar interests first, followed by the least similar.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: NORTHWIND
Task: For customers who placed orders in 1998, calculate each customer's total spending by summing unit price multiplied by quantity (excluding discounts) and assign them to spending groups based on the customer group thresholds table. For each customer, aggregate their purchased product names into a comma-separated list (ordered alphabetically by product name) and classify their buyer profile into exactly one of ['Beverage Focused', 'Dairy & Cheese Focused', 'Meat & Seafood Focused', 'Confections & Desserts Focused', 'Diverse Buyer'] based on that product list. For each spending group, report: the number of customers, the percentage of total 1998 customers (rounded to 2 decimal places), the dominant buyer profile (the profile with the most customers in that group; if tied, select the profile that comes first alphabetically), and a summary of popular product categories using the aggregation instruction: 'Summarize the most popular product categories purchased by this group, formatted as: Category1; Category2; Category3'. Order results from Low to Very High spending groups.
Required AI functions: AI_AGG, AI_CLASSIFY
Database: NORTHWIND
Task: Among employees who have more than 50 total orders and whose biographical notes satisfy the condition 'This employee has completed additional professional training, courses, or certifications beyond their primary degree' (evaluated by concatenating this phrase with a colon and the notes text), which three have the highest percentage of late orders (where an order is late if its shipped date is on or after its required date)? For each employee, also classify their experience level into exactly one of ['Junior', 'Mid-level', 'Senior', 'Executive'] based on their biographical notes. In case of ties in late-order percentage, rank by experience level with Senior first, then Mid-level, then Junior, then Executive. Return each employee's ID, the number of late orders, the late-order percentage rounded to 2 decimal places, and their experience classification.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: NORTHWIND
Task: Among employees who have more than 50 total orders (considering only orders where both shipped date and required date are available), which three have the highest percentage of late orders, where an order is considered late if the shipped date is on or after its required date? For each employee, also aggregate their late order shipping details (formatted as 'Country: {shipcountry}, City: {shipcity}, Customer: {shipname}') using the aggregation instruction 'Identify the most common shipping destinations among these late orders. Format: Country1 (count); Country2 (count); Country3 (count)'. List each employee's ID, the number of late orders, the late-order percentage rounded to 2 decimal places, and the destination pattern summary.
Required AI functions: AI_AGG
Database: DB_IMDB
Task: Among movies with at least 50% female actors, filter to those whose titles suggest appeal to female audiences (using the condition 'This movie title could appeal to female audiences: ' concatenated with the title). Classify each filtered movie into exactly one of ['Drama', 'Action', 'Comedy', 'Romance', 'Thriller', 'Horror', 'Other'] based on its title. For each genre, show the total number of movies, the count of movies with exclusively female casts (where all actors are female with no male or unknown gender actors), and the average percentage of female actors rounded to 2 decimal places. Order results by average female ratio descending, then by genre alphabetically for ties. Extract years from the Movie.year field by taking the last 4 characters.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: DB_IMDB
Task: Which ten-year period starting from any movie release year had the largest number of action, adventure, or thriller themed films? Filter movies where the condition 'This movie title suggests an action, adventure, or thriller theme: ' concatenated with the movie title evaluates to true. Consider consecutive ten-year periods beginning at each unique year, and only output the start year and the total count for that specific period. If multiple periods are tied for the largest count, return only the one with the earliest start year.
Required AI functions: AI_FILTER
Database: EDUCATION_BUSINESS
Task: For each sales region, provide a performance report including the number of orders, total sales amount (rounded to 2 decimal places), and a summary of the top-performing sales representative(s). A top performer is any sales representative with the highest total sales in their region (include all in case of ties). For each top performer, format their information as '[name] ($[amount])' with the sales amount displayed with exactly 2 decimal places, then aggregate these using the instruction: 'List the top performer(s), formatted as: [name] ($[amount])'. Order results alphabetically by region name.
Required AI functions: AI_AGG
Database: SCHOOL_SCHEDULING
Task: For students who completed English courses (where ClassStatus = 2 and CategoryID = 'ENG'), classify each student's academic performance into exactly one of ['Top Performer', 'Strong Performer', 'Average Performer', 'Below Average', 'Struggling'] based on a description formatted as 'English course grade: {grade} out of 100'. Only include students where the condition 'This student has demonstrated basic academic competence by completing the course: English course grade: {grade} out of 100' evaluates to true. Return each student's last name and their performance classification. Order results first by performance tier (Top Performer first, then Strong Performer, Average Performer, Below Average, and Struggling last), then by grade descending within each tier, and finally by last name alphabetically if grades are equal.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: ENTERTAINMENTAGENCY
Task: Among musical styles with similarity greater than 0.3 to 'upbeat rhythmic music', what are the aggregated 1st, 2nd, and 3rd preference counts for each genre category, where styles are classified into exactly one of ['Era-Based', 'Classical/Traditional', 'Rock/Pop', 'Dance/Rhythm', 'Other'] based on the style name? Order results by total first preferences descending, then by genre category alphabetically for ties.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: ENTERTAINMENTAGENCY
Task: Find the top 10 most compatible entertainer-customer pairs where the pair satisfies the condition 'An entertainer specializing in {entertainer_styles} would be a good match for a customer who prefers {customer_preferences}' (where entertainer_styles and customer_preferences are each the top 2 styles concatenated as 'Style1, Style2' ordered by StyleStrength and PreferenceSeq respectively). Rank results by semantic similarity between the entertainer's style profile and customer's preference profile from highest to lowest, with similarity scores rounded to 2 decimal places for stable ordering; if there is a tie in rounded similarity, order by entertainer's stage name alphabetically, then by customer's last name alphabetically. Return only the entertainer's stage name and customer's last name.
Required AI functions: AI_FILTER, AI_SIMILARITY
Database: ENTERTAINMENTAGENCY
Task: Among entertainer-customer pairs where the customer's first and second musical style preferences match the entertainer's first and second style strengths (in either order), find those where the entertainer performs as a group rather than solo. For each entertainer's stage name, extract the performer type using the question 'What type of musical act is this based on the name? Answer with exactly one of: Solo Artist, Duo, Trio, Band/Group, Other'. Only include matches where the extracted performer type is 'Band/Group' or 'Trio'. Return the entertainer's stage name and customer's last name.
Required AI functions: AI_EXTRACT
Database: ENTERTAINMENTAGENCY
Task: Given a database of musical styles and user preferences, where Musical_Preferences contains user rankings of musical styles (PreferenceSeq=1 for first choice, PreferenceSeq=2 for second choice, PreferenceSeq=3 for third choice): First, classify each musical style into exactly one of ['Rock', 'Classical', 'Jazz/Blues', 'Pop/Contemporary', 'Traditional/Folk', 'Other'] based on the style name. Then, filter to only styles where the condition 'This musical style would be appropriate for formal events: ' concatenated with the style name evaluates to true. For the remaining styles, calculate a weighted score by assigning 3 points for each first choice ranking, 2 points for each second choice, and 1 point for each third choice. Compute the absolute difference between each style's total weighted score and the average total weighted score across all filtered styles. What is each formal-appropriate style's name, genre classification, and absolute difference from the average (rounded to 2 decimal places)? Order alphabetically by style name.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: ADVENTUREWORKS
Task: Among salespeople with annual quota records, identify those whose multi-year performance shows an improving trend, and report their annual sales-to-quota difference for each year, rounded to the nearest whole number. To identify improvement, evaluate each salesperson's history using the condition 'Does this performance history show an improving trend where later years are better than earlier years? ' applied to their yearly differences formatted as 'Year [year]: $[difference rounded to whole number]' entries separated by '; '. Include only salesperson-years where both sales and quota data exist for the same year. Order results by salesperson ID, then by year.
Required AI functions: AI_FILTER
Database: IMDB_MOVIES
Task: For the top 9 directors by movie count, provide their ID, name, number of movies, average inter-movie duration (rounded to the nearest integer), average rating (rounded to 2 decimals), total votes, minimum and maximum ratings, total movie duration, and a career classification.

First, filter to only include directors whose profile satisfies the condition 'This director has an established filmmaking career with multiple theatrical releases' when concatenated with a profile formatted as 'Movies: {movie_count}, Avg Rating: {avg_rating}, Total Votes: {total_votes}, Avg Days Between Releases: {avg_inter_movie_duration}'.

Then classify each director into exactly one of ['Prolific Creator', 'Quality Craftsman', 'Versatile Filmmaker', 'Rising Talent'] based on the same profile format.

Sort the output by movie count in descending order, then by total movie duration in descending order, then by career classification alphabetically, and finally by director ID alphabetically for any remaining ties.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: IMDB_MOVIES
Task: For the top 9 directors by movie count, provide their ID, name, number of movies, average inter-movie duration in days (rounded to the nearest integer), average rating (rounded to 2 decimals), total votes, minimum and maximum ratings (rounded to 4 decimals), total movie duration, a filmography style description, and a genre category. The filmography style should be generated by aggregating each director's movie titles using the instruction: 'Based on these movie titles, select the ONE phrase that best describes this director's filmography style. Choose EXACTLY ONE from this list and output it in brackets: [Horror Films], [Thriller Films], [Horror-Thriller Films], [Drama Films], [Romantic Drama Films], [Action Films], [Action-Thriller Films], [Animated Films], [Superhero Animation], [Art House Cinema], [International Cinema], [Regional Indian Cinema], [Japanese Cinema], [Turkish Cinema], [Comedy Films]. Output only the selected phrase in brackets, nothing else.' The genre category should classify the filmography style into exactly one of ['Horror/Thriller', 'Drama', 'Action/Adventure', 'Animation', 'International Art Cinema']. Sort by movie count descending, then by total movie duration descending, then by director ID ascending. Use director ID as a tiebreaker when determining the top 9.
Required AI functions: AI_AGG, AI_CLASSIFY
Database: CITY_LEGISLATION
Task: Among remote Data Analyst job postings with non-null annual average salary, what is the overall average salary when considering only jobs that require at least one of the top 3 skills most semantically similar to 'essential data analysis and reporting skills', where we first filter skills to only those classified as 'Data Visualization Tool' or 'Statistical Software' from the categories ['Programming Language', 'Data Visualization Tool', 'Database Technology', 'Statistical Software', 'Cloud Platform', 'Other'] based on skill name? The skills to consider are those that appear in at least one qualifying job posting. In case of tied similarity scores, break ties by skill_id in ascending order.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: CITY_LEGISLATION
Task: What is the annual retention rate of legislators who began their first term (term_number = 0) between January 1, 1917 and December 31, 1999, broken down by political alignment? First, filter to only legislators whose party name satisfies the condition 'This party has historically been a major political party in the United States Congress: ' concatenated with the party name. Then classify each remaining legislator's party into exactly one of ['Liberal', 'Conservative', 'Independent', 'Other'] based on the party name. For each political alignment, measure retention as the proportion of that alignment's cohort still in office on December 31st for each of the first 20 years following their initial term start, where Year N is calculated as December 31st of (first_term_start_year + N). Show all 20 periods for each alignment in sequence, including periods with zero retention. Return the political alignment, year number, cohort size, legislators retained, and retention rate as a percentage rounded to 2 decimal places. Order results by political alignment alphabetically, then by year number.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: CITY_LEGISLATION
Task: Identify state abbreviations where both male and female legislators maintain non-zero retention rates at each of the intervals 0, 2, 4, 6, 8, and 10 years after their first term start date. A legislator is considered retained if they are serving in that state on December 31 of the respective year (term_start <= Dec 31 AND (term_end >= Dec 31 OR term_end is null)). The state is determined by where the legislator is actually serving on the check date.

For each qualifying state (where both M and F genders have at least one retained legislator at all six time points), calculate the total retained legislator count across all timepoints for each gender. Create a retention summary formatted as 'State {state}: Male legislators retained across 6 checkpoints: {male_total}, Female legislators retained across 6 checkpoints: {female_total}'.

Return all qualifying states, ordered by semantic similarity to 'Outstanding bipartisan legislative retention with strong representation of both male and female legislators consistently maintained throughout their careers' in descending order (most similar first), with similarity scores rounded to 2 decimal places and ties broken alphabetically by state abbreviation in ascending order.
Required AI functions: AI_SIMILARITY
Database: CITY_LEGISLATION
Task: Among male legislators from Louisiana who served terms in that state, how many distinct legislators with 'Democratic' political alignment were actively serving on December 31 of each year, for years elapsed since their first term ranging from 31 to 49 (inclusive)? Classify each legislator's party into exactly one of ['Democratic', 'Republican'] based on their party name, and only include legislators whose party name satisfies the condition 'The following party name represents one of the two major American political parties (Democratic or Republican): ' concatenated with the party name. Include all years in the range even if no legislators are active for that year, showing the count as 0.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: SQLITE_SAKILA
Task: For our top five actors (defined as those appearing in the most films), analyze how widespread their appeal is. For each actor, classify their appeal type into exactly one of ['Action Specialist', 'Drama Performer', 'Comedy Actor', 'Versatile Star'] based on all film descriptions they appear in, concatenated with '; ' as delimiter and ordered by film_id. Report each actor's name, their appeal category, and the percentage of total customers who have rented at least one film featuring that actor, rounded to 2 decimal places. Order the results by how closely each actor's film portfolio matches 'popular mainstream entertainment with broad family appeal', with the closest match first, using actor name as a tie-breaker.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: SQLITE_SAKILA
Task: Analyze the widespread appeal of our top 5 actors, where "top" is defined as actors appearing in the most films (with ties broken by actor_id ascending). For films featuring these actors, determine the overall sentiment of each film's description using sentiment analysis. Then, for each sentiment category ('positive', 'negative', 'neutral', 'mixed', or 'unknown'), calculate what percentage of our total customers have rented films with that sentiment from these top actors, rounded to 2 decimal places. Order results by customer percentage descending, with ties broken by sentiment alphabetically ascending.
Required AI functions: AI_SENTIMENT
Database: SQLITE_SAKILA
Task: For each store, identify the year and month with the highest rental orders processed by the store's staff. Display the month as the full month name (e.g., "July"). For each store's peak period, classify the rental activity level into exactly one of ['Exceptional Activity', 'High Activity', 'Moderate Activity'] based on a description formatted as 'Store {store_id} processed {total_rentals} rental transactions in {month} {year}'. Only include stores whose peak period is classified as 'Exceptional Activity' or 'High Activity'. Additionally, filter to periods where the condition 'This period demonstrates strong rental business performance with significant transaction volume: ' concatenated with the period description evaluates to true. Return the store ID, year, month, total rentals, and activity classification, ordered by store ID.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: SQLITE_SAKILA
Task: For each store, identify the year and month (as a full name like 'January', 'February', etc.) with the highest rental orders created by the store's staff. For each store's peak month, also provide a summary of the films rented during that period by aggregating their descriptions using the instruction: 'Identify the top 3 most common film themes or genres from these descriptions, formatted as: Theme1; Theme2; Theme3'. List the store ID, year, month name, total rentals, and the film themes summary.
Required AI functions: AI_AGG