Skip to main content

models

Creates, updates, deletes, gets or lists a models resource.

Overview

Namemodels
TypeResource
Idgoogle.aiplatform.models

Fields

NameDatatypeDescription
namestringThe resource name of the Model.
descriptionstringThe description of the Model.
artifactUristringImmutable. The path to the directory containing the Model artifact and any of its supporting files. Not required for AutoML Models.
baseModelSourceobjectUser input field to specify the base model source. Currently it only supports specifing the Model Garden models and Genie models.
containerSpecobjectSpecification of a container for serving predictions. Some fields in this message correspond to fields in the Kubernetes Container v1 core specification.
createTimestringOutput only. Timestamp when this Model was uploaded into Vertex AI.
dataStatsobjectStats of data used for train or evaluate the Model.
deployedModelsarrayOutput only. The pointers to DeployedModels created from this Model. Note that Model could have been deployed to Endpoints in different Locations.
displayNamestringRequired. The display name of the Model. The name can be up to 128 characters long and can consist of any UTF-8 characters.
encryptionSpecobjectRepresents a customer-managed encryption key spec that can be applied to a top-level resource.
etagstringUsed to perform consistent read-modify-write updates. If not set, a blind "overwrite" update happens.
explanationSpecobjectSpecification of Model explanation.
labelsobjectThe labels with user-defined metadata to organize your Models. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels.
metadataanyImmutable. An additional information about the Model; the schema of the metadata can be found in metadata_schema. Unset if the Model does not have any additional information.
metadataArtifactstringOutput only. The resource name of the Artifact that was created in MetadataStore when creating the Model. The Artifact resource name pattern is projects/{project}/locations/{location}/metadataStores/{metadata_store}/artifacts/{artifact}.
metadataSchemaUristringImmutable. Points to a YAML file stored on Google Cloud Storage describing additional information about the Model, that is specific to it. Unset if the Model does not have any additional information. The schema is defined as an OpenAPI 3.0.2 Schema Object. AutoML Models always have this field populated by Vertex AI, if no additional metadata is needed, this field is set to an empty string. Note: The URI given on output will be immutable and probably different, including the URI scheme, than the one given on input. The output URI will point to a location where the user only has a read access.
modelSourceInfoobjectDetail description of the source information of the model.
originalModelInfoobjectContains information about the original Model if this Model is a copy.
pipelineJobstringOptional. This field is populated if the model is produced by a pipeline job.
predictSchemataobjectContains the schemata used in Model's predictions and explanations via PredictionService.Predict, PredictionService.Explain and BatchPredictionJob.
satisfiesPzibooleanOutput only. Reserved for future use.
satisfiesPzsbooleanOutput only. Reserved for future use.
supportedDeploymentResourcesTypesarrayOutput only. When this Model is deployed, its prediction resources are described by the prediction_resources field of the Endpoint.deployed_models object. Because not all Models support all resource configuration types, the configuration types this Model supports are listed here. If no configuration types are listed, the Model cannot be deployed to an Endpoint and does not support online predictions (PredictionService.Predict or PredictionService.Explain). Such a Model can serve predictions by using a BatchPredictionJob, if it has at least one entry each in supported_input_storage_formats and supported_output_storage_formats.
supportedExportFormatsarrayOutput only. The formats in which this Model may be exported. If empty, this Model is not available for export.
supportedInputStorageFormatsarrayOutput only. The formats this Model supports in BatchPredictionJob.input_config. If PredictSchemata.instance_schema_uri exists, the instances should be given as per that schema. The possible formats are: jsonl The JSON Lines format, where each instance is a single line. Uses GcsSource. csv The CSV format, where each instance is a single comma-separated line. The first line in the file is the header, containing comma-separated field names. Uses GcsSource. tf-record The TFRecord format, where each instance is a single record in tfrecord syntax. Uses GcsSource. tf-record-gzip Similar to tf-record, but the file is gzipped. Uses GcsSource. bigquery Each instance is a single row in BigQuery. Uses BigQuerySource. file-list Each line of the file is the location of an instance to process, uses gcs_source field of the InputConfig object. If this Model doesn't support any of these formats it means it cannot be used with a BatchPredictionJob. However, if it has supported_deployment_resources_types, it could serve online predictions by using PredictionService.Predict or PredictionService.Explain.
supportedOutputStorageFormatsarrayOutput only. The formats this Model supports in BatchPredictionJob.output_config. If both PredictSchemata.instance_schema_uri and PredictSchemata.prediction_schema_uri exist, the predictions are returned together with their instances. In other words, the prediction has the original instance data first, followed by the actual prediction content (as per the schema). The possible formats are: jsonl The JSON Lines format, where each prediction is a single line. Uses GcsDestination. csv The CSV format, where each prediction is a single comma-separated line. The first line in the file is the header, containing comma-separated field names. Uses GcsDestination. * bigquery Each prediction is a single row in a BigQuery table, uses BigQueryDestination . If this Model doesn't support any of these formats it means it cannot be used with a BatchPredictionJob. However, if it has supported_deployment_resources_types, it could serve online predictions by using PredictionService.Predict or PredictionService.Explain.
trainingPipelinestringOutput only. The resource name of the TrainingPipeline that uploaded this Model, if any.
updateTimestringOutput only. Timestamp when this Model was most recently updated.
versionAliasesarrayUser provided version aliases so that a model version can be referenced via alias (i.e. projects/{project}/locations/{location}/models/{model_id}@{version_alias} instead of auto-generated version id (i.e. projects/{project}/locations/{location}/models/{model_id}@{version_id}). The format is a-z{0,126}[a-z0-9] to distinguish from version_id. A default version alias will be created for the first version of the model, and there must be exactly one default version alias for a model.
versionCreateTimestringOutput only. Timestamp when this version was created.
versionDescriptionstringThe description of this version.
versionIdstringOutput only. Immutable. The version ID of the model. A new version is committed when a new model version is uploaded or trained under an existing model id. It is an auto-incrementing decimal number in string representation.
versionUpdateTimestringOutput only. Timestamp when this version was most recently updated.

Methods

NameAccessible byRequired ParamsDescription
getSELECTlocationsId, modelsId, projectsIdGets a Model.
listSELECTlocationsId, projectsIdLists Models in a Location.
deleteDELETElocationsId, modelsId, projectsIdDeletes a Model. A model cannot be deleted if any Endpoint resource has a DeployedModel based on the model in its deployed_models field.
patchUPDATElocationsId, modelsId, projectsIdUpdates a Model.
compute_tokensEXEClocationsId, modelsId, projectsId, publishersIdReturn a list of tokens based on the input text.
copyEXEClocationsId, projectsIdCopies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When copying custom Models, the users themselves are responsible for Model.metadata content to be region-agnostic, as well as making sure that any resources (e.g. files) it depends on remain accessible.
count_tokensEXEClocationsId, modelsId, projectsId, publishersIdPerform a token counting.
exportEXEClocationsId, modelsId, projectsIdExports a trained, exportable Model to a location specified by the user. A Model is considered to be exportable if it has at least one supported export format.
generate_contentEXEClocationsId, modelsId, projectsId, publishersIdGenerate content with multimodal inputs.
merge_version_aliasesEXEClocationsId, modelsId, projectsIdMerges a set of aliases for a Model version.
predictEXEClocationsId, modelsId, projectsId, publishersIdPerform an online prediction.
raw_predictEXEClocationsId, modelsId, projectsId, publishersIdPerform an online prediction with an arbitrary HTTP payload. The response includes the following HTTP headers: X-Vertex-AI-Endpoint-Id: ID of the Endpoint that served this prediction. X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint's DeployedModel that served this prediction.
server_streaming_predictEXEClocationsId, modelsId, projectsId, publishersIdPerform a server-side streaming online prediction request for Vertex LLM streaming.
stream_generate_contentEXEClocationsId, modelsId, projectsId, publishersIdGenerate content with multimodal inputs with streaming support.
stream_raw_predictEXEClocationsId, modelsId, projectsId, publishersIdPerform a streaming online prediction with an arbitrary HTTP payload.
uploadEXEClocationsId, projectsIdUploads a Model artifact into Vertex AI.

SELECT examples

Lists Models in a Location.

SELECT
name,
description,
artifactUri,
baseModelSource,
containerSpec,
createTime,
dataStats,
deployedModels,
displayName,
encryptionSpec,
etag,
explanationSpec,
labels,
metadata,
metadataArtifact,
metadataSchemaUri,
modelSourceInfo,
originalModelInfo,
pipelineJob,
predictSchemata,
satisfiesPzi,
satisfiesPzs,
supportedDeploymentResourcesTypes,
supportedExportFormats,
supportedInputStorageFormats,
supportedOutputStorageFormats,
trainingPipeline,
updateTime,
versionAliases,
versionCreateTime,
versionDescription,
versionId,
versionUpdateTime
FROM google.aiplatform.models
WHERE locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

UPDATE example

Updates a models resource.

/*+ update */
UPDATE google.aiplatform.models
SET
pipelineJob = '{{ pipelineJob }}',
explanationSpec = '{{ explanationSpec }}',
name = '{{ name }}',
versionDescription = '{{ versionDescription }}',
encryptionSpec = '{{ encryptionSpec }}',
artifactUri = '{{ artifactUri }}',
predictSchemata = '{{ predictSchemata }}',
etag = '{{ etag }}',
containerSpec = '{{ containerSpec }}',
baseModelSource = '{{ baseModelSource }}',
labels = '{{ labels }}',
dataStats = '{{ dataStats }}',
description = '{{ description }}',
versionAliases = '{{ versionAliases }}',
metadataSchemaUri = '{{ metadataSchemaUri }}',
metadata = '{{ metadata }}',
displayName = '{{ displayName }}'
WHERE
locationsId = '{{ locationsId }}'
AND modelsId = '{{ modelsId }}'
AND projectsId = '{{ projectsId }}';

DELETE example

Deletes the specified models resource.

/*+ delete */
DELETE FROM google.aiplatform.models
WHERE locationsId = '{{ locationsId }}'
AND modelsId = '{{ modelsId }}'
AND projectsId = '{{ projectsId }}';