diff --git a/gemini/prompts/prompt_optimizer/vertex_ai_prompt_optimizer_sdk.ipynb b/gemini/prompts/prompt_optimizer/vertex_ai_prompt_optimizer_sdk.ipynb index 762ec120c5..f1bd611ed3 100644 --- a/gemini/prompts/prompt_optimizer/vertex_ai_prompt_optimizer_sdk.ipynb +++ b/gemini/prompts/prompt_optimizer/vertex_ai_prompt_optimizer_sdk.ipynb @@ -361,7 +361,9 @@ "- `Storage Object Admin` to read and write to your GCS bucket.\n", "- `Artifact Registry Reader` to download the pipeline template from Artifact Registry.\n", "\n", - "[Check out the documentation](https://cloud.google.com/iam/docs/manage-access-service-accounts#iam-view-access-sa-gcloud) to know how to grant those permissions to a single service account.\n" + "[Check out the documentation](https://cloud.google.com/iam/docs/manage-access-service-accounts#iam-view-access-sa-gcloud) to know how to grant those permissions to a single service account. \n", + "\n", + "**Important**: If you run following commands using Vertex AI Workbench, please directly run in the terminal. " ] }, { @@ -383,17 +385,12 @@ }, "outputs": [], "source": [ - "! gcloud projects add-iam-policy-binding {PROJECT_ID} \\\n", - " --member=serviceAccount:{SERVICE_ACCOUNT} \\\n", - " --role=roles/aiplatform.user\n", - "\n", - "! gcloud projects add-iam-policy-binding {PROJECT_ID} \\\n", - " --member=serviceAccount:{SERVICE_ACCOUNT} \\\n", - " --role=roles/storage.objectAdmin\n", - "\n", - "! gcloud projects add-iam-policy-binding {PROJECT_ID} \\\n", - " --member=serviceAccount:{SERVICE_ACCOUNT} \\\n", - " --role=roles/artifactregistry.reader" + "for role in ['aiplatform.user', 'storage.objectAdmin', 'artifactregistry.reader']:\n", + " \n", + " ! gcloud projects add-iam-policy-binding {PROJECT_ID} \\\n", + " --member=serviceAccount:{SERVICE_ACCOUNT} \\\n", + " --role=roles/{role} \\ \n", + " --condition=None" ] }, { @@ -480,7 +477,7 @@ "\n", "from google.cloud import aiplatform\n", "import pandas as pd\n", - "from utils.helpers import (\n", + "from tutorial.utils.helpers import (\n", " async_generate,\n", " display_eval_report,\n", " evaluate_task,\n", @@ -908,7 +905,11 @@ "source": [ "#### Run the automatic prompt optimization job\n", "\n", - "Now you are ready to run your first Vertex AI Prompt Optimizer (Preview) job using the Vertex AI SDK for Python.\n" + "Now you are ready to run your first Vertex AI Prompt Optimizer (Preview) job using the Vertex AI SDK for Python.\n", + "\n", + "**Important:** Be sure you have provisioned enough queries per minute (QPM) quota and the recommended QPM for each model. If you configure the Vertex AI prompt optimizer with a QPM that is higher than the QPM than you have access to, the job will fail. \n", + "\n", + "[Check out](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/prompt-optimizer#before-you-begin) the documentation to know more. \n" ] }, { @@ -937,7 +938,7 @@ " worker_pool_specs=WORKER_POOL_SPECS,\n", ")\n", "\n", - "custom_job.run()" + "custom_job.run(service_account=SERVICE_ACCOUNT)" ] }, { diff --git a/gemini/prompts/prompt_optimizer/vertex_ai_prompt_optimizer_sdk_custom_metric.ipynb b/gemini/prompts/prompt_optimizer/vertex_ai_prompt_optimizer_sdk_custom_metric.ipynb index fa8b39fca6..3fbdbf2bac 100644 --- a/gemini/prompts/prompt_optimizer/vertex_ai_prompt_optimizer_sdk_custom_metric.ipynb +++ b/gemini/prompts/prompt_optimizer/vertex_ai_prompt_optimizer_sdk_custom_metric.ipynb @@ -372,7 +372,9 @@ "- `Artifact Registry Reader` to download the pipeline template from Artifact Registry.\n", "- `Cloud Run Developer` to deploy function on Cloud Run.\n", "\n", - "[Check out the documentation](https://cloud.google.com/iam/docs/manage-access-service-accounts#iam-view-access-sa-gcloud) to know how to grant those permissions to a single service account.\n" + "[Check out the documentation](https://cloud.google.com/iam/docs/manage-access-service-accounts#iam-view-access-sa-gcloud) to know how to grant those permissions to a single service account.\n", + "\n", + "**Important**: If you run following commands using Vertex AI Workbench, please directly run in the terminal. \n" ] }, { @@ -398,7 +400,8 @@ " \n", " ! gcloud projects add-iam-policy-binding {PROJECT_ID} \\\n", " --member=serviceAccount:{SERVICE_ACCOUNT} \\\n", - " --role=roles/{role}" + " --role=roles/{role} \\ \n", + " --condition=None" ] }, { @@ -1146,7 +1149,11 @@ "source": [ "#### Run the automatic prompt optimization job\n", "\n", - "Now you are ready to run your first Vertex AI Prompt Optimizer (Preview) job using the Vertex AI SDK for Python.\n" + "Now you are ready to run your first Vertex AI Prompt Optimizer (Preview) job using the Vertex AI SDK for Python.\n", + "\n", + "**Important:** Be sure you have provisioned enough queries per minute (QPM) quota and the recommended QPM for each model. If you configure the Vertex AI prompt optimizer with a QPM that is higher than the QPM than you have access to, the job will fail. \n", + "\n", + "[Check out](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/prompt-optimizer#before-you-begin) the documentation to know more. " ] }, {