tianyang/spider2-aifunc huggingface dataset:
Database: CITY_LEGISLATION
Task: For alien data, classify each alien type (green, reptile, flatwoods, nordic, grey) into exactly one of ['Friendly', 'Neutral', 'Hostile'], where 'Friendly' means 'alien types traditionally associated with peaceful contact and benevolent intentions toward humans', 'Neutral' means 'alien types with unknown or ambiguous intentions', and 'Hostile' means 'alien types associated with abductions, aggression, or threatening behavior toward humans'. For each of the top 10 states by total alien population, also determine if the state's alien occupations are predominantly community-oriented by applying the condition 'The following list of occupations suggests a predominantly community-oriented and non-threatening workforce: ' concatenated with the alphabetically-ordered, comma-separated list of distinct occupations. How many of these top 10 states have more aliens classified as 'Friendly' than 'Hostile', an average alien age exceeding 200, and occupations that are predominantly community-oriented?
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: CITY_LEGISLATION
Task: For the top 10 states by alien population, identify those where the percentage of friendly aliens (aggressive=0) exceeds the percentage of hostile aliens (aggressive=1) and the average alien age is above 200. For each qualifying state, determine the top 3 most common occupations by SQL count (ties broken alphabetically), then use AI aggregation with input formatted as 'Rank {rank}: {occupation}' for each occupation and the instruction: 'Format these ranked occupations as a semicolon-separated list, preserving the given order: first; second; third' to present them.
Required AI functions: AI_AGG
Database: DELIVERY_CENTER
Task: Among hubs that saw more than a 20% increase in finished orders from February to March within the same year, which ones have technology-themed names? Classify each hub name into exactly one of ['Technology', 'Music', 'Nature', 'Descriptive', 'Other'] and return only those classified as 'Technology', ordered by how similar their hub name is to 'programming languages and software development tools' (most similar first), with ties broken alphabetically by hub name. Return the hub_id, hub_name, year, February order count, March order count, and the percent increase (rounded to 2 decimal places).
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: EU_SOCCER
Task: For each geographic region—classified from league names into exactly one of ['Western Europe', 'Southern Europe', 'Northern Europe', 'Central/Eastern Europe', 'British Isles']—which single team has the fewest total match wins across all seasons, considering only teams whose names suggest they are smaller or provincial clubs rather than major metropolitan teams (filtered using the condition 'This team name suggests a smaller city or provincial club rather than a major metropolitan team: ' concatenated with the team name)? A win is determined by comparing home and away goals. Include teams with zero wins. If multiple teams tie for the fewest wins within a region, select the team whose name comes first alphabetically. Return the region, team name, and total wins.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: EU_SOCCER
Task: In each league across all seasons, which team has the fewest total match wins? A win occurs when a team scores more goals than their opponent (comparing home_team_goal vs away_team_goal for both home and away matches). For tie-breaking when multiple teams have the same fewest wins, use the city name extracted from the team's full name (using the extraction question 'What is the home city or town of this football team? Return only the city name, nothing else.') in alphabetical order; if extraction returns 'None', null, empty, or 'nan', use the full team name instead for sorting. Return the league name, team name, extracted city (showing the team name if extraction failed), and total wins.
Required AI functions: AI_EXTRACT
Database: EU_SOCCER
Task: Among all players who participated in decisive matches (excluding draws and null player entries), identify the player with the highest number of winning matches and the player with the highest number of losing matches. For ties in match count, use semantic similarity of the career profile description (formatted as 'Career: {wins} wins, {losses} losses in {total} decisive matches') to 'dominant champion with exceptional victory count' as a tiebreaker for wins, and to 'struggling player with very high defeat count' as a tiebreaker for losses; if still tied, use lowest player_api_id. Also classify each top player's name origin into exactly one of ['Spanish', 'Portuguese', 'English', 'German', 'French', 'Italian', 'Dutch', 'Other'] based on the player name. Return the category (most_wins/most_losses), player name, match count, and classified name origin.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: EU_SOCCER
Task: What are the top 10 teams by total wins (combining home and away wins), and for each team, what city is mentioned in their name? Extract the city from each team's name using the extraction question 'What city or location name appears explicitly in this football team name? Only extract a city if it is directly stated in the name text. If no city name is present, return exactly Unknown.' If the extraction returns an invalid result (such as 'None', 'null', empty string, or the team name itself instead of a city), display 'Unknown' as the city value. If there are ties in total wins at the boundary, order alphabetically by team name.
Required AI functions: AI_EXTRACT
Database: IPL
Task: For each IPL season, identify the top three batsmen with the highest total runs scored and the top three bowlers with the most wickets taken, excluding 'run out', 'hit wicket', and 'retired hurt' dismissals. When there are ties in runs or wickets, break the tie using the smaller player ID. Pair these players by their rank position within each season (rank 1 batsman with rank 1 bowler, rank 2 with rank 2, rank 3 with rank 3).

