Konektor untuk Vertex AI

Konektor alur kerja yang menentukan fungsi bawaan yang digunakan untuk mengakses Vertex AI dalam alur kerja.

Mempelajari lebih lanjut

Untuk dokumentasi mendetail yang menyertakan contoh kode ini, lihat artikel berikut:

Contoh kode

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"

Langkah selanjutnya

Untuk menelusuri dan memfilter contoh kode untuk produk Google Cloud lainnya, lihat Google Cloud browser contoh.