Connecteur pour Vertex AI

Connecteur de workflows qui définit la fonction intégrée permettant d'accéder à Vertex AI dans un workflow.

En savoir plus

Pour obtenir une documentation détaillée incluant cet exemple de code, consultez les pages suivantes :

Exemple de code

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"

Étapes suivantes

Pour rechercher et filtrer des exemples de code pour d'autres produits Google Cloud, consultez l'exemple de navigateur Google Cloud.