tianyang/spider2-aifunc huggingface dataset:
Database: CYMBAL_INVESTMENTS
Task: For the top 6 trade reports with the highest closing prices, collect the following information: tradeID (from OrderID), tradeTimestamp (from MaturityDate converted to timestamp by dividing by 1000000), algorithm (classified from TargetCompID into exactly one of ['Momentum', 'Feeling Lucky', 'Prediction', 'Unknown']), symbol, openPrice (from LastPx rounded to 4 decimals), closePrice (from StrikePrice rounded to 4 decimals), tradeDirection (from the Sides array's Side field), and tradeMultiplier (1 for LONG, -1 for SHORT, 0 otherwise). Order by closePrice descending, and for ties in closePrice, order by similarity of a trade description formatted as '{Symbol} {tradeDirection} trade at {StrikePrice}' to 'high-value successful trade execution' descending, then by tradeTimestamp ascending.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: ETHEREUM_BLOCKCHAIN
Task: For Ethereum addresses active before January 1, 2017 (timestamp < 1483228800000000), generate an address behavior report that includes: net balance (in ETH, calculated as incoming value + mining rewards - outgoing value - transaction fees, excluding delegatecall/callcode/staticcall traces), hourly activity concentration (R_active_hour, computed only when activity count exceeds 24), active days count, incoming transaction metrics (trace count, unique senders, transfer count, average ETH amount), average and standard deviation of gas used for incoming calls, outgoing transaction metrics (trace count, unique receivers, transfer count, average ETH amount), ERC20 token interactions (incoming/outgoing counts, unique token types, unique counterparties), mining reward amount in ETH, contract creation count, failed transaction count, and average bytecode size of created contracts.

Classify each address into exactly one of ['High-Volume Trader', 'Miner', 'Contract Developer', 'Passive Holder', 'Mixed Activity'] based on a behavior description formatted as 'Balance: {balance rounded to 4 decimals} ETH, In Txns: {in_trace_count}, Out Txns: {out_trace_count}, Rewards: {reward_amount rounded to 4 decimals} ETH, Contracts Created: {contract_create_count}, Token In: {token_in_tnx}, Token Out: {token_out_tnx}'.

Then, for addresses classified as 'High-Volume Trader' or 'Contract Developer', calculate semantic similarity to the reference pattern 'High transaction frequency with many unique counterparties and significant ETH movement' based on a description formatted as 'Total transactions: {in_trace_count + out_trace_count}, Unique counterparties: {in_addr_count + out_addr_count}, Balance: {balance rounded to 4 decimals} ETH'.

Return the top 30 addresses with similarity score above 0.3, ordered by similarity score rounded to 2 decimal places descending, with ties broken by address alphabetically ascending. Exclude addresses with no transaction history (zero in both in_trace_count and out_trace_count and no token activity and no contract creations and no failures).
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: _1000_GENOMES
Task: For samples from African ancestry populations (classified into ['African', 'European', 'East Asian', 'South Asian', 'American'] based on super population description) who are not children in the study (filtered using the condition 'This individual is not a child in the study: ' concatenated with the relationship description, where empty relationships are replaced with 'unknown relationship'), analyze chromosome X SNP genotype data.

Extract genotype data for SNPs (identified by VT='SNP') on chromosome X, excluding positions where start is between 59999 and 2699519 or between 154931042 and 155260559. For each sample with at least two alleles in their genotype array, classify genotype calls into: homozygous reference (both alleles are 0), homozygous alternate (both alleles are identical and greater than 0), or heterozygous (alleles are different, or any allele is null with at least one allele greater than 0). Compute for each sample: total callable sites (sum of all three genotype categories), counts for homozygous reference, homozygous alternate, and heterozygous calls, total SNVs (homozygous alternate plus heterozygous), percentage of heterozygous calls among SNVs (rounded to 2 decimal places), and percentage of homozygous alternate calls among SNVs (rounded to 2 decimal places). Output the sample ID and all computed statistics, ordered by percentage of heterozygous SNVs descending, then by sample ID ascending.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: _1000_GENOMES
Task: For variants on chromosome 17 between positions 41196311 and 41277499 (where both start and end positions fall within this range), calculate the Hardy-Weinberg equilibrium statistics including: reference name, start position, end position, reference bases, the first alternate base as a string, variant type, computed HWE chi-squared score, total genotypes, observed counts (homozygous reference, heterozygous, homozygous alternate), expected counts (homozygous reference, heterozygous, homozygous alternate), computed reference and alternate allele frequencies, and population-specific allele frequencies (overall 1KG AF, AFR_AF, EUR_AF, AMR_AF, ASN_AF). Only include variants with exactly one alternate base. Additionally, classify each variant's population genetics profile into exactly one of ['Population-Specific', 'Cosmopolitan', 'Rare Global', 'Data Insufficient'] based on a description formatted as 'Overall allele frequency: {AF or "missing" if NULL}, African: {AFR_AF or "missing" if NULL}, European: {EUR_AF or "missing" if NULL}, American: {AMR_AF or "missing" if NULL}, Asian: {ASN_AF or "missing" if NULL}', where 'Population-Specific' means 'variant is present at notably higher frequency in one or two populations compared to others, suggesting regional selection or drift', 'Cosmopolitan' means 'variant is present at similar frequencies across multiple populations, suggesting ancient origin or balancing selection', 'Rare Global' means 'variant is rare (below 5%) across all populations with available data', and 'Data Insufficient' means 'too many populations have missing frequency data to determine a pattern'. Order results by semantic similarity to 'variant with deviation from Hardy-Weinberg equilibrium and potential population stratification signal' in descending order, based on a description formatted as 'Chi-squared: {chi_squared rounded to 4 decimal places}, Heterozygosity observed: {obs_het}, Heterozygosity expected: {exp_het rounded to 2 decimal places}, Population frequencies - AFR: {AFR_AF or "missing" if NULL}, EUR: {EUR_AF or "missing" if NULL}, AMR: {AMR_AF or "missing" if NULL}, ASN: {ASN_AF or "missing" if NULL}', with ties broken by start position descending.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: IDC
Task: Identify the top five CT scan series by size (in MiB), including their SeriesInstanceUID, series number, patient ID, series size, and the body region extracted from the SeriesDescription into a field named 'body_region' using the extraction question 'What body region or anatomical area is being scanned based on the series description? If unclear or not specified, return "Unspecified"'. If the SeriesDescription is null, use 'No description available' as the input text for extraction. These series must be from the CT modality and not part of the 'nlst' collection (case-insensitive). Exclude any series where the ImageType contains 'LOCALIZER' or where the TransferSyntaxUID is either '1.2.840.10008.1.2.4.70' or '1.2.840.10008.1.2.4.51' (JPEG compressed). The selected series must have consistent slice intervals (at most one unique z-axis spacing value), consistent exposure levels (at most one unique value each for ExposureInmAs, Exposure, and XRayTubeCurrentInmA), only one unique ImageOrientationPatient value, consistent pixel spacing, consistent xy image positions (only one unique x,y pair), and consistent pixel dimensions (rows and columns). Ensure that the number of images matches the number of unique z-axis positions, indicating no duplicate slices. The z-axis component of the cross product of the x and y direction cosines from ImageOrientationPatient must have an absolute value between 0.99 and 1.01, ensuring alignment with the expected imaging plane. Order the results by series size in descending order and limit to the top five series.
Required AI functions: AI_EXTRACT
Database: IDC
Task: For patients with StudyDate in the year 2001, retrieve PatientID, StudyInstanceUID, StudyDate, and the FindingSite CodeMeaning from the dicom_all table, along with the maximum values of each measurement (Elongation, Flatness, Least Axis in 3D Length, Major Axis in 3D Length, Maximum 3D Diameter of a Mesh, Minor Axis in 3D Length, Sphericity, Surface Area of Mesh, Surface to Volume Ratio, Volume from Voxel Summation, and Volume of Mesh) by joining quantitative_measurements on segmentationInstanceUID matching SOPInstanceUID. Classify each FindingSite CodeMeaning into exactly one of ['Cardiovascular', 'Respiratory', 'Digestive', 'Other'] based on the anatomical structure name, and filter to only include records where the anatomical system classification is 'Cardiovascular' or 'Respiratory'. Additionally, order results by similarity to 'cardiac organ central to blood circulation' (descending) within each patient study, so that the heart appears before other cardiovascular or respiratory structures. Group by PatientID, StudyInstanceUID, StudyDate, and FindingSite CodeMeaning, and use PatientID, StudyInstanceUID as primary ordering, then similarity score descending, then FindingSite CodeMeaning alphabetically for tie-breaking.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: WORD_VECTORS_US
Task: Find the top 10 articles from the 'nature' dataset that are most semantically similar to the article with ID '8a78ef2d-d5f7-4d2d-9b47-5adb25cbd373' (based on comparing body text content), but only include articles where the condition 'This article discusses biomarkers, diagnostic methods, or disease detection: ' concatenated with the article title evaluates to true. Return the article ID, date, and title, ordered by semantic similarity from highest to lowest. In case of similarity ties, order by date descending, then by ID ascending.
Required AI functions: AI_FILTER, AI_SIMILARITY
Database: WORD_VECTORS_US
Task: Which 10 articles have abstracts most semantically similar to the abstract of the article with ID '8a78ef2d-d5f7-4d2d-9b47-5adb25cbd373'? For each similar article, also analyze the sentiment of its abstract regarding the 'Research Findings' aspect. Return the article ID, publication date, title, and the sentiment toward research findings. Order results by similarity score descending, with ties broken by article ID alphabetically.
Required AI functions: AI_SENTIMENT, AI_SIMILARITY
Database: NCAA_BASKETBALL
Task: For the 2014 season game where the Wildcats were the home team and the Fighting Irish were the away team, provide a list of all scoring plays organized by play type and then chronologically within each type. For each scoring event, include:
- The game clock time
- The cumulative score for Wildcats and Fighting Irish after the play
- The team that scored (using team name: 'Wildcats' or 'Fighting Irish')
- The event description
- The play type, classified into exactly one of ['Free Throw', 'Inside Score', 'Perimeter Shot'] based on the event description
- The scorer's name, extracted into a field named 'scorer' using the extraction question 'Who is the player that scored? Return only the player full name.'

Order by play type alphabetically (Free Throw, Inside Score, Perimeter Shot), then by period, then by elapsed time within the period, then by event_id for tie-breaking within the same play type.
Required AI functions: AI_CLASSIFY, AI_EXTRACT
Database: NCAA_BASKETBALL
Task: From the NCAA basketball dataset, generate a table listing the top five records in each of four categories, where each record is classified into exactly one of ['Historic', 'Significant', 'Notable'] based on the matchup or venue description (where 'Historic' means 'a landmark achievement that defined an era', 'Significant' means 'a major accomplishment worthy of recognition', and 'Notable' means 'an impressive record worth mentioning'). Additionally, within each category, records are ranked by semantic similarity to 'historic NCAA basketball achievement' (descending) as a tiebreaker when key metrics are equal:

(1) Top Venues - the largest venues by seating capacity from MBB_GAMES_SR, with Date shown as 'N/A', formatted as 'VenueName (City, State)'
(2) Biggest Championship Margins - National Championship games (round = 2) from MBB_HISTORICAL_TOURNAMENT_GAMES since 2016 season (season > 2015) with the biggest point margin victories, formatted as 'WinnerSchool vs LoserSchool'
(3) Highest Scoring Games - games from MBB_GAMES_SR since 2011 season (season > 2010) with the highest total points scored by both teams combined, formatted as 'AwayTeam at HomeTeam'
(4) Total Threes - games from MBB_GAMES_SR since 2011 season (season > 2010) with the highest total three-pointers made by both teams combined, formatted as 'AwayTeam at HomeTeam'

Within each category, records should be ordered by Key Metric descending, with ties broken first by semantic similarity to 'historic NCAA basketball achievement' descending, then by venue name ascending (for Top Venues) or date descending (for game categories). Output columns: Category, Date, Matchup or Venue, Key Metric, Significance.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: GA4
Task: Among products co-purchased with the Google Navy Speckled Tee during December 2020 (where co-purchase means products in the same transaction identified by transaction_id, excluding the target tee itself), which non-apparel product had the highest total quantity? Classify each product into exactly one of ['Drinkware', 'Apparel', 'Accessories', 'Electronics', 'Office', 'Other'] based on product name, then exclude products classified as 'Apparel'. Return the top product by total quantity among the remaining items, along with its category. If there are ties in quantity, rank by similarity to 'reusable beverage container' descending, then by product name ascending.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: GA4
Task: For each of the three months from November 2020 through January 2021, among customers who purchased the 'Google Red Speckled Tee', identify the most purchased other product (excluding the Tee itself) where the semantic condition 'This product would make a good complementary purchase with a t-shirt: ' concatenated with the product name evaluates to true. For each month, show the month (formatted as the first day of the month in YYYY-MM-DD format), the product name, its total quantity purchased, and classify the product into exactly one of ['Apparel', 'Accessories', 'Stickers', 'Drinkware', 'Other'] based on the product name. If there are ties in quantity, break ties alphabetically by product name. Order results by month ascending.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: GA4
Task: For each of the three months starting from November 2020 (formatted as YYYY-MM), among customers who purchased 'Google Red Speckled Tee', what other product was most purchased by total quantity, and what was the quantity? For each product name, extract the product type into a field named 'product_type' using the extraction question 'What is the single-word product type? Examples: Tee, Sticker, Decal, Hoodie, Hat, Bag, Bottle, Pen, Backpack'. If multiple products tie for the highest quantity in a month, rank alphabetically first by extracted product_type, then by product name. Return the month, product name, quantity, and product type.
Required AI functions: AI_EXTRACT
Database: FIREBASE
Task: For quick play mode completions (event name 'level_complete_quickplay') on September 15, 2018, calculate the average score for each board type and evaluate their effectiveness. Classify each board type's performance into exactly one of ['High Performance', 'Medium Performance', 'Low Performance'] based on a description formatted as 'Board type: {board_type} with average score: {avg_score}', with task guidance: 'Classify game board performance where higher average scores indicate better performance. Scores range from approximately 20 to 35.' Rank the board types by semantic similarity to 'highly effective game board with excellent player performance and high scores' using a description formatted as 'Board {board_type} achieves {performance_category} with score {avg_score}', from most to least similar. Return the board type, average score rounded to 2 decimal places, and performance category.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: GA4
Task: For the date range November 1–30, 2020, considering only events with event_name='purchase' and non-null ecommerce.purchase_revenue_in_usd, identify users who had more than one purchase session (grouping sessions by ga_session_id from event_params). For each such user, create a profile description formatted as 'This customer made {session_count} separate purchases with an average transaction value of ${avg_revenue}'. Filter to users where the condition 'This profile represents a valuable repeat customer who demonstrates loyalty through multiple high-value transactions: ' concatenated with the profile description evaluates to true. Additionally, classify each filtered user's spending pattern into exactly one of ['Elite Spender', 'Solid Spender', 'Casual Spender'] based on the profile description, where 'Elite Spender' means 'exceptional transaction values indicating premium customer status', 'Solid Spender' means 'consistent moderate spending showing reliable customer behavior', and 'Casual Spender' means 'lower transaction values but still repeat customer'. Return the user_pseudo_id, their average purchase revenue per session in USD (rounded to 2 decimal places), and their spending classification, ordered by average revenue descending, with ties broken by user_pseudo_id ascending.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: GA4
Task: For December 2020, what is the average number of engaged sessions per user, considering only traffic source mediums where the condition 'This traffic source medium represents legitimate human user traffic and not automated bot or spam traffic: {medium}' evaluates to true? Return the result rounded to 2 decimal places.

A session is engaged when the event parameter 'session_engaged' equals '1'. Sessions are identified by combining user_pseudo_id with ga_session_id. The average is calculated as the mean of per-user engaged session counts (i.e., first count engaged sessions per user, then take the average of those counts).
Required AI functions: AI_FILTER
Database: GA4
Task: Among page_view events on 'shop.googlemerchandisestore.com' during December 2020, after cleaning URLs by removing the protocol and domain prefix and collapsing consecutive slashes to single slashes (treating empty paths as '/'), what is the second most viewed page path that represents meaningful user browsing activity (filtering using the condition 'This URL path represents a legitimate user-facing webpage for browsing or shopping, not an API endpoint, tracking pixel, or technical resource: ' concatenated with the page path), classified into exactly one of ['Shopping Cart', 'Product Page', 'Checkout', 'Homepage', 'Category Page', 'Search Results', 'Account', 'Other'] based on the page path? In case of ties in page view counts, use alphabetical order of page path as the tie-breaker.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: GA4
Task: What is the page with the second highest total page views on shop.googlemerchandisestore.com during all of December 2020, after cleaning up URLs by collapsing consecutive slashes into single slashes and extracting the page path (starting with '/')? For this page, extract its semantic purpose into a field named 'page_purpose' using the extraction question: 'What is the primary purpose of this webpage based on its URL path? Provide a brief 2-3 word description such as Shopping Cart, Product Listing, Home Page, or Checkout.' Return the cleaned page path and the extracted page purpose.
Required AI functions: AI_EXTRACT
Database: GA4
Task: On November 30, 2020, for purchase events with valid transaction IDs (excluding NULL and '(not set)') and positive purchase_revenue_in_usd, semantically classify each item into exactly one of ['Apparel', 'Drinkware', 'Bags', 'Accessories', 'Office & Home', 'Other'] based on the item_name. Identify which AI-classified category has the highest tax rate (with ties broken by category name alphabetically), where tax rate equals the sum of tax_value_in_usd divided by the sum of purchase_revenue_in_usd across all distinct transactions containing items in that category. For transactions containing at least one item in the highest-tax-rate category, return the transaction ID, total item quantity, purchase revenue in USD, and purchase revenue, ranked by semantic similarity to 'premium branded merchandise' using the alphabetically-sorted concatenation of all item names in each transaction (items separated by ', '), most similar first, with ties broken by transaction_id ascending, limited to 25 transactions.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: GA4
Task: For user 1402138.5184246691 on January 2, 2021, list all e-commerce browsing pages they visited by examining page_view events only, filtering to only pages where the condition 'This URL is part of an e-commerce product browsing experience (product pages, category pages, or homepage), not a policy, FAQ, or support page: {page_location}' evaluates to true. For each qualifying page visit, classify it into exactly one of ['PDP', 'PLP', 'Home', 'Other'] based on a combined description formatted as 'URL: {page_location} | Title: {page_title}', using the task description 'Classify e-commerce pages by their URL structure: PDP URLs end with product names containing plus signs, PLP URLs are category paths without product-specific endings, Home is the root URL'. Label descriptions are: 'PDP' means 'Product Detail Page - the last URL segment contains plus signs indicating a product name like Google+Dino+Game+Tee', 'PLP' means 'Product Listing Page - URL path shows categories like /Lifestyle or /Drinkware without a product-specific last segment', 'Home' means 'Store homepage at root URL ending with just the domain', 'Other' means 'Pages that do not fit the above patterns'. If classification returns empty, default to 'Other'. Return only the page classification for each visit, ordered chronologically by event timestamp, with ties broken by event bundle sequence ID.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: GA4
Task: For user 1402138.5184246691 on January 2, 2021, list all page views in chronological order showing the adjusted page name and a session behavior label. 

The page name adjustment follows URL structure rules: if the URL path contains product category segments (like 'Lifestyle', 'Drinkware', 'Apparel', 'Office', 'Stationery', 'Accessories', 'Electronics', 'Brands', 'Wearables', 'Nest', 'Shop+By+Brand', 'Notebooks+Journals', 'Small+Goods', 'Google+Redesign') and the last URL segment contains plus signs (indicating a multi-word product name), show 'PDP'; if within a product category but the last segment has no plus signs, show 'PLP'; otherwise show the original page title.

The session behavior label is generated by aggregating all page information formatted as 'Page: {adjusted_page_name}, Title: {page_title}' for each page view, using the instruction: 'Based on this browsing session, classify the user behavior as exactly one of: EXPLORER (mostly browsing categories), RESEARCHER (viewing specific products), or CASUAL (mixed or minimal activity). Answer with just the single word label.'

Order results by event timestamp ascending.
Required AI functions: AI_AGG