All skills
google avatar

/bigquery-ai-ml

@d6b9f75
by googlegoogle/skills21k stars
1,698

Leverages BigQuery's built-in machine learning and GenAI capabilities for advanced data analytics. Use when you need to write SQL queries that perform time-series forecasting, predict values, detect outliers or anomalies, find key drivers, perform semantic search or vector search, classify text, calculate similarity, summarize content, translate language, evaluate models, filter by semantic conditions, measure the causal effect of an intervention, compute correlations between columns, detect change points or structural breaks, extract trend or seasonality components, or leverage generative AI capabilities in BigQuery. Do not use for general BigQuery dataset, table, or job management requests.

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

This session only. Nothing lands on disk.

referencesai_similarity.md

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

BigQuery AI.Similarity

AI.SIMILARITY computes the semantic similarity between two inputs.

Use cases include the following:

  • Semantic search: Search for text or images based off a description, without having to match specific keywords.
  • Recommendation: Return entities with attributes similar to a given entity.

Syntax Reference

AI.SIMILARITY(
  content1 => 'CONTENT1',
  content2 => 'CONTENT2'
  [, endpoint => 'ENDPOINT']
  [, model_params => 'MODEL_PARAMS']
  [, connection_id => 'CONNECTION_ID']
)

Input Arguments

Argument Requirement Type Description
content1 Required String or The first text content
: : : ObjectRef : or image context. :
content2 Required String or The second text content
: : : ObjectRef : or image to compare :
: : : : against. :
connection_id Optional String The connection ID to use
: : : : for the LLM. :
endpoint Optional String The model endpoint (e.g.
: : : : 'text-embedding-005'). :
model_params Optional JSON JSON object for model
: : : : parameters (e.g., :
: : : : temperature, :
: : : : max_output_tokens). :

Output Schema

Column Name Type Description
(Scalar Result) FLOAT64 A similarity score (e.g., cosine
: : : similarity). Returns null if error. :

Examples

Compute semantic similarity between two text inputs

SELECT AI.SIMILARITY(
  content1 => 'The cat sat on the mat',
  content2 => 'A feline is resting on the rug'
) as similarity_score;

Compute semantic similarity between text and image

CREATE SCHEMA IF NOT EXISTS cymbal_pets;

CREATE OR REPLACE EXTERNAL TABLE cymbal_pets.product_images
WITH CONNECTION DEFAULT
OPTIONS (
  object_metadata = 'SIMPLE',
  uris = ['gs://cloud-samples-data/bigquery/tutorials/cymbal-pets/images/*.png']
);

SELECT
  uri,
  OBJ.GET_READ_URL(ref) AS signed_url,
  ai.similarity(
    "aquarium device",
    ref,
    endpoint => 'multimodalembedding@001') AS similarity_score
FROM cymbal_pets.product_images
ORDER BY similarity_score DESC
LIMIT 3;

Source: SKILL.md on GitHub

No alerts9d3 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    This skill provides a comprehensive reference for BigQuery's built-in AI and machine learning functions. It includes a security consideration regarding potential indirect prompt injection when processing untrusted data with generative AI functions. These patterns are standard for the intended data analysis use cases and can be managed through proper prompt design and data validation.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: LOW · No issues

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

Last checked against GitHub yesterday.

Activeupdated last week
metadata
{
  "version": "1.1.0",
  "category": "AiAndMachineLearning"
}

README badge

README badge for google/skills/bigquery-ai-ml