All skills
google avatar

/bigquery-ai-ml

@435f7c7
by googlegoogle/adk-python22k stars
4,084

Skill for BigQuery AI and Machine Learning queries using standard SQL and `AI.*` functions (preferred over dedicated tools).

Use this Skill: https://skilld.dev/gh/google/adk-python/bigquery-ai-ml

This session only. Nothing lands on disk.

referencesbigquery_ai_classify.md

≈951 tokens on demand. Your agent reads this file only when SKILL.md points to it.

BigQuery AI.Classify

AI.CLASSIFY categorizes unstructured data into a predefined set of labels.

Syntax Reference

AI.CLASSIFY(
  [ input => ] 'INPUT',
  [ categories => ] 'CATEGORIES'
  [, connection_id => 'CONNECTION_ID' ]
  [, endpoint => 'ENDPOINT' ]
  [, output_mode => 'OUTPUT_MODE' ]
)

Input Arguments

Argument Requirement Type Description
input Required String The text content to
: : : : classify. :
categories Required Array<String> A list of target
: : : : categories/labels. :
: : : : Can be :
: : : : ARRAY<STRING> or :
: : : : `ARRAY<STRUCT<STRING, :
: : : : STRING>>` (label, :
: : : : description). :
connection_id Optional String The connection ID to
: : : : use for the LLM. :
endpoint Optional String The model name, e.g.,
: : : : 'gemini-2.5-flash'. :
output_mode Optional String 'single' (default)
: : : : or 'multi'. :
: : : : Determines the output :
: : : : type. :

Output Schema

The output type depends on the output_mode argument:

Output Mode output_mode Value Type Description
Single Label NULL (Default) STRING The single category
: : : : that best fits the :
: : : : input. :
**Single Label 'single' ARRAY<STRING> An array containing
: (Explicit)** : : : exactly one :
: : : : category string. :
Multi Label 'multi' ARRAY<STRING> An array containing
: : : : zero or more :
: : : : matching :
: : : : categories. :

Examples

Classify text into categories

SELECT
  content,
  AI.CLASSIFY(
    content,
    categories => ['Spam', 'Not Spam', 'Urgent'],
    connection_id => 'my-project.us.my-connection'
  ) as classification
FROM `dataset.emails`;

Classify text into multiple topics

SELECT
  title,
  body,
  AI.CLASSIFY(
    body,
    categories => ['tech', 'sport', 'business', 'politics', 'entertainment', 'other'],
    output_mode => 'multi') AS categories
FROM
  `bigquery-public-data.bbc_news.fulltext`
LIMIT 100;

Classify reviews by sentiment

SELECT AI.CLASSIFY( ('Classify the review by sentiment: ', review), categories => [('green', 'The review is positive.'), ('yellow', 'The review is neutral.'), ('red', 'The review is negative.')]) AS ai_review_rating, reviewer_rating AS human_provided_rating, review, FROM bigquery-public-data.imdb.reviews WHERE title = 'The English Patient'

Source: SKILL.md on GitHub

No alerts3mo3 checks · Risk SAFE
  • Gen Agent Trust Hub3mo

    This skill provides a comprehensive interface for BigQuery AI and Machine Learning functions using standard SQL. It includes security considerations regarding the handling of untrusted data within AI-driven queries, which is standard for this type of functionality. Users should apply appropriate data validation when using these features.

  • Socket3mo

    No alerts

  • Snyk3mo

    Risk: LOW · No issues

Signed by skilld at 435f7c7. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 6 months ago
metadata
{
  "author": "google-adk",
  "version": "1.0"
}

README badge

README badge for google/adk-python/bigquery-ai-ml