bigquery-ai-ml

Write BigQuery SQL queries using built-in AI and ML functions for forecasting, anomaly detection, and generative analysis.

Updated Aug 11, 2026
One-click install
npx skills add https://github.com/Yashyasik/zexca-api --skill bigquery-ai-ml-yashyasik
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: bigquery-ai-ml
Source: https://github.com/Yashyasik/zexca-api/tree/main/.gemini/skills/bigquery-ai-ml
Command: npx skills add https://github.com/Yashyasik/zexca-api --skill bigquery-ai-ml-yashyasik

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing correct BigQuery AI/ML SQL requires knowing the exact syntax, argument rules, and routing constraints of functions like AI.FORECAST, AI.GENERATE, and AI.KEY_DRIVERS, which are easy to misuse without authoritative reference material. ## Core Features & Use Cases - Time-Series Analysis: Generate forecasts with AI.FORECAST, detect outliers with AI.DETECT_ANOMALIES, and evaluate model accuracy with AI.EVALUATE using the pre-trained TimesFM model. - Generative AI in SQL: Classify, summarize, score, and generate text or structured output directly in queries using AI.GENERATE, AI.CLASSIFY, AI.AGG, AI.IF, and AI.GENERATE_TABLE with Gemini endpoints. - Semantic Search & Key Drivers: Perform vector and semantic search with VECTOR_SEARCH and AI.SEARCH, and identify metric drivers with AI.KEY_DRIVERS or CONTRIBUTION_ANALYSIS models. - Use Case: A data analyst needs to forecast next month's bike trips per user type and flag anomalous days; the Skill provides the exact AI.FORECAST and AI.DETECT_ANOMALIES syntax with correct named arguments and output schemas. ## Quick Start Ask the assistant to write a BigQuery SQL query that forecasts the next 30 days of sales using AI.FORECAST on your sales table.

Frequently Asked Questions about bigquery-ai-ml

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I forecast time series data in BigQuery?▼

Use AI.FORECAST, a table-valued function powered by the pre-trained TimesFM model, called in the FROM clause with data_col and timestamp_col arguments. You can set horizon, confidence_level, and id_cols for multiple series without training a custom model.

How do I detect anomalies in BigQuery time series data?▼

Use AI.DETECT_ANOMALIES with a historical dataset and a target dataset, specifying data_col and timestamp_col. It returns is_anomaly flags, probability scores, and expected bounds, with an adjustable anomaly_prob_threshold defaulting to 0.95.

What is the difference between AI.GENERATE and AI.GENERATE_TABLE in BigQuery?▼

AI.GENERATE is a scalar function returning a STRUCT with generated text per row, while AI.GENERATE_TABLE is a table-valued function called in the FROM clause that extracts information into a typed output_schema. AI.GENERATE_TABLE requires a remote model and an input column aliased as prompt.

Does BigQuery AI.FORECAST require training a custom model?▼

No, AI.FORECAST uses the pre-trained TimesFM foundation model, so no CREATE MODEL training step is needed. You only need at least 3 historical data points per series, and you can optionally evaluate accuracy with AI.EVALUATE using a chronological data split.

How do I create a remote model for BigQuery generative AI functions?▼

Create a remote model with CREATE MODEL ... REMOTE WITH CONNECTION DEFAULT and set the ENDPOINT option, such as gemini-2.5-flash for generative tasks or text-embedding-005 for embeddings. The default connection is recommended over specifying a fully qualified connection ID.

When should I use AI.KEY_DRIVERS versus CONTRIBUTION_ANALYSIS in BigQuery?▼

AI.KEY_DRIVERS is a table-valued function that finds key drivers directly on a table without creating a model, while CONTRIBUTION_ANALYSIS requires creating a MODEL entity and querying results with ML.GET_INSIGHTS. Both compare an interest group against a reference group across dimension segments.