tianyang/spider2-aifunc huggingface dataset:
Database: GA4
Task: For December 2020 session_start events, classify each session into exactly one of ['Organic Search', 'Paid Search', 'Direct', 'Referral', 'Social', 'Email', 'Display', 'Affiliates', 'Other'] based on a combined traffic source description formatted as 'Source: {source}, Medium: {medium}, Campaign: {campaign}' where NULL values are replaced with '(not set)'. Count total sessions per classified channel and order the results by semantic similarity to 'high-value paid marketing channel' in descending order, with alphabetical channel name as tie-breaker.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: GA4
Task: On January 2nd, 2021, using only page_view events, calculate the percentage of product listing page (PLP) views that eventually led to a product detail page (PDP) view within the same session. First, filter to pages where the condition 'This URL path represents a product browsing or product detail page on an e-commerce store, not a homepage, cart, checkout, or account page: ' concatenated with the page_location evaluates to true. Then classify each filtered page_location into exactly one of ['Product Listing Page', 'Product Detail Page', 'Other Page'], where 'Product Listing Page' means 'URL showing a category or collection of products, typically ending with a category name like apparel, electronics, drinkware without a specific product name', 'Product Detail Page' means 'URL showing a specific individual product, typically containing a product name with plus signs representing spaces like Google+Tee or Nest+Cam', and 'Other Page' means 'any page that is not clearly a product listing or product detail page'. Return the total PLP views, the count of PLP views followed by a PDP view in the same session, and the percentage rounded to 2 decimal places.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: GA4
Task: On January 2nd, 2021, for page_view events, calculate the percentage of product list page (PLP) views that eventually led to a product detail page (PDP) view within the same session. A PLP is identified by having a non-empty 5th URL path segment, no '+' character in the last URL segment, and the normalized 4th or 5th segment (with '+' replaced by space, lowercased) exactly matching one of these categories: 'accessories', 'apparel', 'brands', 'campus collection', 'drinkware', 'electronics', 'google redesign', 'lifestyle', 'nest', 'new 2015 logo', 'notebooks journals', 'office', 'shop by brand', 'small goods', 'stationery', 'wearables'. A PDP uses the same category matching but requires a '+' character in the last URL segment (indicating a product name). For sessions that successfully converted from PLP to PDP, aggregate all their page URLs using the instruction: 'Identify the top 3 most frequently visited product categories from these browsing journeys, formatted as: [category1]; [category2]; [category3]'. Return the total PLP views, the count of PLP views that led to PDP, the conversion percentage rounded to 2 decimal places, and the aggregated category summary.
Required AI functions: AI_AGG
Database: FIREBASE
Task: For users who installed the app during August and September 2018 (identified by user_first_touch_timestamp between 1533081600000000 and 1538352000000000 microseconds, representing 2018-08-01 to 2018-10-01 UTC), classify each user's engagement level into exactly one of ['Active Gamer', 'Casual User', 'Minimal Activity'] based on a description formatted as 'User events: {comma-separated list of distinct event names}', where 'Active Gamer' means 'user who plays game levels and completes challenges regularly', 'Casual User' means 'user who occasionally interacts but limited gameplay', and 'Minimal Activity' means 'user with very few recorded events or only basic app interactions'. Additionally, calculate the semantic similarity of each user's event types to the reference text 'level_complete_quickplay, level_start_quickplay, post_score, level_end_quickplay, level_up'. For users classified as 'Active Gamer' who also have a gaming similarity score above 0.3, what percentage either never uninstalled the app (no app_remove event) or uninstalled it more than 7 days (more than 604800000000 microseconds) after their first touch timestamp? Return the percentage rounded to 2 decimal places.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: FIREBASE
Task: Among quickplay event types classified into engagement categories ['Completion', 'Failure', 'Retry', 'Start', 'Reset', 'Other'] based on the event_name, which category had the lowest user retention rate during the second week (days 8-14) after users' initial app engagement, for users whose user_first_touch_timestamp falls between August 1, 2018 00:00:00 UTC and August 15, 2018 23:59:59 UTC? Retention is measured by the presence of at least one session_start event during days 8-14 after user_first_touch_timestamp. Users are grouped by the engagement category of their first quickplay event (the earliest event containing 'quickplay' in its name, ordered by event_timestamp). Only include categories where the condition 'This engagement category represents a negative or challenging player experience: {category}' evaluates to true when applied to the category name. If multiple categories have the same lowest retention rate, return the one that comes first alphabetically.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: FIREBASE
Task: What is the two-week retention rate for users grouped by the engagement outcome of their first quickplay event, where engagement outcome is classified into exactly one of ['Level Success', 'Level Failure', 'Level Restart'] based on the event name? Only include quickplay events that satisfy the condition 'This event indicates the player experienced a level outcome such as completion, failure, or restart: ' concatenated with the event name. Consider users who had a session_start event between July 2, 2018 and July 16, 2018 as the cohort. A user is considered retained if they have a session_start event 8-14 calendar days after the date of their initial qualifying quickplay event (i.e., if the initial event was on July 2nd, the retention window is July 10th through July 16th inclusive). Report the engagement outcome category, cohort size, retained count, and retention rate as a decimal rounded to 4 decimal places, ordered alphabetically by engagement outcome category.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: FIREBASE
Task: For new customers who first opened our app (first_open event) between September 1 and September 7, 2018 (inclusive, in Shanghai timezone), calculate the weekly retention rates for weeks 1, 2, and 3 after their first use, segmented by acquisition channel. 

