bigquery-data-science 0.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bigquery_data_science/__init__.py +58 -0
- bigquery_data_science/_skills/PLANS.md +76 -0
- bigquery_data_science/_skills/bigquery-ai/SKILL.md +66 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_agg.md +528 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_classify.md +450 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_count_tokens.md +180 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_detect_anomalies.md +322 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_embed.md +425 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_evaluate.md +368 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_forecast.md +437 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_generate.md +693 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_generate_bool.md +248 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_generate_double.md +254 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_generate_embedding.md +402 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_generate_int.md +252 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_generate_table.md +447 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_generate_text.md +356 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_if.md +373 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_key_drivers.md +331 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_parse_document.md +416 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_predict.md +559 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_score.md +310 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_search.md +465 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ai_similarity.md +371 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/catalog_search.md +951 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/content_analysis.md +284 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/content_moderation.md +369 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/data_enrichment.md +426 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/document_intelligence.md +470 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/document_rag.md +453 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/image_deduplication.md +770 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/log_analysis.md +668 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/metric_diagnostics.md +568 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ml_annotate_image.md +680 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ml_generate_embedding.md +217 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ml_generate_text.md +223 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ml_process_document.md +392 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ml_transcribe.md +815 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ml_translate.md +600 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/ml_understand_text.md +673 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/multimodal_analysis.md +266 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/rag_pipeline.md +593 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/semantic_search.md +510 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/tabular_prediction.md +485 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/time_series_intelligence.md +489 -0
- bigquery_data_science/_skills/bigquery-ai/narrative/vector_search.md +672 -0
- bigquery_data_science/_skills/bigquery-ai/reference/augmented-analytics.md +77 -0
- bigquery_data_science/_skills/bigquery-ai/reference/cloud-ai-service-models.md +88 -0
- bigquery_data_science/_skills/bigquery-ai/reference/document-processing.md +95 -0
- bigquery_data_science/_skills/bigquery-ai/reference/embeddings-and-search.md +166 -0
- bigquery_data_science/_skills/bigquery-ai/reference/general-purpose-generation.md +87 -0
- bigquery_data_science/_skills/bigquery-ai/reference/managed-functions.md +72 -0
- bigquery_data_science/_skills/bigquery-ai/reference/predictive-ai.md +113 -0
- bigquery_data_science/_skills/bigquery-ai/reference/workflows.md +56 -0
- bigquery_data_science/_skills/bigquery-ai/skill.manifest.json +109 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/INDEX.md +71 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aiagg.md +67 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aicausal_effect-covered-in-bigquery-ml.md +17 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aiclassify.md +72 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aicount_tokens.md +53 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aidetect_anomalies.md +63 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aiembed.md +85 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aievaluate.md +114 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aiforecast.md +123 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aigenerate.md +69 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aigenerate_bool.md +53 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aigenerate_double.md +45 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aigenerate_embedding.md +108 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aigenerate_int.md +45 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aigenerate_table.md +64 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aigenerate_text.md +167 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aiif.md +56 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aikey_drivers.md +76 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aiparse_document.md +91 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aipredict.md +74 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aiscore.md +52 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aisearch.md +66 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/aisimilarity.md +79 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/choosing-between-these-and-the-ai-functions.md +11 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/hybrid-search-capability.md +165 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/mlannotate_image.md +24 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/mlgenerate_embedding.md +34 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/mlgenerate_text.md +65 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/mlprocess_document.md +125 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/mltranscribe.md +26 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/mltranslate.md +27 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/mlunderstand_text.md +32 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/multimodal-input-patterns-by-function.md +128 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/object-tables.md +109 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/objectref-and-objectrefruntime-schema-reference.md +50 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/objfetch_metadata.md +49 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/objget_access_url.md +66 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/objget_read_url.md +40 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/objlist.md +34 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/objmake_ref.md +58 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/per-row-failures-and-the-retry-pattern.md +19 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/setup-apis-connection-roles.md +39 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/two-input-shapes.md +22 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/vector_search.md +78 -0
- bigquery_data_science/_skills/bigquery-ai/syntax/what-the-five-have-in-common.md +27 -0
- bigquery_data_science/_skills/bigquery-data-science/SKILL.md +69 -0
- bigquery_data_science/_skills/bigquery-data-science/reference/namespace-matrix.md +112 -0
- bigquery_data_science/_skills/bigquery-data-science/skill.manifest.json +13 -0
- bigquery_data_science/_skills/bigquery-ml/SKILL.md +70 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/airflow_with_kfp.md +379 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/anomaly_fraud_detection.md +195 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/arima_plus.md +635 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/arima_plus_xreg.md +453 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/autoencoder.md +470 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/automl_classifier.md +291 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/automl_regressor.md +274 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/boosted_tree_classifier.md +449 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/boosted_tree_regressor.md +400 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/bucketizing.md +201 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/causal_effect.md +773 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/churn_retention.md +271 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/cloud_workflows.md +370 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/composer_airflow.md +475 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/contribution_analysis.md +346 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/cross_validation.md +185 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/customer_segmentation.md +233 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/dataform.md +372 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/dbt.md +283 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/difference_in_differences.md +280 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/distance.md +195 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/dnn_classifier.md +326 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/dnn_regressor.md +308 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/embeddings_classification.md +426 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/encoding.md +238 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/ensembling.md +278 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/evaluation.md +445 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/exploration.md +779 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/export.md +321 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/feature_engineering.md +280 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/feature_store.md +652 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/feature_store_workflow.md +426 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/ga4_churn_prediction.md +285 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/hierarchical_forecasting.md +441 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/image.md +791 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/imported.md +426 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/kmeans.md +348 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/linear_regression.md +372 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/logistic_regression.md +390 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/matrix_factorization.md +404 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/model_monitoring.md +609 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/pca.md +357 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/price_elasticity_dml.md +286 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/propensity_score_matching.md +350 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/random_forest_classifier.md +445 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/random_forest_regressor.md +409 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/recommendation.md +281 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/regression_based_forecasting.md +491 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/remote.md +428 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/scalers.md +325 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/scheduled_queries.md +284 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/sql_scripting.md +243 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/survival_analysis.md +363 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/synthetic_control.md +221 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/text.md +215 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/time_series.md +669 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/transform_only.md +273 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/uplift_cate.md +241 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/vertex_kfp.md +360 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/wide_and_deep_classifier.md +316 -0
- bigquery_data_science/_skills/bigquery-ml/narrative/wide_and_deep_regressor.md +298 -0
- bigquery_data_science/_skills/bigquery-ml/reference/classification.md +80 -0
- bigquery_data_science/_skills/bigquery-ml/reference/model-management.md +90 -0
- bigquery_data_science/_skills/bigquery-ml/reference/preprocessing-functions.md +234 -0
- bigquery_data_science/_skills/bigquery-ml/reference/regression.md +79 -0
- bigquery_data_science/_skills/bigquery-ml/reference/unsupervised-and-specialized.md +101 -0
- bigquery_data_science/_skills/bigquery-ml/reference/workflows-and-pipelines.md +111 -0
- bigquery_data_science/_skills/bigquery-ml/skill.manifest.json +177 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/1-model_type-catalog.md +28 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/2-task-mlevaluate-metric-columns.md +26 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/3-capability-matrix-per-model-type.md +21 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/4-explainability-weights-functions.md +14 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/5-connection-matrix.md +11 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/6-which-model-free-function-no-create-model-no-connection.md +15 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/7-point-in-time-feature-retrieval-which-of-the-two.md +11 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/INDEX.md +111 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/aicausal_effect.md +85 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/arima_plus-forecasting-lifecycle-functions.md +14 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/arima_plus-univariate-time-series-forecasting.md +132 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/arima_plus_xreg-multivariate-time-series-with-external-regressors.md +103 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/autoencoder.md +102 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/automl_classifier-automl_regressor.md +88 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/boosted_tree_classifier-boosted_tree_regressor.md +117 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/contribution_analysis.md +113 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/dnn_classifier-dnn_regressor.md +107 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/dnn_linear_combined_classifier-dnn_linear_combined_regressor-wide-and-deep.md +98 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/explainability-functions-mlexplain_predict-mlglobal_explain-mlfeature_importance.md +7 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/exploratory-data-analysis-mldescribe_data-mlcorrelation.md +11 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/export-model.md +92 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/feature-engineering-standalone-preprocessing-functions.md +13 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/image-preprocessing-functions-mldecode_image-mlresize_image-mlconvert_image_type-mlconvert_color_space.md +63 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/imported-models-tensorflow-tensorflow_lite-onnx-xgboost.md +36 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/kmeans.md +87 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/linear_reg-logistic_reg-generalized-linear-models.md +101 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/matrix_factorization.md +162 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mladvanced_weights.md +76 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlarima_coefficients.md +30 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlarima_evaluate.md +49 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlbag_of_words.md +47 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlbucketize.md +47 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlcentroids.md +46 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlconfusion_matrix.md +56 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlconvert_color_space.md +53 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlconvert_image_type.md +39 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlcorrelation.md +78 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mldecode_image.md +44 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mldescribe_data.md +74 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mldetect_anomalies.md +86 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mldistance.md +48 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlentity_features_at_time.md +56 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlevaluate.md +72 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlexplain_forecast.md +50 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlexplain_predict.md +66 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlfeature_cross.md +46 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlfeature_importance.md +47 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlfeature_info.md +50 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlfeatures_at_time.md +51 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlforecast.md +76 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlgenerate_embedding-from-a-bqml-pca-autoencoder-matrix_factorization-model.md +64 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlglobal_explain.md +63 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlhash_bucketize.md +47 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlholiday_info.md +46 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlimputer.md +46 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mllp_norm.md +47 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlmetrics.md +80 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlngrams.md +37 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlone_hot_encoder-mlmulti_hot_encoder-mllabel_encoder.md +67 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlpolynomial_expand.md +47 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlpredict.md +67 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlprincipal_component_info.md +42 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlprincipal_components.md +40 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlquantile_bucketize.md +43 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlrecommend.md +60 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlreconstruction_loss.md +48 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlresize_image.md +45 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlroc_curve.md +63 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mltf_idf.md +37 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mltfdv_describe.md +34 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mltfdv_validate.md +48 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mltraining_info.md +78 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mltransform-applying-a-saved-transform.md +52 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mltranspose-not-a-function-pointer.md +32 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mltrial_info.md +60 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlvalidate_data_drift.md +99 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlvalidate_data_skew.md +50 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/mlweights.md +84 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/model-free-time-series-decomposition-mltrend-mlseasonality-mldetect_change_points.md +100 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/model-introspection-mlfeature_info-mltraining_info-mltrial_info.md +7 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/model-monitoring-data-validation.md +23 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/numerical-scalers-mlstandard_scaler-mlmin_max_scaler-mlmax_abs_scaler-mlrobust_scaler-mlnormalizer.md +77 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/onnx.md +55 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/pca.md +91 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/point-in-time-feature-retrieval-mlfeatures_at_time-mlentity_features_at_time.md +25 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/quick-comparison.md +14 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/random_forest_classifier-random_forest_regressor.md +123 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/remote-remote-model-over-a-vertex-ai-endpoint-the-mechanism.md +87 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/tensorflow.md +48 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/tensorflow_lite.md +29 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/text-preprocessing-functions-mlngrams-mltf_idf-mlbag_of_words.md +18 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/timesfm-built-in-foundation-forecaster-see-bigquery-ai.md +28 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/transform_only.md +91 -0
- bigquery_data_science/_skills/bigquery-ml/syntax/xgboost.md +72 -0
- bigquery_data_science/_skills/pinned-models.json +28 -0
- bigquery_data_science/catalog.py +1107 -0
- bigquery_data_science/cli.py +786 -0
- bigquery_data_science/installer.py +282 -0
- bigquery_data_science/mcp_server.py +317 -0
- bigquery_data_science/tooling/__init__.py +15 -0
- bigquery_data_science/tooling/convert_notebook.py +176 -0
- bigquery_data_science/tooling/link_policy.py +247 -0
- bigquery_data_science/tooling/manifest.py +152 -0
- bigquery_data_science/tooling/markdown_anchors.py +84 -0
- bigquery_data_science/tooling/narrative_drift.py +163 -0
- bigquery_data_science/tooling/pinned_models.py +216 -0
- bigquery_data_science/tooling/reference_structure.py +85 -0
- bigquery_data_science/tooling/sync_syntax.py +407 -0
- bigquery_data_science/tooling/validate.py +208 -0
- bigquery_data_science-0.7.0.dist-info/METADATA +306 -0
- bigquery_data_science-0.7.0.dist-info/RECORD +286 -0
- bigquery_data_science-0.7.0.dist-info/WHEEL +4 -0
- bigquery_data_science-0.7.0.dist-info/entry_points.txt +5 -0
- bigquery_data_science-0.7.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Managed Classification & Scoring Functions in BigQuery
|
|
2
|
+
|
|
3
|
+
Contents: [Options](#options) · [Choosing among them](#choosing-among-them) · [Gotchas verified in this repo](#gotchas-verified-in-this-repo) · [Canonical snippet](#canonical-snippet) · [Go deeper](#go-deeper)
|
|
4
|
+
|
|
5
|
+
## Options
|
|
6
|
+
|
|
7
|
+
| Function | What it does | Use this when... | Key differentiator |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| `AI.IF` | Evaluates a natural-language condition, returns a plain BOOL | You need a fuzzy/semantic boolean test — a `WHERE` filter, a `JOIN` condition, or a branch — expressed in plain English | Returns BOOL directly (not a struct); relates to `AI.GENERATE_BOOL` but with automatic prompt optimization and less control |
|
|
10
|
+
| `AI.SCORE` | Rates/ranks input against a scale you describe, returns a FLOAT64 | You need a numeric quality/relevance/priority score to sort or threshold on (e.g. "most negative review", "best resume") | Auto-generates a scoring rubric from your prompt; no fixed default range — you must state the scale in the prompt |
|
|
11
|
+
| `AI.CLASSIFY` | Buckets input into a fixed, user-supplied category list, returns STRING or ARRAY<STRING> | You know the category set in advance and want single- or multi-label classification without writing an `output_schema` | Only managed function with no general-purpose counterpart; categories can carry descriptions and few-shot examples |
|
|
12
|
+
| `AI.AGG` | Aggregate function (like `SUM`/`COUNT`) that summarizes/synthesizes many rows per group into one STRING | You need a GROUP BY-level synthesis (sentiment across all reviews for a product, a summary of a log group) that may exceed a single prompt's context window | Only aggregate function of the four; auto-batches multi-level so it can process data beyond the Gemini context window |
|
|
13
|
+
|
|
14
|
+
## Choosing among them
|
|
15
|
+
|
|
16
|
+
- **"I want to filter/branch on a fuzzy condition."** → `AI.IF`. Put ordinary (non-AI) filters in the same `WHERE` clause alongside it — BigQuery evaluates non-AI filters first and short-circuits, which reduces the number of billed Gemini calls (e.g. `WHERE AI.IF(...) AND category = 'tech'`).
|
|
17
|
+
|
|
18
|
+
- **"I want a numeric quality/relevance/priority score."** → `AI.SCORE`. State the scale explicitly in the prompt (e.g. "rate 1–10") since there is no fixed default range. Commonly paired with `ORDER BY ... LIMIT` for ranking, and can be combined with `AI.IF` to pre-filter before scoring.
|
|
19
|
+
|
|
20
|
+
- **"I want to bucket rows into known categories."** → `AI.CLASSIFY`. Pass `categories` as an `ARRAY<STRING>` (bare labels) or `ARRAY<STRUCT<STRING,STRING>>` (label + description, for more nuanced classification). Use `output_mode => 'multi'` for multi-label problems (returns 0..N categories, empty array if none apply); leave it unset or `'single'` for one best-fit label. Categories can also come from a table via a `DECLARE ... ARRAY<STRING> DEFAULT (SELECT ARRAY_AGG(...))` variable rather than a hardcoded literal.
|
|
21
|
+
|
|
22
|
+
- **"I want to summarize/synthesize across many rows in a group."** → `AI.AGG(input, instruction [, connection_id =>][, endpoint =>])`, used with `GROUP BY` for per-group results or without it to aggregate the whole table into one STRING. Use `DISTINCT` to dedupe inputs and cut token usage. Prefer it over hand-rolling `STRING_AGG`/`ARRAY_AGG` into an `AI.GENERATE` prompt — `AI.AGG` batches automatically and can exceed the context window that a manual concatenation would blow past.
|
|
23
|
+
|
|
24
|
+
- **Managed vs. raw `AI.GENERATE`:** all four managed functions are Preview, DSQ-only (no Provisioned Throughput), auto-select a cost/quality-optimized model when no `endpoint` is given, return `NULL` on error (no detailed status/full_response), and give up model-parameter control (temperature, top_p, etc.). Prefer them when the task fits their shape (boolean test, single score, fixed category set, group summary) and you want BigQuery's automatic prompt engineering rather than hand-writing prompts. Drop down to `AI.GENERATE` (with `output_schema` if needed) when you need: model parameter control, a non-default/pinned model via `endpoint` with fine-grained `model_params`, Provisioned Throughput, detailed `full_response`/`status` for debugging, or an output shape (multi-field structured record) that doesn't map onto BOOL/FLOAT64/STRING/ARRAY<STRING>. `AI.GENERATE_BOOL`/`AI.GENERATE_DOUBLE` are the direct general-purpose analogs of `AI.IF`/`AI.SCORE` respectively when you need that extra control.
|
|
25
|
+
|
|
26
|
+
## Gotchas verified in this repo
|
|
27
|
+
|
|
28
|
+
- All four functions are **Preview** status — expect the "contact bqml-feedback@google.com" support model, not GA stability guarantees.
|
|
29
|
+
- None of the four support model-parameter control (temperature, top_p, thinking budget, etc.) — that control only exists on the general-purpose siblings (`AI.GENERATE`, `AI.GENERATE_BOOL/DOUBLE/INT`, `AI.GENERATE_TEXT`).
|
|
30
|
+
- `AI.CLASSIFY` categories must be **string literals in the array** (or a `DECLARE`d variable) — you cannot pass a column reference directly as the categories argument; if categories are dynamic per-row, this is a hard modeling constraint to plan around.
|
|
31
|
+
- `AI.CLASSIFY`'s `output_mode => 'multi'` is explicitly **not supported** when `optimization_mode` is set (the `MINIMIZE_COST`/`MAXIMIZE_QUALITY` optimized path) — multi-label classification and cost-optimized embeddings mode are mutually exclusive.
|
|
32
|
+
- `optimization_mode` (on `AI.IF` and `AI.CLASSIFY`) requires roughly **3,000 rows minimum** to be effective, and in optimized mode only string columns are supported for multi-column prompts/inputs — this is a distilled local-model path (`MINIMIZE_COST`, up to ~230x token reduction) that only pays off at that scale.
|
|
33
|
+
- `max_error_ratio` (available on `AI.IF`, `AI.SCORE`, `AI.CLASSIFY`) is **not supported** when `optimization_mode` is `MINIMIZE_COST` — you lose that safety valve in the cost-optimized path.
|
|
34
|
+
- `AI.AGG` has documented **known issues**: rows with 10+ images in a single row may be silently skipped; rows containing arrays of `ObjectRefRuntime` values (via `OBJ.GET_ACCESS_URL`) may be skipped — **an argument for passing a bare `ObjectRef`, which sidesteps the issue entirely and is what the other eleven functions now document**, even though `AI.AGG`'s own page is the last one still specifying `ObjectRefRuntime`; Workforce Identity Federation without an explicit connection can fail long-running queries; Gemini 3.0/3.1 with connection-based auth may intermittently return unauthenticated errors.
|
|
35
|
+
- `AI.AGG` output is capped at **10,000 tokens per group**, and the docs recommend staying under 20 million rows and 1,000 distinct groups per query to avoid timeouts — and it cannot use Gemini models that require a thinking budget.
|
|
36
|
+
- `AI.AGG`'s actual processed-row count can diverge from expectations on complex queries (JOINs, `ORDER BY ... LIMIT`) — materialize the intended input to a separate table first if you need predictable, auditable row counts/costs.
|
|
37
|
+
- `AI.SCORE` has **no fixed default score range** — omitting an explicit scale in the prompt (e.g. "1 to 10") produces inconsistent, hard-to-compare ranges across calls; always state the scale.
|
|
38
|
+
- None of the four managed functions support `DISTINCT` or `GROUP BY` except `AI.AGG` (which supports both, being the one aggregate in the family) — attempting to use the scalar three (`AI.IF`, `AI.SCORE`, `AI.CLASSIFY`) as if they were aggregates will not work since they operate strictly row by row.
|
|
39
|
+
- Row-count ceiling is **10,000,000 rows per job** for `AI.IF`/`AI.SCORE`/`AI.CLASSIFY`, versus a (recommended, not hard) **20,000,000** for `AI.AGG` — plan batch sizing accordingly, especially since none of these support Provisioned Throughput (DSQ only), so large jobs compete for shared quota.
|
|
40
|
+
|
|
41
|
+
## Canonical snippet
|
|
42
|
+
|
|
43
|
+
```sql
|
|
44
|
+
SELECT
|
|
45
|
+
ticket_id,
|
|
46
|
+
ticket_text,
|
|
47
|
+
AI.CLASSIFY(
|
|
48
|
+
input => ticket_text,
|
|
49
|
+
categories => [
|
|
50
|
+
('billing', 'questions or disputes about charges, invoices, or refunds'),
|
|
51
|
+
('technical', 'product bugs, errors, or how-to questions'),
|
|
52
|
+
('account', 'login, password, or account-access issues'),
|
|
53
|
+
('other', 'anything that does not clearly fit the above')
|
|
54
|
+
]
|
|
55
|
+
) AS category
|
|
56
|
+
FROM `my_project.my_dataset.support_tickets`;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This uses category descriptions (not just bare labels) for more nuanced classification and includes an explicit "other" bucket to catch inputs that don't closely match any defined category.
|
|
60
|
+
|
|
61
|
+
## Go deeper
|
|
62
|
+
|
|
63
|
+
Full extracted notebook walkthroughs live in this skill's `narrative/` folder — no need to be inside the source repo:
|
|
64
|
+
|
|
65
|
+
- [`narrative/ai_if.md`](../narrative/ai_if.md) (source: `functions/ai_if/`)
|
|
66
|
+
- [`narrative/ai_score.md`](../narrative/ai_score.md) (source: `functions/ai_score/`)
|
|
67
|
+
- [`narrative/ai_classify.md`](../narrative/ai_classify.md) (source: `functions/ai_classify/`)
|
|
68
|
+
- [`narrative/ai_agg.md`](../narrative/ai_agg.md) (source: `functions/ai_agg/`)
|
|
69
|
+
|
|
70
|
+
Full syntax/options tables: see the source repo at `bigquery-ai/reference/managed-functions.md`, indexed from `bigquery-ai/RESOURCES.md`.
|
|
71
|
+
|
|
72
|
+
**Lens 3 per-statement syntax cards (`syntax/`):** [`syntax/INDEX.md`](../syntax/INDEX.md) — [`syntax/aiif.md`](../syntax/aiif.md), [`syntax/aiscore.md`](../syntax/aiscore.md), [`syntax/aiclassify.md`](../syntax/aiclassify.md), [`syntax/aiagg.md`](../syntax/aiagg.md)
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Predictive AI in BigQuery AI Functions
|
|
2
|
+
|
|
3
|
+
Contents: [Options](#options) · [Choosing among them](#choosing-among-them) · [Gotchas verified in this repo](#gotchas-verified-in-this-repo) · [Canonical snippets](#canonical-snippets) · [Go deeper](#go-deeper)
|
|
4
|
+
|
|
5
|
+
Zero-training prediction from two pre-trained foundation models: **TimesFM** for time series (`AI.FORECAST`, `AI.DETECT_ANOMALIES`, and the forecast branch of `AI.EVALUATE`) and **TabFM** for tabular rows (`AI.PREDICT`, and the tabular branch of `AI.EVALUATE`). Neither requires `CREATE MODEL`, a connection, an endpoint, or any persisted model object. TimesFM comes in two versions — 2.5 (default) and 3.0 (Preview), the latter adding multivariate forecasting with covariates to `AI.FORECAST`.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Options
|
|
9
|
+
|
|
10
|
+
| Function | What it does | Use this when |
|
|
11
|
+
|----------|---------------|----------------|
|
|
12
|
+
| `AI.FORECAST` | Zero-training time series forecasting on TimesFM. Returns forecasted values, confidence intervals, and optionally the historical series alongside the forecast. With `model => 'TimesFM 3.0'` (Preview): several targets at once via `target_cols`, plus `past_covariate_cols` / `future_covariate_cols`. | You want a quick forecast of future values with no `CREATE MODEL` step, no connection, no training — including one that uses related series or a known future calendar. |
|
|
13
|
+
| `AI.DETECT_ANOMALIES` | Builds a TimesFM forecast baseline from historical data, then compares a separate target dataset against that baseline to flag anomalous points with a probability score. | You want to flag outliers/anomalies in a series (or across many series via `id_cols`) against expected behavior. |
|
|
14
|
+
| `AI.PREDICT` | Zero-shot regression **or** classification on tabular rows using TabFM, a pre-trained tabular foundation model. Learns in-context from a training relation at query time; nothing is fitted or stored. | You want a prediction on structured rows immediately, with no training step — a baseline, a one-off, or a gap-fill on a column. |
|
|
15
|
+
| `AI.EVALUATE` | **Two distinct branches.** Forecast branch: generates a TimesFM forecast from history and scores it against actuals (MAE, MSE, RMSE, MAPE, sMAPE, MASE). Tabular branch: scores an `AI.PREDICT`-shaped call by passing `label_col`. | You want to score a forecast, benchmark context-window configurations, or measure TabFM accuracy on held-out rows. |
|
|
16
|
+
|
|
17
|
+
## Choosing among them
|
|
18
|
+
|
|
19
|
+
- **"I want a quick forecast with no model training"** → `AI.FORECAST`. Real limits vs. BigQuery ML's `ARIMA_PLUS`: no custom holiday effects, no hierarchical reconciliation, no `ML.EXPLAIN_FORECAST`-style decomposition, and no direct control over forecast bounds beyond `confidence_level`. External regressors are **no longer** on that list — TimesFM 3.0's `past_covariate_cols` / `future_covariate_cols` cover them (Preview; horizon capped at 1,024, context at 2,048 points), so the `ARIMA_PLUS_XREG` vs `AI.FORECAST` call is now about control and explainability, not about whether covariates are possible. It's a fixed-architecture foundation model, not a trainable per-series statistical model.
|
|
20
|
+
- **"I want to flag outliers/anomalies in a series"** → `AI.DETECT_ANOMALIES`. It requires two inputs (a history table to build the baseline forecast, and a target table to test) with matching schemas — a materially different shape than `AI.FORECAST`'s single-input call.
|
|
21
|
+
- **"I want to know where the series *changed*, not which points are odd"** → neither of the above. `ML.DETECT_CHANGE_POINTS` (sibling `bigquery-ml` skill, Preview 2026-08-20) finds windows where the level shifted *and stayed shifted*, with no model and no forecast baseline; `ML.TREND`/`ML.SEASONALITY` decompose the series the same way. A spike that returns to normal the next day is an anomaly and not a change point; a permanent step up in volume is a change point that may never register as an anomaly. Measured on one shared series: 79 row-level `AI.DETECT_ANOMALIES` hits against 2 change windows, **zero overlap** — orthogonal detectors, not two sensitivities of one. Caveat before recommending it: all three of those TVFs gap-fill each series to its own span first, so on a series with a data outage the interpolation manufactures the structural break they then report. Profile the gaps first.
|
|
22
|
+
- **"I want to predict a column on structured rows"** → `AI.PREDICT`. Task type is inferred from the label column's **type**, not from a parameter (see gotchas — this is the single easiest thing to get wrong).
|
|
23
|
+
- **"I want to score how good a prediction was"** → `AI.EVALUATE`, but pick the right branch. Passing forecast-shaped and tabular-shaped arguments together fails.
|
|
24
|
+
- **When to reach for `../../bigquery-ml/` instead:** you need training-time control, scheduled retraining, interpretable coefficients, or a model artifact you can version and serve. `ARIMA_PLUS` is BQML's trainable alternative to `AI.FORECAST`; `LINEAR_REG`/`LOGISTIC_REG`/`BOOSTED_TREE_*` are the trainable alternatives to `AI.PREDICT`.
|
|
25
|
+
|
|
26
|
+
## Gotchas verified in this repo
|
|
27
|
+
|
|
28
|
+
### TimesFM (forecasting)
|
|
29
|
+
|
|
30
|
+
- **Two model versions, one default — pin it.** All three TimesFM functions default to `TimesFM 2.5` and accept `model => 'TimesFM 3.0'` (Preview). Measured with the cache off: an unpinned call and `'TimesFM 2.5'` agree to the last digit. The default has moved before without a release note, so **pin `model` explicitly**. Multivariate `AI.FORECAST` *requires* `model => 'TimesFM 3.0'` — omit it and the call fails with the generic `Invalid table-valued function AI.FORECAST`, not a message naming the cause. TimesFM 3.0 moves to token-based pricing on 2026-12-01.
|
|
31
|
+
- **Pinning is not the same as reproducibility, and for two of the three functions it does not deliver it.** `AI.EVALUATE` and `AI.DETECT_ANOMALIES` return a different answer on a minority of runs even with `model` **and** `context_window` both pinned and the query cache off. Measured on a deterministic synthetic series: 2 of 16 `AI.EVALUATE` runs returned `mean_absolute_error` `0.5913808905590097` where the other 14 returned `0.8652198481135486` — a ~32% swing, roughly 1 in 8. The **majority value is the correct one**: it equals MAE computed by hand from `AI.FORECAST` output over the same history and horizon. `AI.FORECAST` is steadier but not bit-stable: 10 pinned `TimesFM 2.5` runs gave 2 distinct vectors (9 + 1) differing in the third significant figure, 10 `TimesFM 3.0` runs gave 2 (7 + 3) differing only from the seventh. Not explained by the context window (every legal value swept), horizon truncation, or version mixing — it occurs on every version tested. **The mechanism is unknown; do not offer one.** Advise materializing the metric once and reading the stored table rather than re-running the function, and recomputing from `AI.FORECAST` output with ordinary SQL when a number has to be defensible.
|
|
32
|
+
- **When testing any of this yourself, the query cache will lie to you.** Re-running identical SQL returns the cached first result, so an unstable function looks perfectly stable; changing only the `SELECT` list creates a different cache entry, so two "identical" loops can disagree for reasons unrelated to the model. Several variants in one `UNION ALL` mislead the same way — three TimesFM variants in one query returned three distinct values where isolated jobs showed two of them bit-identical. Run **one variant per job with `--nouse_cache`**, compare *value sets* over ~10 runs rather than single draws, and cross-check against a function that is deterministic.
|
|
33
|
+
- **BigFrames lags the SQL surface here.** `bigframes.bigquery.ai.forecast()` (2.39.0) still hardcodes `model="TimesFM 2.0"` — a version the SQL reference page no longer lists. The unpinned wrapper call still executes (measured 2026-10-09) but runs a different model than SQL's default, and the wrapper has no `target_cols` or covariate arguments. Pass `model` explicitly; use SQL for the multivariate form.
|
|
34
|
+
- **Limits differ by version.** `horizon` range is `[1, 10000]` on 2.5 and `[1, 1024]` on 3.0; max context is 15,360 points on 2.5 and 2,048 on 3.0, with older points silently ignored rather than erroring. `context_window` on 2.5 must be one of 64/128/256/512/1024/2048/4096/8192/15360 (off-grid values rejected) and defaults to the smallest window covering the input; on 3.0 it is any multiple of 32 from 64 to 2048, **defaults to the maximum**, and an off-grid value such as `100` is *accepted* rather than rejected — stay on the grid if you want to know what the model saw. Every rejection is the same generic `Invalid table-valued function` error.
|
|
35
|
+
- `AI.FORECAST` and `AI.EVALUATE` have wildly different default horizons — 10 vs. 1024 — despite sharing the same `horizon` parameter. `AI.DETECT_ANOMALIES` silently caps evaluation at the most recent 1,024 target points. All three require a **minimum of 3 data points**.
|
|
36
|
+
- **Multivariate output is restructured** (TimesFM 3.0, `target_cols`): the timestamp column keeps its *input* name instead of becoming `forecast_timestamp`, each target becomes a `STRUCT<value, prediction_interval_lower_bound, prediction_interval_upper_bound>` under its own name, and `time_series_type` is always present. With `future_covariate_cols`, supply one input row per future timestamp — targets NULL, covariates populated — because **`horizon` is silently capped by the future rows present** (30 requested with 14 rows returns 14) and defaults to 10 even when more rows exist. A past covariate alone needs no future rows. `data_col` plus a covariate argument is rejected. `forecast_end_timestamp` works on this form although the documented syntax omits it. `AI.EVALUATE` has no `target_cols` — score a multivariate forecast one target at a time.
|
|
37
|
+
- `AI.FORECAST`'s output schema changes shape entirely based on `output_historical_time_series`: `FALSE` gives `forecast_timestamp`/`forecast_value`/bounds; `TRUE` gives a unioned `time_series_type` ('history'/'forecast') + `time_series_data` column instead, with bounds NULL for historical rows.
|
|
38
|
+
- Each TimesFM function emits a per-row status column (`ai_forecast_status`, `ai_detect_anomalies_status`, `ai_evaluate_status`) holding the error string on failure — check it per-row, since partial failures (one bad series among many `id_cols`) surface there rather than failing the query. **The three columns are not consistent about what "success" looks like** (verified live 2026-09-02): `ai_evaluate_status` and `ai_detect_anomalies_status` return **`NULL`** on success, while `ai_forecast_status` returns a genuine **zero-length empty string**. So `WHERE ai_evaluate_status = ''` matches nothing, and `WHERE ai_evaluate_status <> ''` silently drops **every successful row** — the `NULL` comparison is unknown, not true. **Filter with `IS NOT NULL` / `IS NULL`**, which is correct for all three.
|
|
39
|
+
- `horizon` and `forecast_end_timestamp` are mutually exclusive on `AI.FORECAST`.
|
|
40
|
+
|
|
41
|
+
### TabFM (`AI.PREDICT`)
|
|
42
|
+
|
|
43
|
+
- **Task type comes from the label column's type, not a parameter.** A categorical label encoded as `INT64` silently trains a *regression* and returns a continuous number instead of a class. Cast coded categoricals to `STRING` before passing them.
|
|
44
|
+
- **Output is not deterministic, and `FARM_FINGERPRINT` does not fix it.** A deterministic split pins *which rows* train and predict; it does nothing to the predictions. Repeating a byte-identical `AI.PREDICT` call returns slightly different numbers, consistent with the model averaging shuffled ensemble passes (`n_ensembles`, value undocumented). Measured: regression MAE 236.52 / 236.35 / 235.84 and classification accuracy 0.9468 / 0.9362 / 0.9468 across repeated identical runs — under 1% regression drift, about 1pp on classification. Consequence: `AI.EVALUATE` scores its *own* fresh predictions, not the rows you materialized, so its metrics will not match a recomputation from your stored prediction table. **Materialize predictions once and join to them; never re-run to reproduce a number.** Drift is input-dependent — a 6-row prediction relation reproduced exactly across two runs — so no observed drift on a tiny input is not evidence of determinism.
|
|
45
|
+
- **Large training relations fail on query memory, not on a documented cap.** The error is `resourcesExceeded` — *"The query could not be executed in the allotted memory. Peak usage: 124% of limit"*, with 91% of that usage reported as `other/unattributed`. Measured on a two-feature relation whose *prediction* side was only 2 rows, so the training relation alone drives it: 1,000 rows OK (44s), 5,000 OK (82s), 8,000 OK (70s), 10,000 fails, 50,000 fails, 200,000 fails. Failures burn ~1.37M slot_ms before dying versus ~210K for a run that succeeds. All measured **on-demand with no reservation**; untested under an Enterprise reservation, where the memory limit may differ. Size the training relation with this ceiling in mind and expect it to move with pricing model and column count.
|
|
46
|
+
- Hard limits: **50 feature columns** (raised from 20; measured 2026-10-12 — 50 runs, 51 fails naming the cap) and **10 classes** for classification. Exceeding either errors at analysis time, before any inference is billed.
|
|
47
|
+
- **Only six column types are accepted** (`STRING`, `BOOL`, `INT64`, `FLOAT64`, `NUMERIC`, `BIGNUMERIC`). `DATE`, `TIMESTAMP`, `BYTES`, `JSON`, `GEOGRAPHY`, `ARRAY`, and `STRUCT` are all rejected — extract date parts to `INT64` (e.g. `EXTRACT(MONTH FROM d)`) before passing them.
|
|
48
|
+
- `label_col` defaults to a column literally named `label`; pass it explicitly otherwise.
|
|
49
|
+
- **The documentation has a bug here:** the reference page says passthrough columns come from the *training* table. Observed behavior returns the *prediction* rows. Trust the behavior.
|
|
50
|
+
- Latency is 30–95s per call. A notebook with several `AI.PREDICT` examples is a multi-minute run, not an interactive one.
|
|
51
|
+
- Pricing (effective 2026-10-30) is token-based on a formula, not per-row: `input_tokens = (train_rows * columns + predict_rows * (columns - 1)) * n_ensembles`, `output_tokens = predict_rows * n_ensembles`, at $0.05/mtok in and $0.20/mtok out. Training-relation size drives cost on *every* call, since there is no reusable fitted model.
|
|
52
|
+
- There is **no BigFrames wrapper** — no `bbq.ai.predict`. Use `read_gbq_query` with the SQL.
|
|
53
|
+
|
|
54
|
+
### `AI.EVALUATE` across both branches
|
|
55
|
+
|
|
56
|
+
- **The two branches are mutually exclusive** — mixing forecast-shaped and tabular-shaped arguments in one call errors. Choose by which model family you are scoring.
|
|
57
|
+
- The tabular branch is just `AI.PREDICT`'s two relations plus `label_col`; the correspondence is exact, which makes it easy to score a prediction you already wrote.
|
|
58
|
+
- **Only the TimesFM branch returns `ai_evaluate_status`.** The tabular branch's output has no status column — don't write a per-row status check against it.
|
|
59
|
+
- The tabular branch returns **no `log_loss`, no `roc_auc`, and no confusion matrix** for classification. If you need those, use BigQuery ML's `ML.EVALUATE` on a trained classifier instead.
|
|
60
|
+
- **The label column's TYPE silently decides what `precision`/`recall`/`f1_score` mean, and nothing in the output says which convention you got.** A `BOOL` `label_col` is scored **binary** — the positive (`TRUE`) class alone. The `STRING` rendering of the identical values is scored **multiclass and macro-averaged**, even at two classes. `accuracy` is the same either way. Measured on one imbalanced problem (12 positives of 62 rows; TabFM confusion matrix TP 12 / FP 11 / FN 0 / TN 39): `BOOL` returned precision `0.5217` and recall `1.0`, `STRING` returned `0.7609` and `0.89` — the two-class means. Four isolated runs of each agreed. **This is a BigQuery-wide convention rather than an `AI.EVALUATE` behavior** — BigQuery ML's `ML.METRICS` follows the identical rule, measured side by side (see the sibling `bigquery-ml` skill's `narrative/evaluation.md`). On balanced data the two nearly coincide, which is how it hides until the classes are lopsided; fix the type deliberately and say which convention a published number uses.
|
|
61
|
+
|
|
62
|
+
## Canonical snippets
|
|
63
|
+
|
|
64
|
+
```sql
|
|
65
|
+
-- TimesFM: forecast a daily series
|
|
66
|
+
SELECT *
|
|
67
|
+
FROM AI.FORECAST(
|
|
68
|
+
(SELECT date, daily_bike_trips FROM `project.dataset.bike_trips_daily`),
|
|
69
|
+
data_col => 'daily_bike_trips',
|
|
70
|
+
timestamp_col => 'date',
|
|
71
|
+
model => 'TimesFM 2.5', -- pin it; the default has moved before
|
|
72
|
+
horizon => 14,
|
|
73
|
+
confidence_level => 0.90
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
-- TimesFM 3.0 (Preview): one target, a past covariate, two future covariates.
|
|
77
|
+
-- The input holds 14 future rows with daily_sales NULL and the future covariates filled.
|
|
78
|
+
SELECT date, daily_sales.value, daily_sales.prediction_interval_lower_bound, daily_sales.prediction_interval_upper_bound
|
|
79
|
+
FROM AI.FORECAST(
|
|
80
|
+
TABLE `project.dataset.sales_with_covariates`,
|
|
81
|
+
target_cols => ['daily_sales'], timestamp_col => 'date', model => 'TimesFM 3.0', horizon => 14,
|
|
82
|
+
past_covariate_cols => ['web_visits'], future_covariate_cols => ['promo_flag', 'is_weekend']
|
|
83
|
+
);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```sql
|
|
87
|
+
-- TabFM: zero-shot prediction, no CREATE MODEL anywhere
|
|
88
|
+
SELECT *
|
|
89
|
+
FROM AI.PREDICT(
|
|
90
|
+
(SELECT species, island, culmen_length_mm, body_mass_g
|
|
91
|
+
FROM `bigquery-public-data.ml_datasets.penguins` WHERE body_mass_g IS NOT NULL),
|
|
92
|
+
(SELECT species, island, culmen_length_mm
|
|
93
|
+
FROM `bigquery-public-data.ml_datasets.penguins` WHERE body_mass_g IS NULL),
|
|
94
|
+
label_col => 'body_mass_g'
|
|
95
|
+
);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Go deeper
|
|
99
|
+
|
|
100
|
+
Full extracted notebook walkthroughs live in this skill's `narrative/` folder:
|
|
101
|
+
|
|
102
|
+
- [`narrative/ai_forecast.md`](../narrative/ai_forecast.md) (source: `functions/ai_forecast/`) — cross-linked bidirectionally with bigquery-ml's arima_plus, the trainable alternative, for a direct side-by-side comparison
|
|
103
|
+
- [`narrative/ai_detect_anomalies.md`](../narrative/ai_detect_anomalies.md) (source: `functions/ai_detect_anomalies/`)
|
|
104
|
+
- [`narrative/ai_predict.md`](../narrative/ai_predict.md) (source: `functions/ai_predict/`)
|
|
105
|
+
- [`narrative/ai_evaluate.md`](../narrative/ai_evaluate.md) (source: `functions/ai_evaluate/`) — covers both branches
|
|
106
|
+
- [`narrative/time_series_intelligence.md`](../narrative/time_series_intelligence.md) — the TimesFM functions composed end-to-end
|
|
107
|
+
- [`narrative/tabular_prediction.md`](../narrative/tabular_prediction.md) — the TabFM functions composed end-to-end, with a head-to-head against trained BigQuery ML models
|
|
108
|
+
|
|
109
|
+
The `bigquery-ml` skill's `narrative/arima_plus.md` has the other half of the `AI.FORECAST` vs. `ARIMA_PLUS` comparison.
|
|
110
|
+
|
|
111
|
+
Full syntax/options tables: see the source repo at `bigquery-ai/reference/predictive-ai.md`, indexed from `bigquery-ai/RESOURCES.md`.
|
|
112
|
+
|
|
113
|
+
**Lens 3 per-statement syntax cards (`syntax/`):** [`syntax/INDEX.md`](../syntax/INDEX.md) — [`syntax/aiforecast.md`](../syntax/aiforecast.md), [`syntax/aidetect_anomalies.md`](../syntax/aidetect_anomalies.md), [`syntax/aipredict.md`](../syntax/aipredict.md), [`syntax/aievaluate.md`](../syntax/aievaluate.md)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Composed Workflows in BigQuery AI Functions
|
|
2
|
+
|
|
3
|
+
Contents: [Choosing a starting template](#choosing-a-starting-template) · [Go deeper](#go-deeper)
|
|
4
|
+
|
|
5
|
+
Individual functions rarely answer a real business question alone. These 14 workflows compose several functions into a genuine end-to-end task — use them as worked patterns to copy from, not just a function catalog.
|
|
6
|
+
|
|
7
|
+
| Workflow | Functions used | What it does |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `data_enrichment` | `AI.GENERATE` (Google Search grounding + `output_schema`), `AI.PREDICT` | Fill gaps two ways: retrieve the answer from the web, or infer it from the rows you already have. A direct contrast between grounded generation and zero-shot tabular inference. |
|
|
10
|
+
| `content_analysis` | `AI.GENERATE_TABLE`, `AI.CLASSIFY`, `AI.SCORE`, `AI.GENERATE`, `AI.AGG` | Generate sample data, classify it, score it, and summarize findings — a good template for any "classify then score then summarize" pipeline. |
|
|
11
|
+
| `semantic_search` | `AI.EMBED`, `VECTOR_SEARCH`, `AI.SEARCH` | Build and query a semantic search index three ways — manual, simplified, and hybrid — to see what each layer of convenience costs. |
|
|
12
|
+
| `catalog_search` | `AI.EMBED`, `VECTOR_SEARCH`, `AI.SEARCH` | Hybrid retrieval over a real ~7,275-row product catalog: what rank fusion buys for an exact-token lookup and what it does not, plus a corpus large enough to actually populate a vector index. The clearest demonstration that a bare SKU is not retrievable at the small `top_k` these demos use — its row sits at semantic rank 2,072, outside the `10 * top_k` lexical candidate pool until `top_k >= 208` — while the same SKU alongside descriptive words surfaces either way. |
|
|
13
|
+
| `rag_pipeline` | `AI.GENERATE_TABLE`, `AI.EMBED`, `VECTOR_SEARCH`, `AI.GENERATE` | Generate a knowledge base, embed it, search it (semantic and hybrid), answer questions grounded in the retrieved context. |
|
|
14
|
+
| `tabular_prediction` | `AI.PREDICT`, `AI.EVALUATE`, `AI.KEY_DRIVERS`, `AI.GENERATE` | Zero-shot regression and classification with TabFM — no training step — then scored, explained by driver, and written up as a model card. Includes a head-to-head against trained BigQuery ML models. |
|
|
15
|
+
| `document_rag` | `AI.PARSE_DOCUMENT`, `AI.EMBED`, `VECTOR_SEARCH`, `AI.GENERATE` | Parse real documents, embed chunks, search, answer questions with grounded context. **Currently blocked** — depends on `AI.PARSE_DOCUMENT`, which is offline for revision (see `document-processing.md`). |
|
|
16
|
+
| `time_series_intelligence` | `AI.FORECAST`, `AI.DETECT_ANOMALIES`, `AI.EVALUATE`, `AI.KEY_DRIVERS` | Forecast a series, detect anomalies in it, evaluate forecast accuracy, then explain movement by segment — the single most complete tour of the forecasting/anomaly/driver functions together. |
|
|
17
|
+
| `metric_diagnostics` | `AI.KEY_DRIVERS`, `AI.PREDICT`, `AI.CAUSAL_EFFECT`, `AI.GENERATE` | Explain why a metric moved between two periods, project where it goes next, then narrate both in plain language — pairs structured analysis and zero-shot prediction with a generation function for a readable output. Ends by *refusing* the causal claim: a placebo test runs `AI.CAUSAL_EFFECT` at six dates where nothing happened and one of them comes back significant, which is why the earlier steps stay descriptive. |
|
|
18
|
+
| `document_intelligence` | `AI.CLASSIFY`, `AI.GENERATE`, `AI.SCORE`, `AI.AGG` | Classify mixed documents, extract key fields, score quality, summarize findings. |
|
|
19
|
+
| `content_moderation` | `AI.GENERATE_TABLE`, `AI.IF`, `AI.CLASSIFY`, `AI.SCORE`, `AI.GENERATE`, `AI.AGG` | Flag, categorize, and score user-generated content — the broadest single-workflow tour of the managed functions. |
|
|
20
|
+
| `multimodal_analysis` | `AI.EMBED`, `AI.SIMILARITY`, `AI.GENERATE` | Embed document images, find similar documents, generate visual descriptions. |
|
|
21
|
+
| `log_analysis` | `AI.GENERATE_TABLE`, `AI.CLASSIFY`, `AI.SCORE`, `AI.AGG`, `AI.EMBED`, `VECTOR_SEARCH` | Classify tickets, score priority, summarize patterns, then retrieve by error code with hybrid search — a support/ops-triage template, and the sub-project's clearest measurement of how far up the ranking a lexical hit can lift a row (vector rank 24 of 30 → fused position 11) and why `top_k` decides whether you ever see it. |
|
|
22
|
+
| `image_deduplication` | `AI.EMBED`, `VECTOR_SEARCH` | Group near-duplicate images using embedding similarity, e.g. to protect train/test split integrity. |
|
|
23
|
+
|
|
24
|
+
## Choosing a starting template
|
|
25
|
+
|
|
26
|
+
- **Need to classify + score + summarize unstructured records at volume** (tickets, documents, user content) → `content_analysis`, `document_intelligence`, `content_moderation`, or `log_analysis` — pick by how many of the managed functions (`AI.CLASSIFY`/`AI.SCORE`/`AI.IF`/`AI.AGG`) you need together; `content_moderation` is the most complete template.
|
|
27
|
+
- **Need to answer questions grounded in your own data** → `rag_pipeline` (text) or `document_rag` (real documents — currently blocked, see above).
|
|
28
|
+
- **Need to find similar items** (text, images, documents) → `semantic_search` or `image_deduplication` depending on whether you need a queryable index or a one-off grouping pass.
|
|
29
|
+
- **Need search that weighs exact tokens** (SKUs, error codes, part numbers) → `catalog_search` for the full hybrid treatment on a real corpus with a vector index, or `log_analysis`'s Step 5 for the compact version. `semantic_search` shows hybrid alongside the two semantic-only approaches for contrast. **Set expectations first:** hybrid re-ranks and modestly widens, and `top_k` decides how far — a lexical hit reaches 10 semantic ranks deep at `top_k => 5`, 110 at `top_k => 30`, and 640 at `top_k => 64`. Two gates set that reach and effective reach is `min( score gate, 10 * top_k )`: the fused score has to beat the last slot on the page, which is what binds at `top_k` below 51, and BigQuery only pools the top `10 * top_k` rows for the lexical leg, which is what binds from 51 up. So it pays off when the query carries descriptive words *alongside* the token, and exact-token retrieval for a target at semantic rank `R` needs `top_k` of **at least** `R/10` — a floor, not a recipe, since below a few hundred ranks deep the score gate demands considerably more (a target at rank 100 needs `top_k` near 29, not 10). Read the reach table for the number that actually applies. When the token is the entire query and the answer must be certain, point the user at a `WHERE` predicate instead — `catalog_search` demonstrates exactly that trade-off. See `reference/embeddings-and-search.md` for the arithmetic and the reach table.
|
|
30
|
+
- **Need to predict a value or category from structured rows with no training** → `tabular_prediction` (the full TabFM tour: predict, score, explain, narrate) or `metric_diagnostics` (drivers + a lighter projection).
|
|
31
|
+
- **Need to explain a metric or forecast something over time** → `time_series_intelligence` (the full forecast/anomaly/evaluate/drivers tour) or `metric_diagnostics` (drivers + narration, lighter weight).
|
|
32
|
+
- **Need to enrich/clean records against external knowledge** → `data_enrichment`, which contrasts the Google Search grounding pattern against zero-shot tabular inference for the same gap.
|
|
33
|
+
- **Working with images/visual content specifically** → `multimodal_analysis`.
|
|
34
|
+
|
|
35
|
+
## Go deeper
|
|
36
|
+
|
|
37
|
+
Full extracted notebook walkthroughs live in this skill's `narrative/` folder:
|
|
38
|
+
|
|
39
|
+
- [`narrative/catalog_search.md`](../narrative/catalog_search.md) (source: `workflows/catalog_search/`)
|
|
40
|
+
- [`narrative/content_analysis.md`](../narrative/content_analysis.md) (source: `workflows/content_analysis/`)
|
|
41
|
+
- [`narrative/content_moderation.md`](../narrative/content_moderation.md) (source: `workflows/content_moderation/`)
|
|
42
|
+
- [`narrative/data_enrichment.md`](../narrative/data_enrichment.md) (source: `workflows/data_enrichment/`)
|
|
43
|
+
- [`narrative/document_intelligence.md`](../narrative/document_intelligence.md) (source: `workflows/document_intelligence/`)
|
|
44
|
+
- [`narrative/document_rag.md`](../narrative/document_rag.md) (source: `workflows/document_rag/`) — currently blocked on the AI.PARSE_DOCUMENT outage
|
|
45
|
+
- [`narrative/image_deduplication.md`](../narrative/image_deduplication.md) (source: `workflows/image_deduplication/`)
|
|
46
|
+
- [`narrative/log_analysis.md`](../narrative/log_analysis.md) (source: `workflows/log_analysis/`)
|
|
47
|
+
- [`narrative/metric_diagnostics.md`](../narrative/metric_diagnostics.md) (source: `workflows/metric_diagnostics/`)
|
|
48
|
+
- [`narrative/multimodal_analysis.md`](../narrative/multimodal_analysis.md) (source: `workflows/multimodal_analysis/`)
|
|
49
|
+
- [`narrative/rag_pipeline.md`](../narrative/rag_pipeline.md) (source: `workflows/rag_pipeline/`)
|
|
50
|
+
- [`narrative/semantic_search.md`](../narrative/semantic_search.md) (source: `workflows/semantic_search/`)
|
|
51
|
+
- [`narrative/tabular_prediction.md`](../narrative/tabular_prediction.md) (source: `workflows/tabular_prediction/`)
|
|
52
|
+
- [`narrative/time_series_intelligence.md`](../narrative/time_series_intelligence.md) (source: `workflows/time_series_intelligence/`)
|
|
53
|
+
|
|
54
|
+
Full function-to-workflow map and "How Functions Relate" diagram: see the README in the source repo (`bigquery-ai/README.md`).
|
|
55
|
+
|
|
56
|
+
**Lens 3 per-statement syntax cards (`syntax/`):** [`syntax/INDEX.md`](../syntax/INDEX.md) — [`syntax/aigenerate.md`](../syntax/aigenerate.md), [`syntax/aigenerate_table.md`](../syntax/aigenerate_table.md), [`syntax/aiclassify.md`](../syntax/aiclassify.md), [`syntax/aiembed.md`](../syntax/aiembed.md), [`syntax/vector_search.md`](../syntax/vector_search.md), [`syntax/aiforecast.md`](../syntax/aiforecast.md), [`syntax/aipredict.md`](../syntax/aipredict.md), [`syntax/aikey_drivers.md`](../syntax/aikey_drivers.md)
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bigquery-ai",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"source_project": "bigquery-ai",
|
|
5
|
+
"narrative_sources": {},
|
|
6
|
+
"generated_date": "2026-10-19",
|
|
7
|
+
"source_commit": null,
|
|
8
|
+
"reference_files": [
|
|
9
|
+
"augmented-analytics.md",
|
|
10
|
+
"cloud-ai-service-models.md",
|
|
11
|
+
"document-processing.md",
|
|
12
|
+
"embeddings-and-search.md",
|
|
13
|
+
"general-purpose-generation.md",
|
|
14
|
+
"managed-functions.md",
|
|
15
|
+
"predictive-ai.md",
|
|
16
|
+
"workflows.md"
|
|
17
|
+
],
|
|
18
|
+
"syntax_files": [
|
|
19
|
+
"aiagg.md",
|
|
20
|
+
"aicausal_effect-covered-in-bigquery-ml.md",
|
|
21
|
+
"aiclassify.md",
|
|
22
|
+
"aicount_tokens.md",
|
|
23
|
+
"aidetect_anomalies.md",
|
|
24
|
+
"aiembed.md",
|
|
25
|
+
"aievaluate.md",
|
|
26
|
+
"aiforecast.md",
|
|
27
|
+
"aigenerate.md",
|
|
28
|
+
"aigenerate_bool.md",
|
|
29
|
+
"aigenerate_double.md",
|
|
30
|
+
"aigenerate_embedding.md",
|
|
31
|
+
"aigenerate_int.md",
|
|
32
|
+
"aigenerate_table.md",
|
|
33
|
+
"aigenerate_text.md",
|
|
34
|
+
"aiif.md",
|
|
35
|
+
"aikey_drivers.md",
|
|
36
|
+
"aiparse_document.md",
|
|
37
|
+
"aipredict.md",
|
|
38
|
+
"aiscore.md",
|
|
39
|
+
"aisearch.md",
|
|
40
|
+
"aisimilarity.md",
|
|
41
|
+
"choosing-between-these-and-the-ai-functions.md",
|
|
42
|
+
"hybrid-search-capability.md",
|
|
43
|
+
"mlannotate_image.md",
|
|
44
|
+
"mlgenerate_embedding.md",
|
|
45
|
+
"mlgenerate_text.md",
|
|
46
|
+
"mlprocess_document.md",
|
|
47
|
+
"mltranscribe.md",
|
|
48
|
+
"mltranslate.md",
|
|
49
|
+
"mlunderstand_text.md",
|
|
50
|
+
"multimodal-input-patterns-by-function.md",
|
|
51
|
+
"object-tables.md",
|
|
52
|
+
"objectref-and-objectrefruntime-schema-reference.md",
|
|
53
|
+
"objfetch_metadata.md",
|
|
54
|
+
"objget_access_url.md",
|
|
55
|
+
"objget_read_url.md",
|
|
56
|
+
"objlist.md",
|
|
57
|
+
"objmake_ref.md",
|
|
58
|
+
"per-row-failures-and-the-retry-pattern.md",
|
|
59
|
+
"setup-apis-connection-roles.md",
|
|
60
|
+
"two-input-shapes.md",
|
|
61
|
+
"vector_search.md",
|
|
62
|
+
"what-the-five-have-in-common.md"
|
|
63
|
+
],
|
|
64
|
+
"narrative_files": [
|
|
65
|
+
"ai_agg.md",
|
|
66
|
+
"ai_classify.md",
|
|
67
|
+
"ai_count_tokens.md",
|
|
68
|
+
"ai_detect_anomalies.md",
|
|
69
|
+
"ai_embed.md",
|
|
70
|
+
"ai_evaluate.md",
|
|
71
|
+
"ai_forecast.md",
|
|
72
|
+
"ai_generate.md",
|
|
73
|
+
"ai_generate_bool.md",
|
|
74
|
+
"ai_generate_double.md",
|
|
75
|
+
"ai_generate_embedding.md",
|
|
76
|
+
"ai_generate_int.md",
|
|
77
|
+
"ai_generate_table.md",
|
|
78
|
+
"ai_generate_text.md",
|
|
79
|
+
"ai_if.md",
|
|
80
|
+
"ai_key_drivers.md",
|
|
81
|
+
"ai_parse_document.md",
|
|
82
|
+
"ai_predict.md",
|
|
83
|
+
"ai_score.md",
|
|
84
|
+
"ai_search.md",
|
|
85
|
+
"ai_similarity.md",
|
|
86
|
+
"catalog_search.md",
|
|
87
|
+
"content_analysis.md",
|
|
88
|
+
"content_moderation.md",
|
|
89
|
+
"data_enrichment.md",
|
|
90
|
+
"document_intelligence.md",
|
|
91
|
+
"document_rag.md",
|
|
92
|
+
"image_deduplication.md",
|
|
93
|
+
"log_analysis.md",
|
|
94
|
+
"metric_diagnostics.md",
|
|
95
|
+
"ml_annotate_image.md",
|
|
96
|
+
"ml_generate_embedding.md",
|
|
97
|
+
"ml_generate_text.md",
|
|
98
|
+
"ml_process_document.md",
|
|
99
|
+
"ml_transcribe.md",
|
|
100
|
+
"ml_translate.md",
|
|
101
|
+
"ml_understand_text.md",
|
|
102
|
+
"multimodal_analysis.md",
|
|
103
|
+
"rag_pipeline.md",
|
|
104
|
+
"semantic_search.md",
|
|
105
|
+
"tabular_prediction.md",
|
|
106
|
+
"time_series_intelligence.md",
|
|
107
|
+
"vector_search.md"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# `bigquery-ai` Syntax Cards Index (Lens 3)
|
|
2
|
+
|
|
3
|
+
Focused, per-statement syntax and option cards sliced from [`bigquery-ai/reference/`](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ai/reference). Every card is strictly under 25 KB.
|
|
4
|
+
|
|
5
|
+
## Augmented Analytics (`augmented-analytics.md`)
|
|
6
|
+
|
|
7
|
+
- [`AI.CAUSAL_EFFECT` — covered in `bigquery-ml`](aicausal_effect-covered-in-bigquery-ml.md)
|
|
8
|
+
- [`AI.KEY_DRIVERS`](aikey_drivers.md)
|
|
9
|
+
|
|
10
|
+
## Cloud AI Service Models (`cloud-ai-service-models.md`)
|
|
11
|
+
|
|
12
|
+
- [What the five have in common](what-the-five-have-in-common.md)
|
|
13
|
+
- [Setup: APIs, connection, roles](setup-apis-connection-roles.md)
|
|
14
|
+
- [Two input shapes](two-input-shapes.md)
|
|
15
|
+
- [`ML.TRANSLATE`](mltranslate.md)
|
|
16
|
+
- [`ML.UNDERSTAND_TEXT`](mlunderstand_text.md)
|
|
17
|
+
- [`ML.ANNOTATE_IMAGE`](mlannotate_image.md)
|
|
18
|
+
- [`ML.TRANSCRIBE`](mltranscribe.md)
|
|
19
|
+
- [Per-row failures and the retry pattern](per-row-failures-and-the-retry-pattern.md)
|
|
20
|
+
- [Choosing between these and the `AI.*` functions](choosing-between-these-and-the-ai-functions.md)
|
|
21
|
+
|
|
22
|
+
## Document Processing (`document-processing.md`)
|
|
23
|
+
|
|
24
|
+
- [`ML.PROCESS_DOCUMENT`](mlprocess_document.md)
|
|
25
|
+
- [`AI.PARSE_DOCUMENT`](aiparse_document.md)
|
|
26
|
+
|
|
27
|
+
## Embedding Generation and Semantic Search (`embedding-generation-and-semantic-search.md`)
|
|
28
|
+
|
|
29
|
+
- [`AI.EMBED`](aiembed.md)
|
|
30
|
+
- [`AI.GENERATE_EMBEDDING`](aigenerate_embedding.md)
|
|
31
|
+
- [`ML.GENERATE_EMBEDDING`](mlgenerate_embedding.md)
|
|
32
|
+
- [`AI.SIMILARITY`](aisimilarity.md)
|
|
33
|
+
- [`VECTOR_SEARCH`](vector_search.md)
|
|
34
|
+
- [`AI.SEARCH`](aisearch.md)
|
|
35
|
+
- [Hybrid Search *(capability)*](hybrid-search-capability.md)
|
|
36
|
+
|
|
37
|
+
## General Purpose Functions (`general-purpose-functions.md`)
|
|
38
|
+
|
|
39
|
+
- [`AI.GENERATE`](aigenerate.md)
|
|
40
|
+
- [`AI.GENERATE_TEXT`](aigenerate_text.md)
|
|
41
|
+
- [`AI.GENERATE_TABLE`](aigenerate_table.md)
|
|
42
|
+
- [`AI.GENERATE_BOOL`](aigenerate_bool.md)
|
|
43
|
+
- [`AI.GENERATE_DOUBLE`](aigenerate_double.md)
|
|
44
|
+
- [`AI.GENERATE_INT`](aigenerate_int.md)
|
|
45
|
+
- [`ML.GENERATE_TEXT`](mlgenerate_text.md)
|
|
46
|
+
- [`AI.COUNT_TOKENS`](aicount_tokens.md)
|
|
47
|
+
|
|
48
|
+
## Managed Functions (`managed-functions.md`)
|
|
49
|
+
|
|
50
|
+
- [`AI.IF`](aiif.md)
|
|
51
|
+
- [`AI.SCORE`](aiscore.md)
|
|
52
|
+
- [`AI.CLASSIFY`](aiclassify.md)
|
|
53
|
+
- [`AI.AGG`](aiagg.md)
|
|
54
|
+
|
|
55
|
+
## Predictive AI (`predictive-ai.md`)
|
|
56
|
+
|
|
57
|
+
- [`AI.FORECAST`](aiforecast.md)
|
|
58
|
+
- [`AI.DETECT_ANOMALIES`](aidetect_anomalies.md)
|
|
59
|
+
- [`AI.PREDICT`](aipredict.md)
|
|
60
|
+
- [`AI.EVALUATE`](aievaluate.md)
|
|
61
|
+
|
|
62
|
+
## Unstructured Data Infrastructure (`unstructured-data-infrastructure.md`)
|
|
63
|
+
|
|
64
|
+
- [Object Tables](object-tables.md)
|
|
65
|
+
- [`OBJ.LIST`](objlist.md)
|
|
66
|
+
- [`OBJ.MAKE_REF`](objmake_ref.md)
|
|
67
|
+
- [`OBJ.FETCH_METADATA`](objfetch_metadata.md)
|
|
68
|
+
- [`OBJ.GET_ACCESS_URL`](objget_access_url.md)
|
|
69
|
+
- [`OBJ.GET_READ_URL`](objget_read_url.md)
|
|
70
|
+
- [ObjectRef and ObjectRefRuntime Schema Reference](objectref-and-objectrefruntime-schema-reference.md)
|
|
71
|
+
- [Multimodal Input Patterns by Function](multimodal-input-patterns-by-function.md)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# `AI.AGG`
|
|
2
|
+
|
|
3
|
+
> **Source:** [`bigquery-ai/reference/managed-functions.md#aiagg`](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ai/reference/managed-functions.md#aiagg)
|
|
4
|
+
|
|
5
|
+
- **Description:** (Preview) Aggregate function that uses a Vertex AI Gemini model to aggregate data based on natural language instructions. Automatically performs multi-level aggregation through batching, so it can analyze data exceeding the Gemini context window. Returns a single STRING per group.
|
|
6
|
+
- **Use cases:** Sentiment analysis across reviews, content summarization of text or images, log analysis and incident investigation, agent performance analysis, finding common categories or patterns across data, summarizing grouped data.
|
|
7
|
+
- [documentation](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-agg)
|
|
8
|
+
- **Type:** Aggregate function -- returns a single STRING value per group (Preview). Use with GROUP BY for per-group results; without GROUP BY, aggregates all rows.
|
|
9
|
+
|
|
10
|
+
**Syntax:**
|
|
11
|
+
```sql
|
|
12
|
+
AI.AGG(
|
|
13
|
+
[ DISTINCT ]
|
|
14
|
+
INPUT,
|
|
15
|
+
INSTRUCTION
|
|
16
|
+
[, connection_id => 'CONNECTION']
|
|
17
|
+
[, endpoint => 'ENDPOINT']
|
|
18
|
+
)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Inputs:**
|
|
22
|
+
|
|
23
|
+
| Parameter | Type | Required | Description |
|
|
24
|
+
|-----------|------|----------|-------------|
|
|
25
|
+
| `DISTINCT` | keyword | Optional | When specified, deduplicates input values before aggregating. |
|
|
26
|
+
| `INPUT` | STRING or STRUCT | Required (must be first argument) | The data to aggregate. STRING value, or STRUCT consisting of STRING values, object references, and arrays of either. **The reference page still specifies `ObjectRefRuntime` here — it is the only `AI.*` page that does.** A bare `ObjectRef` works anyway: `AI.AGG(STRUCT(ref), instruction)` over an object table returns real summaries (verified live 2026-09-15 over 50 PDFs), and the Known Issues below argue for it. |
|
|
27
|
+
| `INSTRUCTION` | STRING | Required (must be second argument) | Natural language aggregation prompt describing what to extract or summarize from the input data. Can be a string literal or query parameter. |
|
|
28
|
+
| `CONNECTION` | STRING | Optional | Connection to use, format: `[PROJECT_ID.]LOCATION.CONNECTION_ID`. If not specified, end-user credentials are used. |
|
|
29
|
+
| `ENDPOINT` | STRING | Optional | Vertex AI endpoint. Any Gemini model that doesn't require thinking budget. If not specified, BigQuery chooses a model for you. |
|
|
30
|
+
|
|
31
|
+
**Outputs:**
|
|
32
|
+
|
|
33
|
+
| Return Type | Description |
|
|
34
|
+
|-------------|-------------|
|
|
35
|
+
| STRING | The aggregated result for the group. One result per GROUP BY group, or one result total without GROUP BY. |
|
|
36
|
+
| STRING (partial) | If some Vertex AI calls fail, returns partial results from successful calls. |
|
|
37
|
+
| NULL | Returned if all calls to Vertex AI fail, or if all input rows are invalid. |
|
|
38
|
+
|
|
39
|
+
**Output cap:** 10,000 tokens per group.
|
|
40
|
+
|
|
41
|
+
**Supported models:** Any Gemini model that doesn't require thinking budget. If no endpoint specified, BigQuery dynamically chooses a model. Uses various `gemini-2.5-*` models.
|
|
42
|
+
|
|
43
|
+
**Best practices:**
|
|
44
|
+
- Use `TO_JSON_STRING` to pass multiple columns as structured input -- the model sees each row's full context.
|
|
45
|
+
- Use `DISTINCT` to remove duplicate inputs and reduce token usage.
|
|
46
|
+
- Keep groups under 20 million rows per query and under 1,000 distinct groups to avoid timeouts.
|
|
47
|
+
- Prefer AI.AGG over manual aggregation with AI.GENERATE (STRING_AGG/ARRAY_AGG into a prompt) -- AI.AGG handles batching automatically and scales beyond the context window.
|
|
48
|
+
|
|
49
|
+
**Limitations:** Preview status. Returns NULL on total failure (no detailed error info). No model parameter control (temperature, top_p, etc.). Output capped at 10,000 tokens per group. Recommended limit of 20 million rows per query and 1,000 distinct groups. Cannot use Gemini models that require thinking budget.
|
|
50
|
+
|
|
51
|
+
**Known issues:**
|
|
52
|
+
- Input rows with 10 or more images in a single row might be skipped.
|
|
53
|
+
- Input rows with arrays of ObjectRefRuntime objects that call `OBJ.GET_ACCESS_URL` might be skipped.
|
|
54
|
+
- Some ObjectRefRuntime **image** objects created by `OBJ.GET_ACCESS_URL` might fail to process.
|
|
55
|
+
- Both of the above are about `ObjectRefRuntime` specifically. Passing the `ObjectRef` sidesteps them — the practical argument for the unwrapped form even though this page's `INPUT` row still names the runtime type.
|
|
56
|
+
- Individual rows larger than **10 MiB** might fail with an internal error.
|
|
57
|
+
- Mixing `AI.AGG()` without `DISTINCT` and another aggregate function *with* `DISTINCT` in the same query might return an internal error.
|
|
58
|
+
- Workforce Identity Federation without a specified Cloud resource connection may cause failures on long-running queries.
|
|
59
|
+
- Queries using Gemini 3.0 or 3.1 with connection-based authentication might receive an unauthenticated error.
|
|
60
|
+
|
|
61
|
+
**Cost caveat:** The actual number of rows processed by the model might differ from expectations, particularly with complex queries (JOIN, ORDER BY ... LIMIT). Materialize data to a separate table first to ensure predictable processing.
|
|
62
|
+
|
|
63
|
+
**Locations:** All regions supporting Gemini models, plus US and EU multi-regions.
|
|
64
|
+
|
|
65
|
+
**Provisioned throughput:** Not supported. Uses dynamic shared quota (DSQ) only.
|
|
66
|
+
|
|
67
|
+
**BigFrames API:** No native BigFrames API. Use `bpd.read_gbq_query(sql)` to execute AI.AGG queries and get results as a BigFrames DataFrame.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# `AI.CAUSAL_EFFECT` — covered in `bigquery-ml`
|
|
2
|
+
|
|
3
|
+
> **Source:** [`bigquery-ai/reference/augmented-analytics.md#aicausal_effect--covered-in-bigquery-ml`](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ai/reference/augmented-analytics.md#aicausal_effect--covered-in-bigquery-ml)
|
|
4
|
+
|
|
5
|
+
Full entry: **[`bigquery-ml/reference/model-free-functions.md#aicausal_effect`](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ml/reference/model-free-functions.md#aicausal_effect)**
|
|
6
|
+
Tested example: **[`bigquery-ml/workflows/causal_effect/`](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ml/workflows/causal_effect)**
|
|
7
|
+
|
|
8
|
+
This is a deliberate exception to the usual rule that every `AI.*` function is documented in this project. The dividing line between the two projects is *"does the reader manage a model artifact,"* not *"does the name start with `AI.`"* — and by that test this one belongs there:
|
|
9
|
+
|
|
10
|
+
- Its subject is **causal inference**, which `bigquery-ml/workflows/` already covers five other ways ([DiD](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ml/workflows/difference_in_differences), [synthetic control](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ml/workflows/synthetic_control), [propensity score matching](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ml/workflows/propensity_score_matching), [uplift/CATE](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ml/workflows/uplift_cate), [double ML](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ml/workflows/price_elasticity_dml)). The only way to judge its estimate is against those, on the same data — which is exactly what the linked notebook does, and it finds a ~2.9× magnitude disagreement.
|
|
11
|
+
- It is **not foundation-model backed**. Unlike every other function in this project, its counterfactual is measurably plain `ARIMA_PLUS` + `ML.FORECAST` on default options — identical to the last digit — and it rejects the `model` argument the TimesFM functions accept. It is also fully deterministic, which none of the TimesFM functions are: its p-value is a closed form, `2 · (1 − CDF(\|Z\|))` on the sum of the model's own pointwise standard errors, reconstructible bit for bit rather than sampled.
|
|
12
|
+
|
|
13
|
+
It stays listed in this project's [function catalog](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ai/README.md#augmented-analytics--find-what-drives-metric-changes) so that catalog remains a complete inventory of the `AI.*` surface.
|
|
14
|
+
|
|
15
|
+
**Where it appears in this project anyway:** [`workflows/metric_diagnostics/`](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ai/workflows/metric_diagnostics) runs it as a **placebo test** at the end of an `AI.KEY_DRIVERS` → `AI.PREDICT` diagnostic. There is no intervention in that dataset, which is the point: six dates chosen only for spacing, and one of them returns a significant cumulative effect with nothing behind it, because a counterfactual fitted on a spring-and-summer ramp reads the autumn seasonal turn as an intervention. That is the discipline the shared heading makes easy to skip — the same trap as reading `AI.KEY_DRIVERS` on before/after periods as causal, arriving from the other direction.
|
|
16
|
+
|
|
17
|
+
---
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# `AI.CLASSIFY`
|
|
2
|
+
|
|
3
|
+
> **Source:** [`bigquery-ai/reference/managed-functions.md#aiclassify`](https://github.com/statmike/bigquery-data-science/blob/main/bigquery-ai/reference/managed-functions.md#aiclassify)
|
|
4
|
+
|
|
5
|
+
- **Description:** (Preview) Scalar function that uses a Vertex AI Gemini model to classify inputs into categories that you provide. BigQuery automatically structures your input to improve the quality of the classification.
|
|
6
|
+
- **Use cases:** Classify reviews by sentiment, classify products by categories, classify support tickets by topic, image classification by style or contents, multi-label classification.
|
|
7
|
+
- [documentation](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-classify)
|
|
8
|
+
- **Type:** Scalar function -- returns STRING or ARRAY\<STRING\> per row (Preview)
|
|
9
|
+
|
|
10
|
+
**Syntax:**
|
|
11
|
+
```sql
|
|
12
|
+
AI.CLASSIFY(
|
|
13
|
+
[ input => ] 'INPUT',
|
|
14
|
+
[ categories => ] 'CATEGORIES'
|
|
15
|
+
[, examples => EXAMPLES ]
|
|
16
|
+
[, connection_id => 'CONNECTION' ]
|
|
17
|
+
[, endpoint => 'ENDPOINT' ]
|
|
18
|
+
[, output_mode => 'OUTPUT_MODE' ]
|
|
19
|
+
[, embeddings => EMBEDDINGS ]
|
|
20
|
+
[, optimization_mode => 'OPTIMIZATION_MODE' ]
|
|
21
|
+
[, max_error_ratio => MAX_ERROR_RATIO ]
|
|
22
|
+
)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Inputs:**
|
|
26
|
+
|
|
27
|
+
| Parameter | Type | Required | Description |
|
|
28
|
+
|-----------|------|----------|-------------|
|
|
29
|
+
| `INPUT` | STRING or STRUCT | Required (must be first argument) | The input to classify. STRING, an `ObjectRef`, or a STRUCT with STRING/ARRAY\<STRING\>/ObjectRef/ARRAY\<ObjectRef\> fields. At most one video object. An object table's `ref` column goes in directly — `EXTERNAL_OBJECT_TRANSFORM` is not required (verified live 2026-09-15). |
|
|
30
|
+
| `CATEGORIES` | ARRAY\<STRING\> or ARRAY\<STRUCT\<STRING, STRING\>\> | Required (must be second argument) | The categories to classify into. Without descriptions: `['positive', 'neutral', 'negative']`. With descriptions: `[('green', 'positive'), ('yellow', 'neutral'), ('red', 'negative')]`. Must be string literals (or use a DECLARE variable from a table column). |
|
|
31
|
+
| `EXAMPLES` | ARRAY\<STRUCT\<STRING, STRING\>\> (single) or ARRAY\<STRUCT\<STRING, ARRAY\<STRING\>\>\> (multi) | Optional | Few-shot examples. For single mode: maps input to expected category. For multi mode: maps input to expected array of categories. Example: `[("This is a great phone", "tech"), ("The match was exciting", "sport")]`. |
|
|
32
|
+
| `CONNECTION` | STRING | Optional | Connection to use, format: `[PROJECT_ID].LOCATION.CONNECTION_ID`. |
|
|
33
|
+
| `ENDPOINT` | STRING | Optional | Vertex AI endpoint. If not specified, BigQuery dynamically chooses a model. |
|
|
34
|
+
| `OUTPUT_MODE` | STRING | Optional | `'single'` or `'multi'`. Changes return type to ARRAY\<STRING\>. |
|
|
35
|
+
| `EMBEDDINGS` | (Preview) | Optional | Embeddings for optimized mode, same as AI.IF. |
|
|
36
|
+
| `OPTIMIZATION_MODE` | STRING | Optional (Preview) | `MINIMIZE_COST` or `MAXIMIZE_QUALITY`. Same as AI.IF. Note: `output_mode => 'multi'` is NOT supported in optimized mode. |
|
|
37
|
+
| `MAX_ERROR_RATIO` | FLOAT64 | Optional | Range 0.0–1.0, default 1.0. Not supported when `optimization_mode` is `MINIMIZE_COST`. |
|
|
38
|
+
|
|
39
|
+
**Categories from a table column (using DECLARE):**
|
|
40
|
+
```sql
|
|
41
|
+
DECLARE article_types ARRAY<STRING>
|
|
42
|
+
DEFAULT (SELECT ARRAY_AGG(category) FROM mydataset.categories);
|
|
43
|
+
|
|
44
|
+
SELECT AI.CLASSIFY(body, categories => article_types) AS category
|
|
45
|
+
FROM `bigquery-public-data.bbc_news.fulltext`;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Outputs:**
|
|
49
|
+
|
|
50
|
+
| Condition | Return Type | Description |
|
|
51
|
+
|-----------|-------------|-------------|
|
|
52
|
+
| No OUTPUT_MODE specified | STRING | The single category that best fits the input. |
|
|
53
|
+
| OUTPUT_MODE = 'single' | ARRAY\<STRING\> | Array of length 1 containing the best-fit category. |
|
|
54
|
+
| OUTPUT_MODE = 'multi' | ARRAY\<STRING\> | Array of 0 to N categories. Empty array if no category applies. |
|
|
55
|
+
| Error | NULL | Returned if the call to Vertex AI is unsuccessful. |
|
|
56
|
+
|
|
57
|
+
**Supported models:** Any GA or preview Gemini model. Uses various `gemini-2.5-*` models.
|
|
58
|
+
|
|
59
|
+
**Best practices:**
|
|
60
|
+
- Include an 'Other' category to handle input that doesn't closely match any category.
|
|
61
|
+
- Use categories with descriptions for more nuanced classification.
|
|
62
|
+
- Use `output_mode => 'multi'` when items may belong to multiple categories.
|
|
63
|
+
|
|
64
|
+
**Limitations:** Preview status. Returns NULL on error. Categories must be string literals in the array (unless using a variable). No model parameter control. `output_mode => 'multi'` is not supported in optimized mode. Optimized mode requires ~3,000 rows minimum; only string columns supported for multi-column inputs.
|
|
65
|
+
|
|
66
|
+
**Locations:** All regions supporting Gemini models, plus US and EU multi-regions.
|
|
67
|
+
|
|
68
|
+
**Provisioned throughput:** Not supported. Uses dynamic shared quota (DSQ) only.
|
|
69
|
+
|
|
70
|
+
**BigFrames API:** `bigframes.bigquery.ai.classify(input, categories)` — Returns a Series of STRING directly (not a struct). Takes `categories` as a list/tuple. Example: `bbq.ai.classify(df["text"], ["positive", "negative", "neutral"])`.
|
|
71
|
+
|
|
72
|
+
---
|