Connettore per Vertex AI

Connettore Workflows che definisce la funzione integrata utilizzata per accedere a Vertex AI all'interno di un flusso di lavoro.

Per saperne di più

Per la documentazione dettagliata che include questo esempio di codice, consulta quanto segue:

Esempio di codice

YAML

# This workflow demonstrates how to use the aiplatform (Vertex AI) connector.
# This workflow creates a Vertex AI custom Job and then deletes the
# job once the long-running operation of creating the job completes.
# Expected successful output: "SUCCESS"
main:
  steps:
    - init:
        assign:
          - location: ${sys.get_env("GOOGLE_CLOUD_LOCATION")}
          - project: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
          # Follow https://cloud.google.com/vertex-ai/docs/training/create-custom-container to build
          # a custom container image for training.
          - container_image_uri: "IMAGE_URI"
    - create_custom_job:
        call: googleapis.aiplatform.v1.projects.locations.customJobs.create
        args:
          parent: ${"projects/" + project + "/locations/" + location}
          region: ${location}
          body:
            displayName: "example-custom-job"
            jobSpec:
              workerPoolSpecs:
                - machineSpec:
                    machineType: "n1-standard-4"
                    acceleratorType: "NVIDIA_TESLA_V100"
                    acceleratorCount: 1
                  replicaCount: 1
                  containerSpec:
                    imageUri: ${container_image_uri}
                    command: []
                    args: []
        result: customJobsResponse
    - delete_custom_job:
        call: googleapis.aiplatform.v1.projects.locations.customJobs.delete
        args:
          name: ${customJobsResponse.name}
          region: ${location}
        result: deleteCustomJobResponse
    - return:
        return: "SUCCESS"

Passaggi successivi

Per cercare e filtrare esempi di codice per altri prodotti Google Cloud, consulta il browser di esempio di Google Cloud.