Classify each user's acquisition channel into exactly one of ['Organic Search', 'Direct', 'Paid', 'Social', 'Other'] based on a combined description formatted as 'medium: {traffic_source:medium}, source: {traffic_source:source}', treating NULL values as 'none'.

For retention calculation, only count events where the condition 'This event indicates active user engagement such as completing a level, making a purchase, posting a score, or starting gameplay: ' concatenated with the event_name evaluates to true (excluding passive events like screen_view or session_start).

For each acquisition channel, show the week 1, week 2, and week 3 retention rates as percentages rounded to 2 decimal places. A user is considered retained in week N if they have any qualifying engagement activity between day (N-1)*7+1 and day N*7 after their first open date (e.g., week 1 is days 1-7, week 2 is days 8-14, week 3 is days 15-21). Order results by week 1 retention rate descending, then by acquisition channel alphabetically ascending for ties.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: FIREBASE
Task: For users who first started a session during the week of July 2, 2018 (Monday-based weeks), perform a retention analysis segmented by acquisition channel. Classify each user's traffic source into exactly one of ['Organic Search', 'Direct Traffic', 'Paid Advertising', 'Other'] based on a description formatted as 'Medium: {traffic_source.medium}, Source: {traffic_source.source}', where null values are replaced with 'none'. Track retention from Week 0 (the cohort week) through Week 4, counting only events up to October 2, 2018. For each acquisition channel and week, provide the count of distinct users. Order results by how similar the acquisition channel name is to 'valuable organic user acquisition' (most similar first), then by week number ascending, then by acquisition channel name alphabetically as a final tie-breaker.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: FIREBASE
Task: Group users by the week of their first session start (using the earliest event date per user), beginning from July 2, 2018, with each cohort named by its Monday date. For users who had any activity in the fourth week after their cohort week start (days 21-27), concatenate their distinct event names into a string formatted as 'Week 4 events: {event_names}'. First, filter to only include users where the condition 'The user showed meaningful app engagement based on these events: ' concatenated with their event names string evaluates to true. Then classify each remaining user's engagement pattern into exactly one of ['Active Engagement', 'Passive Engagement', 'Minimal Engagement'], where 'Active Engagement' means 'user completed levels, posted scores, or started new sessions indicating meaningful app usage', 'Passive Engagement' means 'user viewed screens or had basic interactions without completing activities', and 'Minimal Engagement' means 'user only had system events or minimal interaction'. Calculate the retention rate for each cohort as the percentage of original users who returned in week 4, passed the meaningful engagement filter, AND were classified as 'Active Engagement'. Return the Monday date (formatted as 'YYYY-MM-DD') of the cohort with the highest active engagement retention rate. If there is a tie, return the earliest cohort date.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: GA4
Task: For page_view events on January 2nd, 2021, calculate the conversion rate among sessions that landed on the Home page (where the entrances event parameter equals 1) and demonstrated meaningful shopping engagement. A session demonstrates meaningful engagement if its journey description, evaluated using the filter phrase '{journey} - The user viewed at least one product detail page or added items to cart during this session' (where {journey} is formatted as 'Browsing path: {page1} -> {page2} -> ...'), returns true. Each engaged session's journey is then classified into exactly one of ['Deep Engagement', 'Moderate Engagement', 'Light Engagement'] where 'Deep Engagement' means 'extensive product exploration with cart or checkout interaction', 'Moderate Engagement' means 'viewed multiple products or categories', and 'Light Engagement' means 'minimal product interaction'. Include only sessions classified as 'Deep Engagement' or 'Moderate Engagement'. A session converts if its journey includes the page titled 'Checkout Confirmation'. Return the conversion rate as a percentage of qualifying sessions that converted, rounded to 2 decimal places.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: E_COMMERCE
Task: Using daily toy sales data from January 1, 2017 to August 29, 2018, calculate the 5-day symmetric moving average of predicted toy sales for December 5 to 8, 2018, and return the sum of those four moving averages.

