# End-to-end user journeys for generative AI models

You can use remote or hosted generative AI models in BigQuery ML to
integrate advanced AI capabilities directly into BigQuery.
Exploring these end-to-end user journeys lets you
discover the specific SQL statements and functions required to create,
evaluate, and generate data from Gemini models, Cloud AI services,
and custom open models. BigQuery ML offers the following types
of remote models:

- [Fine-tuned Google Gemini models](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-tuned.md.txt)
- [Google, partner, and open models as a service](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model.md.txt)
- [Google text embedding models as a service](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-embedding-maas.md.txt)
- [Self-deployed open models](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-open.md.txt)
- [Cloud AI services](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-service.md.txt)
- [Custom models deployed to Gemini Enterprise Agent Platform](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-https.md.txt)

## Remote or hosted model user journeys

The following table describes the statements and functions you can use to
create, evaluate, and generate data from remote or hosted models:

| Model category | Model type | Model creation | [Evaluation](https://docs.cloud.google.com/bigquery/docs/evaluate-overview.md.txt) | [Inference](https://docs.cloud.google.com/bigquery/docs/inference-overview.md.txt) | Tutorials |
|---|---|---|---|---|---|
| Generative AI remote models | Remote model over a Gemini text generation model^1^ | [`CREATE MODEL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model.md.txt) | [`ML.EVALUATE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate.md.txt) | - [`AI.GENERATE_TEXT`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-generate-text.md.txt) - [`AI.GENERATE_TABLE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-generate-table.md.txt) - [`AI.GENERATE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-generate.md.txt)^2^ - [`AI.GENERATE_BOOL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-generate-bool.md.txt)^2^ - [`AI.GENERATE_DOUBLE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-generate-double.md.txt)^2^ - [`AI.GENERATE_INT`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-generate-int.md.txt)^2^ | - [Generate text using your data](https://docs.cloud.google.com/bigquery/docs/generate-text-tutorial) - [Generate structured data using your data](https://docs.cloud.google.com/bigquery/docs/generate-table.md.txt) - [Generate text with Gemini and public data](https://docs.cloud.google.com/bigquery/docs/generate-text-tutorial-gemini.md.txt) - [Handle quota errors by calling `ML.GENERATE_TEXT` iteratively](https://docs.cloud.google.com/bigquery/docs/iterate-generate-text-calls.md.txt) - [Analyze images with a Gemini model](https://docs.cloud.google.com/bigquery/docs/image-analysis.md.txt) - [Try model tuning using public data](https://docs.cloud.google.com/bigquery/docs/tune-evaluate.md.txt) |
| Generative AI remote models | Remote model over a partner text generation model | [`CREATE MODEL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model.md.txt) | [`ML.EVALUATE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate.md.txt) | [`AI.GENERATE_TEXT`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-generate-text.md.txt) | N/A |
| Generative AI remote models | Remote model over an open text generation model^3^ | [`CREATE MODEL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-open.md.txt) | [`ML.EVALUATE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate.md.txt) | [`AI.GENERATE_TEXT`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-generate-text.md.txt) | [Generate text with Gemma and public data](https://docs.cloud.google.com/bigquery/docs/generate-text-tutorial-gemma.md.txt) |
| Generative AI remote models | Remote model over a Google embedding generation model | [`CREATE MODEL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-embedding-maas.md.txt) | N/A | [`AI.GENERATE_EMBEDDING`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-generate-embedding.md.txt) | - [Generate text embeddings using your data](https://docs.cloud.google.com/bigquery/docs/generate-text-embedding.md.txt) - [Generate image embeddings using your data](https://docs.cloud.google.com/bigquery/docs/generate-visual-content-embedding.md.txt) - [Generate video embeddings using your data](https://docs.cloud.google.com/bigquery/docs/generate-video-embedding.md.txt) - [Handle quota errors by calling `ML.GENERATE_EMBEDDING` iteratively](https://docs.cloud.google.com/bigquery/docs/iterate-generate-embedding-calls.md.txt) - [Generate and search multimodal embeddings using public data](https://docs.cloud.google.com/bigquery/docs/generate-multimodal-embeddings.md.txt) |
| Generative AI remote models | Remote model over an open embedding generation model^3^ | [`CREATE MODEL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-open.md.txt) | N/A | [`AI.GENERATE_EMBEDDING`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-generate-embedding.md.txt) | [Generate text embeddings by using an open model and the `AI.GENERATE_EMBEDDING` function](https://docs.cloud.google.com/bigquery/docs/generate-text-embedding-tutorial-open-models.md.txt) |
| Cloud AI remote models | Remote model over the Cloud Vision API | [`CREATE MODEL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-service.md.txt) | N/A | [`ML.ANNOTATE_IMAGE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-annotate-image.md.txt) | [Annotate images](https://docs.cloud.google.com/bigquery/docs/annotate-image.md.txt) |
| Cloud AI remote models | Remote model over the Cloud Translation API | [`CREATE MODEL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-service.md.txt) | N/A | - [`AI.TRANSLATE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-ai-translate.md.txt)^4^ - [`ML.TRANSLATE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-translate.md.txt) | [Translate text](https://docs.cloud.google.com/bigquery/docs/translate-text.md.txt) |
| Cloud AI remote models | Remote model over the Cloud Natural Language API | [`CREATE MODEL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-service.md.txt) | N/A | [`ML.UNDERSTAND_TEXT`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-understand-text.md.txt) | [Understand text](https://docs.cloud.google.com/bigquery/docs/understand-text.md.txt) |
| Cloud AI remote models | Remote model over the Document AI API | [`CREATE MODEL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-service.md.txt) | N/A | [`ML.PROCESS_DOCUMENT`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-process-document.md.txt) | - [Process documents](https://docs.cloud.google.com/bigquery/docs/process-document.md.txt) - [Parse PDFs in a RAG pipeline](https://docs.cloud.google.com/bigquery/docs/rag-pipeline-pdf.md.txt) |
| Cloud AI remote models | Remote model over the Speech-to-Text API | [`CREATE MODEL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-service.md.txt) | N/A | [`ML.TRANSCRIBE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-transcribe.md.txt) | [Transcribe audio files](https://docs.cloud.google.com/bigquery/docs/transcribe.md.txt) |
| Remote model over a custom model deployed to Gemini Enterprise Agent Platform | Remote model over a custom model deployed to Gemini Enterprise Agent Platform | [`CREATE MODEL`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-https.md.txt) | [`ML.EVALUATE`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-evaluate.md.txt) | [`ML.PREDICT`](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-predict.md.txt) | [Make predictions with a custom model](https://docs.cloud.google.com/bigquery/docs/bigquery-ml-remote-model-tutorial.md.txt) |

^1^ Some Gemini models support
[supervised tuning](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-tuned.md.txt#supervised_tuning).

^2^ This function calls a hosted Gemini model, and
doesn't require you to create a model separately using the `CREATE MODEL`
statement.

^3^ You can automatically deploy an open model when you create the
BigQuery ML remote model by specifying the model's Hugging Face
or Agent Platform Model Garden ID. BigQuery
manages the Agent Platform resources of open models deployed in this
way, and lets you interact with those Agent Platform resources by
using the BigQuery ML `ALTER MODEL` and `DROP MODEL`
statements. It also lets you configure automatic undeployment of the model.
For more information, see
[Automatically deployed models](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-open.md.txt#automatically_deployed_models).

^4^ This function calls the Cloud Translation API directly, and
doesn't require you to create a model separately by using the `CREATE MODEL`
statement.