From these pairs, filter to only those where the semantic condition 'This IPL season pair achieved notable performance: batsman scored {runs} runs and bowler took {wickets} wickets. Is this a standout IPL season performance?' evaluates to true.

Rank the filtered pairs by their semantic similarity to 'Dominant IPL season with exceptional batting over 600 runs and bowling over 20 wickets', where the input for comparison is formatted as 'Season {season_id}: Batsman {batsman_name} scored {runs} runs, Bowler {bowler_name} took {wickets} wickets'. Return the top 12 most similar pairs. Output the season ID, batsman name, total runs, bowler name, and total wickets, ordered by similarity descending, with ties broken by season ID ascending then original rank ascending.
Required AI functions: AI_FILTER, AI_SIMILARITY
Database: IMDB_MOVIES
Task: Determine the top three genres with the most movies rated above 8 (if there is a tie in movie count, sort alphabetically by genre name). Within those genres, identify directors whose names are classified as 'Western' (from the categories ['Western', 'Asian', 'Latin', 'Middle Eastern', 'African', 'Other'] based on the director's name) and where the condition 'This appears to be a real individual person name: ' concatenated with the director name evaluates to true. Among these Western directors, find the top four who have directed the most films rated above 8 in those genres. If there is a tie in movie count, sort alphabetically by director name. Return the director names and their respective movie counts.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: EDUCATION_BUSINESS
Task: From the salary dataset, for companies located in Mumbai, Pune, New Delhi, and Hyderabad, filter to only those companies where the condition 'Based on the company name, this appears to be a technology, software, IT services, or data analytics company: ' concatenated with the company name evaluates to true. For each of these four cities, identify the top 5 technology companies by average annual salary (converting monthly salaries marked with '/mo' to annual by multiplying by 12, treating salaries marked with '/yr' or without explicit time indicators as annual values, and excluding invalid or zero salary entries). When companies have the same average salary, break ties by ranking higher those companies whose names are more similar to 'leading innovative technology corporation'. Compare each company's average salary to the overall national average salary computed across all locations and all companies using the same salary conversion rules. Display four columns: Location, Company Name, Average Salary in State, and Average Salary in Country, with salary values rounded to 2 decimal places, ordered by location alphabetically then by salary rank within each location.
Required AI functions: AI_FILTER, AI_SIMILARITY
Database: IPL
Task: Among bowlers whose bowling style (from the bowling_skill field) is classified as 'Spin' from the categories ['Pace', 'Spin', 'Medium Pace'], and whose bowling_skill description satisfies the condition 'This bowling style indicates a specialist spin bowler with a dedicated spin technique: ' concatenated with the bowling_skill value, find bowlers with at least 20 total wickets. For each qualifying bowler, show their name, total wickets (excluding run-outs and dismissals not credited to the bowler - only counting 'caught', 'bowled', 'lbw', 'stumped', 'hit wicket', 'caught and bowled'), economy rate (runs scored off the bat divided by legal balls bowled times 6, rounded to 2 decimals, where legal balls exclude wides and no-balls), strike rate (legal balls divided by wickets, rounded to 2 decimals), and best bowling performance in a single match formatted as 'wickets-runs' where the best match is determined by most wickets then fewest runs then earliest match_id. Order by total wickets descending, then economy rate ascending, then player name ascending.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: IPL
Task: For each player, list their ID, name, their most frequent role across all matches (with alphabetical tie-breaking if multiple roles have the same count), batting hand, bowling skill, total runs scored, total matches played, total times they were dismissed (excluding only 'retired hurt' dismissals), batting average (total runs divided by total dismissals, NULL if zero dismissals, rounded to 2 decimal places), highest score in a single match, the number of matches in which they scored at least 30 runs, at least 50 runs, and at least 100 runs, total balls faced in their career, strike rate (total runs divided by total balls faced multiplied by 100, NULL if zero balls, rounded to 2 decimal places), total wickets taken (excluding 'run out' and 'retired hurt' from wicket credits), economy rate (runs conceded multiplied by 6 divided by balls bowled, NULL if zero balls bowled, rounded to 2 decimal places), and their best bowling performance in a single match formatted as "wickets-runs" (best = most wickets, then fewest runs conceded, then lowest match_id as tie-breaker).

For bowling statistics, "runs conceded" and "balls bowled" should be calculated from the batsman_scored table only (the runs scored by batsmen off each delivery), not including extras like wides or noballs from the extra_runs table.

Additionally, classify each player into exactly one of ['Franchise Icon', 'Match Winner', 'Reliable Performer', 'Role Player'] based on a profile description formatted as 'IPL Career: {total_runs} runs across {total_matches} matches with {matches_50_plus} half-centuries and {total_wickets} wickets' where 'Franchise Icon' means 'legendary IPL career with exceptional batting or bowling numbers that define franchise success', 'Match Winner' means 'impact player capable of turning games with significant career contributions', 'Reliable Performer' means 'consistent contributor who adds value in most matches', and 'Role Player' means 'specialist or limited-overs contributor with focused role'.

Filter to only include players where the condition 'This player has established themselves as a valuable IPL cricketer based on: {profile_description}' evaluates to true. Order results by player_id ascending.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: STACKING
Task: Among problems where the count of (step, version) combinations in steps 1, 2, and 3 where any non-'Stack' model's maximum test score is lower than the 'Stack' model's test score exceeds the problem's total occurrences in the solution table, which problems are classified as 'Physical Science', 'Chemistry', or 'Engineering' based on a description formatted as 'Problem name: {name}. Target variable: {target}', using categories ['Physical Science', 'Chemistry', 'Environmental', 'Engineering', 'Other']? Rank the results by semantic similarity to 'thermal energy and heat transfer prediction' using the format '{name}: {target}', with the most similar problems first. If similarity scores are tied, sort alphabetically by problem name.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: STACKING
Task: For each model (identified by name and version), determine its performance status by considering only models whose names semantically represent 'an ensemble, boosting, or stacking machine learning method' (evaluated by concatenating 'This model name represents an ensemble, boosting, or stacking machine learning method: ' with the model name). A model has 'strong' status if for any step the Stack model's test score exceeds the maximum test score of all qualifying non-Stack models, or 'soft' status if for any step the Stack model's test score equals that maximum (without any step being 'strong').

For each model (name, version), identify the most frequently occurring L1_model (with ties broken alphabetically by L1_model name).

Then, classify each distinct L1_model value into exactly one of ['Regression', 'Classification', 'Tree-based', 'Ensemble', 'Other'] based on the L1_model name text.

Count how many times each (classified_category, status) combination occurs across all models. For each status ('strong' or 'soft'), return the classified category with the highest occurrence count, along with that count. If there's a tie in occurrence count, break ties alphabetically by classified category name.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: STACKING
Task: Among all model entries in the MODEL table, classify each L1_model into exactly one of ['Traditional Model', 'Stack Model'] based on the model name, where 'Traditional Model' means 'standard single-algorithm approaches like regression, trees, or boosting' and 'Stack Model' means 'ensemble stacking methods that combine multiple base models'. For each unique combination of classification category and L1_model, count the total occurrences across all steps and versions. Return the L1_model with the highest count along with its classification category and the total count, ordered by count descending then by similarity to 'fundamental predictive modeling algorithm' descending.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: ORACLE_SQL
Task: What is the total quantity for the final packaging combination classified as 'Variety Mix' from the categories ['Variety Mix', 'Standard Size', 'Other'] based on the packaging name, where 'Variety Mix' means 'packaging name explicitly contains Mix indicating mixed product variety', 'Standard Size' means 'packaging name indicates a single size designation like L or M', and 'Other' means 'does not fit other categories', considering only leaf-level items after fully expanding nested packaging relationships, selecting only the top 1 package most similar to 'high volume mixed assortment for retail distribution'?
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: ORACLE_SQL
Task: For each bottle volume extracted from leaf-level packaging names using the extraction question 'What is the volume of this bottle? Respond with just the volume like 330cl or 500cl. If not a bottle, respond N/A', what is the total quantity across all final packaging combinations after fully expanding nested packaging relationships? Also, for each volume, aggregate the names of root-level packages that contain bottles of that volume using the instruction 'List the packaging names that contain this bottle type, formatted as: name1; name2; name3'. Only include results where the extracted volume is not 'N/A', ordered by total quantity descending, then by bottle volume ascending as a tie-breaker.
Required AI functions: AI_AGG, AI_EXTRACT
Database: ORACLE_SQL
Task: For top-level packaging containers (those not contained within any other packaging), find items where the total quantity accumulated by multiplying quantities at each nesting level in the hierarchy exceeds 500. Classify each item into exactly one of ['Bottle', 'Box', 'Pallet', 'Other'] based on the item name, where 'Bottle' means 'a beverage bottle container with volume in cl or ml', 'Box' means 'a cardboard box or carton', 'Pallet' means 'a shipping pallet for bulk transport', and 'Other' means 'any other packaging type'. Include only items classified as 'Bottle'. Rank the results by how similar the container name is to 'bulk shipping pallet for distribution' (descending), with ties broken by container name alphabetically, returning the top 10 results with container name, item name, and total quantity.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: ORACLE_SQL
Task: For order 423, what are the product IDs, product names, aisles, positions, quantities to pick, and handling categories? Classify each product into exactly one of ['Fragile', 'Heavy', 'Standard', 'Perishable'] based on product name, where 'Fragile' means 'delicate items requiring careful handling', 'Heavy' means 'items requiring physical effort to move', 'Standard' means 'normal handling requirements', and 'Perishable' means 'time-sensitive items that may spoil'. Order the results by similarity to 'high priority urgent pick requiring immediate careful handling' (most similar first), where similarity is calculated on a description formatted as 'Product: {product_name}, Category: {handling_category}, Quantity: {quantity_to_pick}'. If similarity scores are tied, order by product_id ascending, then by aisle ascending.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: ORACLE_SQL
Task: For order 421, what products were picked, what is the average number of units picked for each product (with full decimal precision), and what beer style category does each product name suggest? Extract the beer style from each product name into a field named 'beer_style' using the extraction question 'This is a creative beer product name. What beer style category does it most likely belong to based on any hints in the name? Look for keywords like: Hoppy/IPA, Helle/Lager, Stout/Porter, Wheat/Weizen, Pale/Ale. Respond with the likely style in 1-2 words, or "Craft Beer" if no clear style hint.' Order results by the inferred beer style alphabetically, then by product name alphabetically.
Required AI functions: AI_EXTRACT
Database: ORACLE_SQL
Task: For products 4160 and 7790, calculate the forecasted 2018 annual sales using monthly sales data from January 2016 through December 2018 (36 months, where January 2016 is time step 1 and December 2018 is time step 36). Apply a 12-month centered moving average for deseasonalization, compute seasonal indices from time steps 7 through 30 and normalize by dividing by their mean, and perform weighted least squares regression using the centered moving average as weights on time steps 7 through 30. The 2018 forecast is computed by applying the fitted trend model to time steps 25-36 (January-December 2018) and reseasonalizing with the seasonal indices. For each product, classify its forecast trend into exactly one of ['Growing', 'Stable', 'Declining'] based on a description formatted as 'Monthly 2018 forecasts: {comma-separated monthly values rounded to 2 decimal places}'. Then aggregate the trend classifications using input formatted as 'Product {product_id} forecast: {annual_sum rounded to 2 decimal places}, trend: {trend_category}' for each product, with the aggregation instruction: 'Summarize the overall 2018 sales outlook in one phrase, formatted as: Outlook: [summary]'. Report the average forecasted annual sales across both products rounded to 4 decimal places and the aggregated outlook summary.
Required AI functions: AI_AGG, AI_CLASSIFY
Database: ORACLE_SQL
Task: Using a recursive monthly inventory adjustment model starting from December 2018 inventory levels, where we restock a product if its ending inventory drops below the minimum required level, determine for each product the month in 2019 where the absolute difference between its ending inventory and the minimum required level is the smallest (if there are ties, select the earliest month). Classify each product's inventory health into exactly one of ['Critical', 'Moderate', 'Healthy'] based on a description formatted as 'Current inventory: {ending_inventory} units. Minimum required: {qty_minimum} units. Buffer above minimum: {absolute_difference} units.', where 'Critical' means 'inventory is at or very close to the minimum with little safety buffer', 'Moderate' means 'inventory has a reasonable buffer above minimum', and 'Healthy' means 'inventory is well-stocked with substantial buffer above minimum'. Order results by semantic similarity to 'dangerously low stock levels requiring immediate replenishment' (most similar first), with product_id as tie-breaker. Return the product_id, month, absolute_difference, and inventory health classification.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: ELECTRONIC_SALES
Task: Generate a seller performance report for sellers who have sold more than 100 items. For each qualifying seller, calculate: total items sold, total sales amount, average item price (rounded to 2 decimal places), average review score (computed by first averaging review scores at the order level for each order associated with the seller, then averaging those order-level scores; rounded to 2 decimal places), and average packing time in hours (computed as the average time from order approval to carrier delivery across distinct orders, counting each order once regardless of item count; rounded to 2 decimal places). Also determine each seller's top product category in English by item count, using alphabetical order as a tie-breaker when counts are equal; exclude sellers whose top category is NULL or empty.

Classify each seller into exactly one of ['Elite Performer', 'Strong Performer', 'Average Performer', 'Needs Improvement'] based on a performance description formatted as 'Total Sales: {total_sales}, Avg Review Score: {avg_review_score}, Avg Packing Hours: {avg_packing_hours}', where all numeric values are rounded to 2 decimal places.

Filter to include only sellers classified as 'Elite Performer' or 'Strong Performer'. Among these filtered sellers, further filter to those whose top product category satisfies the condition 'This product category represents premium, technology, or high-value merchandise: {top_category}'.

Return seller_id, total items sold, total sales (rounded to 2 decimal places), average item price, average review score, average packing time in hours, top category in English, and the performance classification. Order results by total sales descending, with seller_id ascending as a tie-breaker.
Required AI functions: AI_CLASSIFY, AI_FILTER