To identify toy products, use the top 2 product categories most semantically similar to 'children toys and games for kids' based on category name. Only include orders that are not cancelled (order_status is not 'cancelled').

Build a simple linear regression model (predicted_sales = slope × day_number + intercept) where day_number is the number of days since January 1, 2017 (with January 1, 2017 being day 1). Generate predictions for December 3-10, 2018 to enable the 5-day symmetric moving average calculation (2 days before and 2 days after each target date). The 5-day symmetric moving average for a given date is the average of the predicted sales for that date plus the 2 preceding and 2 following days.
Required AI functions: AI_SIMILARITY
Database: E_COMMERCE
Task: Among customers classified into exactly one of ['Premium Whale', 'High Value', 'Regular', 'Budget'] based on a profile formatted as 'Customer profile: {num_orders} orders, ${avg_payment_per_order} average payment per order, {lifespan_weeks} weeks lifespan', filter to those classified as 'Premium Whale' or 'High Value'. Then rank these customers by semantic similarity to 'A premium customer who makes very large purchases with extremely high average order value', with ties broken by average payment per order descending, then by customer unique ID ascending. Return the top 3 customers showing their unique ID, number of orders, average payment per order (rounded to 2 decimal places), customer lifespan in weeks (calculated as days between first and last purchase divided by 7, with a minimum of 1.0 if less than 7 days, rounded to 2 decimal places), and their assigned tier. Consider only the top 50 customers by average payment per order (ties broken by customer unique ID ascending) as candidates for classification.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: BASEBALL
Task: For each of the four career statistical categories (games played, runs, hits, and home runs), identify the baseball player with the highest career total. For each record holder, provide their given name, the record value, their playing style classification, and a career trajectory summary. 

The playing style should be classified into exactly one of ['Power Hitter', 'Contact Hitter', 'Speed Player', 'Balanced Player'] based on a profile description formatted as 'Career stats - HR: {total_hr}, Hits: {total_hits}, Runs: {total_runs}, Stolen Bases: {total_sb}. Classify based on which stat dominates their profile relative to games played.'

The career trajectory summary should be generated by aggregating their year-by-year statistics using the instruction: 'Summarize this baseball player career in one sentence, noting their peak performance years and teams. Format: [summary sentence]'. Each yearly record should be formatted as 'Year [year]: [games] games, [runs] runs, [hits] hits, [hr] HR for [team]'.

Return results ordered by category in the sequence: games_played, runs, hits, home_runs.
Required AI functions: AI_AGG, AI_CLASSIFY
Database: CALIFORNIA_TRAFFIC_COLLISION
Task: Calculate the motorcyclist fatality rate by helmet usage for motorcycle collisions. Identify motorcycle parties by filtering where the condition 'This vehicle type is a motorcycle: ' concatenated with the statewide_vehicle_type field evaluates to true. For each motorcycle party, classify their combined safety equipment (party_safety_equipment_1 concatenated with a space and party_safety_equipment_2) into exactly one of ['Helmet Used', 'Helmet Not Used', 'Unknown']. At the collision level, assign 'Helmet Used' if all classified motorcycle parties used helmets and none didn't, 'Helmet Not Used' if all didn't use helmets and none did, otherwise exclude the collision. For each helmet group, show the helmet group name, total collision count, total motorcyclist fatalities, and fatality rate percentage calculated as (total fatalities / total collisions) × 100, rounded to 2 decimal places.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: CALIFORNIA_TRAFFIC_COLLISION
Task: For motorcycle collisions, calculate the fatality rate percentage separated by helmet usage. For each collision, extract the helmet status from each party's safety equipment description (combining party_safety_equipment_1 and party_safety_equipment_2 as 'Equipment 1: {equipment_1} | Equipment 2: {equipment_2}', replacing null values with 'none') into a field named 'helmet_status' using the extraction question: "Was a motorcycle helmet used by this party? Answer exactly: used, not_used, or not_applicable". Classify a collision as 'helmet_used' if any party has helmet status 'used' and no party has 'not_used', classify as 'helmet_not_used' if any party has 'not_used' and no party has 'used', otherwise classify as 'unknown'. For each helmet usage group (excluding 'unknown'), calculate the fatality rate as (total motorcyclist fatalities / total collisions) * 100, rounded to 2 decimal places. Return the helmet usage group and fatality rate percentage, ordered alphabetically by helmet usage group.
Required AI functions: AI_EXTRACT
Database: CALIFORNIA_TRAFFIC_COLLISION
Task: Among traffic collisions from 2011 and 2021 that occurred under hazardous conditions (where the phrase 'These driving conditions are potentially hazardous or non-ideal for driving: Lighting - {lighting}, Weather - {weather}, Road surface - {road_surface}' evaluates to true for each collision's environmental factors), classify each unique combination of lighting, weather, and road surface into exactly one of ['High Risk', 'Moderate Risk', 'Low Risk'] based on a description formatted as 'Lighting: {lighting}, Weather: {weather}, Road surface: {road_surface}'. For the risk category that was most common among these hazardous-condition collisions in 2021, how many percentage points did its share decrease compared to its share in 2011? Return the result rounded to 2 decimal places.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: WWE
Task: For NXT brand championship titles—identified by filtering belt names that contain 'NXT' and where the semantic condition 'This championship title belongs to WWE NXT brand: ' concatenated with the belt name evaluates to true—what were the names of the two wrestlers (winner and loser) involved in the shortest match by duration, excluding matches where title_change is not 0? If multiple matches share the same shortest duration, return the one with the smallest winner_id, then smallest loser_id.
Required AI functions: AI_FILTER
Database: WWE
Task: For the NXT title match with the shortest duration (excluding title changes), who were the two wrestlers involved, what type of event was it, and what other matches occurred at that event? Extract the event type from the event name using the extraction question 'What type of wrestling event is this? Answer with one of: TV Taping, Pay-Per-View, House Show, or Special Event'. Aggregate all match outcomes from the same card using the instruction 'List all match results concisely, formatted as: Winner def. Loser; Winner def. Loser'.
Required AI functions: AI_AGG, AI_EXTRACT
Database: IPL
Task: Among bowlers with at least 10 wickets taken, which spin bowler has the lowest bowling average (runs conceded per wicket)? Filter to spin bowlers using the semantic condition 'This bowling skill description indicates a spin bowler: ' concatenated with the bowling_skill field. If there is a tie in bowling average, rank alphabetically by player name. Return the bowler's name, their bowling skill, and their bowling average rounded to 2 decimal places.
Required AI functions: AI_FILTER
Database: IPL
Task: Which bowler has the lowest bowling average per wicket taken, considering only players whose bowling_skill is not null and not 'Does not bowl', and who have taken at least 10 wickets? Calculate bowling average as total runs conceded (including extra runs) divided by total wickets taken, rounded to 2 decimal places. For the identified bowler, also provide a summary of their dismissal patterns by aggregating their wicket types using the instruction: 'Summarize the dismissal methods, formatted as: Primary: [most common type] | Others: [remaining types by frequency]'.
Required AI functions: AI_AGG
Database: IPL
Task: Among strikers who have scored more than 50 runs in any single match, classify each player into exactly one of ['Left-handed Power', 'Right-handed Power', 'All-rounder', 'Specialist'] based on their profile formatted as 'Batting: {batting_hand}, Bowling: {bowling_skill}', where 'Left-handed Power' means 'Left-hand bat with medium pace bowling such as Right-arm medium or Left-arm medium indicating a batsman who can bowl occasionally', 'Right-handed Power' means 'Right-hand bat with medium pace bowling such as Right-arm medium or Left-arm medium indicating a batsman who can bowl occasionally', 'All-rounder' means 'player with specialist bowling skills such as offbreak, legbreak, spin, fast, or fast-medium indicating genuine bowling ability', and 'Specialist' means 'player with unclear batting profile or unusual combination'. Only include players where the condition 'This player is primarily a batsman rather than a bowling specialist: ' concatenated with the same profile format evaluates to true. For each category, calculate the average of the total career runs scored by players in that category (rounded to 2 decimal places), ordered by average runs descending.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: IPL
Task: Among players who scored at least 100 runs in a match while playing for the losing team, find those whose profile satisfies the filtering condition. The filter input should be formatted as 'This player is from a major cricket-playing nation in the Indian subcontinent or Oceania: Player: {player_name}, Country: {country_name}, Batting: {batting_hand}'. From these players, return the top 3 whose full profile (formatted as 'Player: {player_name}, Country: {country_name}, Batting: {batting_hand}, Bowling: {bowling_skill}', using 'None' for players without a bowling skill) is most similar to 'legendary batsman known for chasing down targets and match-winning centuries under pressure'. Order from most to least similar, with ties broken alphabetically by player name.
Required AI functions: AI_FILTER, AI_SIMILARITY
Database: IPL
Task: Among IPL players who have scored at least one run, calculate each player's average runs per match (total runs divided by the number of matches the player participated in according to player-match records), then compute the average of these player averages for each country. Filter to only include countries where the condition 'This is a major international cricket-playing nation with a strong cricketing tradition: ' concatenated with the country name evaluates to true, and where the country is classified into exactly one of ['South Asian', 'Oceania', 'European', 'African', 'Caribbean', 'Other'] based on country name, keeping only countries classified as 'South Asian', 'Oceania', 'European', 'African', or 'Caribbean' (excluding those classified as 'Other'). Return the top 5 countries with the highest country batting averages, including the country name, its region classification, and the country batting average rounded to 2 decimal places. If there are ties in the country batting average, order alphabetically by country name.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: IPL
Task: Find the top 5 countries whose players have the highest average of their individual average runs per match, only considering players who have batting records (appeared as a striker in at least one ball). For each player, calculate their average runs per match (total runs divided by the number of distinct matches they participated in according to the player-match records, not just matches where they batted), then compute the average of these player averages for each country. For each of these top 5 countries, identify the top 3 batters by average runs per match (with ties broken by player_id ascending), and provide a summary by aggregating their information using the instruction: 'Format the 3 players as: [Name] ([Hand], Avg: [X.XX]); [Name] ([Hand], Avg: [X.XX]); [Name] ([Hand], Avg: [X.XX]), ordered by their average descending' where the input for each player is formatted as 'Player: {player_name}, Hand: {batting_hand or 'Unknown' if not available}, Avg: {avg_runs_per_match rounded to 2 decimals}'. Return the country name, country batting average (rounded to 2 decimal places), and the top batters summary, ordered by country batting average descending.
Required AI functions: AI_AGG