Mulai 29 April 2025, model Gemini 1.5 Pro dan Gemini 1.5 Flash tidak tersedia di project yang belum pernah menggunakan model ini, termasuk project baru. Untuk mengetahui detailnya, lihat Versi dan siklus proses model.
Halaman ini menjelaskan cara menyetel filter Responsible AI (RAI) di
Imagen di Vertex AI.
Ada beberapa parameter pemfilteran RAI yang dapat Anda gunakan dengan
model Imagen di Vertex AI. Misalnya, Anda dapat mengizinkan model melaporkan kode filter RAI untuk konten yang diblokir, menonaktifkan pembuatan orang atau wajah menggunakan filter RAI, menetapkan tingkat pemfilteran konten, atau menampilkan skor RAI yang dibulatkan dari daftar atribut keamanan untuk input dan output.
Setelan yang tersedia bergantung pada versi model Imagen yang Anda gunakan. Untuk mengetahui informasi selengkapnya, lihat model
Imagen dan referensi
API.
Klik Imagen. Halaman pembuatan gambar Imagen Media Studio akan ditampilkan.
Di panel Setelan, sesuaikan opsi berikut:
Model: Pilih model dari opsi yang tersedia.
Untuk mengetahui informasi selengkapnya tentang model yang tersedia, lihat Model Imagen
Jumlah hasil: Sesuaikan penggeser atau masukkan nilai antara
1 dan 4.
Di bagian Keamanan, konfigurasikan setelan berikut:
Pilih salah satu setelan Pembuatan orang berikut:
Izinkan (Khusus dewasa): Hanya buat orang atau wajah dewasa.
Jangan membuat gambar atau wajah orang atau anak-anak muda.
Izinkan (Semua usia): Membuat orang atau wajah dari semua usia.
Jangan izinkan: Jangan membuat orang atau wajah.
Pilih salah satu setelan Batas filter keamanan berikut:
Blokir sebagian besar: Memblokir sebagian besar konten berbahaya.
Memblokir sebagian: Memblokir beberapa perintah dan respons yang bermasalah.
Blokir sedikit: Memblokir sedikit perintah dan respons yang bermasalah.
Di kotak Tulis perintah Anda, masukkan perintah teks yang menjelaskan gambar yang akan dibuat. Misalnya, ilustrasi cat air perahu kecil di atas air pada pagi hari.
Klik sendBuat.
REST
Sebelum menggunakan salah satu data permintaan,
lakukan penggantian berikut:
LOCATION: Region project Anda. Misalnya,
us-central1, europe-west2, atau asia-northeast3. Untuk mengetahui daftar
region yang tersedia, lihat
Lokasi AI Generatif di Vertex AI.
TEXT_PROMPT: Perintah teks yang memandu gambar yang dihasilkan
model. Kolom ini wajib diisi untuk pembuatan dan pengeditan.
IMAGE_COUNT: Jumlah gambar yang dihasilkan.
Nilai bilangan bulat yang diterima: 1-8 (imagegeneration@002), 1-4 (semua versi model lainnya).
Nilai default: 4.
SAFETY_SETTING: string. Opsional. Setelan yang mengontrol batas filter keamanan
untuk gambar yang dihasilkan. Nilai yang tersedia:
block_low_and_above: Nilai minimum keamanan tertinggi, sehingga menghasilkan jumlah
gambar yang dihasilkan paling banyak yang difilter. Nilai sebelumnya: block_most.
block_medium_and_above (default): Batas keamanan sedang yang menyeimbangkan pemfilteran untuk konten yang berpotensi berbahaya dan aman. Nilai sebelumnya: block_some.
block_only_high: Batas keamanan yang mengurangi jumlah permintaan yang diblokir karena filter keamanan. Setelan ini dapat meningkatkan konten tidak pantas yang dibuat oleh Imagen. Nilai sebelumnya: block_few.
PERSON_SETTING: string. Opsional. Setelan keamanan yang mengontrol jenis orang atau pembuatan wajah yang diizinkan oleh model. Nilai yang tersedia:
allow_adult (default): Mengizinkan pembuatan gambar khusus dewasa, kecuali pembuatan gambar selebritas. Pembuatan gambar selebritas tidak diizinkan untuk setelan apa pun.
dont_allow: Menonaktifkan penyertaan orang atau wajah dalam gambar yang dihasilkan.
INCLUDE_RAI_REASON: boolean. Opsional. Apakah akan mengaktifkan kode alasan yang difilter Responsible AI dalam respons dengan input atau output yang diblokir. Nilai default:
true.
INCLUDE_SAFETY_ATTRIBUTES: boolean. Opsional. Apakah akan mengaktifkan skor Responsible AI yang dibulatkan untuk daftar atribut keamanan dalam respons untuk input dan output yang tidak difilter. Kategori atribut keamanan: "Death, Harm & Tragedy",
"Firearms & Weapons", "Hate", "Health",
"Illicit Drugs", "Politics", "Porn",
"Religion & Belief", "Toxic", "Violence",
"Vulgarity", "War & Conflict". Nilai default: false.
Metode HTTP dan URL:
POST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagegeneration@006:predict
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[],[],null,["| **Caution:** Starting on June 24, 2025, Imagen versions 1 and 2 are deprecated. Imagen models `imagegeneration@002`, `imagegeneration@005`, and `imagegeneration@006` will be removed on September 24, 2025 . For more information about migrating to Imagen 3, see [Migrate to\n| Imagen 3](/vertex-ai/generative-ai/docs/image/migrate-to-imagen-3).\n\n\u003cbr /\u003e\n\n\n[Try image generation (Vertex AI Studio)](https://console.cloud.google.com/vertex-ai/studio/media/generate;tab=image)\n\n[Try Imagen in a Colab](https://colab.research.google.com/github/GoogleCloudPlatform/generative-ai/blob/main/vision/getting-started/imagen4_image_generation.ipynb)\n\nThis page describes how to set Responsible AI (RAI) filters in\nImagen on Vertex AI.\n\nThere are several RAI filtering parameters that you can use with\nImagen on Vertex AI models. For example, you can let the model report RAI filter\ncodes for blocked content, disable people or face generation using RAI filters,\nset the level of content filtering, or return rounded RAI scores of list of\nsafety attributes for input and output.\n\nThe available settings depend on the Imagen model version that\nyou use. For more information, see [Imagen\nmodels](/vertex-ai/generative-ai/docs/models#imagen-models) and the [API\nreference](/vertex-ai/generative-ai/docs/model-reference/image-generation).\n\nFor more information about RAI, see [Responsible AI and usage guidelines for\nImagen](/vertex-ai/generative-ai/docs/image/responsible-ai-imagen).\n\nSet RAI parameters\n\nDo the following: \n\nConsole\n\n1. In the Google Cloud console, go to the **Vertex AI \\\u003e Media\n Studio** page.\n\n [Go to Media\n Studio](https://console.cloud.google.com/vertex-ai/studio/media/generate;tab=image)\n2. Click **Imagen**. The Imagen Media Studio image generation page is\n displayed.\n\n3. In the **Settings** panel, adjust the following options:\n\n - **Model**: Choose a model from the available options.\n\n For more information about available models, see [Imagen\n models](/vertex-ai/generative-ai/docs/models#imagen-models)\n - **Number of results** : Adjust the slider or enter a value between\n **1** and **4**.\n\n4. In the **Safety** section configure the following settings:\n\n - Select one of the following **Person generation** settings:\n\n - **Allow (Adults only)**: Generate adult people or faces only. Don't generate youth or children people or faces.\n - **Allow (All ages)**: Generate people or faces of all ages.\n - **Don't allow**: Don't generate people or faces.\n - Select one of the following **Safety filter threshold** settings:\n\n - **Block most**: Blocks the most of the harmful content.\n - **Block some**: Blocks some problematic prompts and responses.\n - **Block few**: Blocks very few problematic prompts and responses.\n5. In the **Write your prompt** box, enter your text prompt that describes\n the images to generate. For example, **small boat on water in the morning\n watercolor illustration**.\n\n6. Click send **Generate**.\n\nREST\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#identifiers).\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: Your project's region. For example, `us-central1`, `europe-west2`, or `asia-northeast3`. For a list of available regions, see [Generative AI on Vertex AI locations](/vertex-ai/generative-ai/docs/learn/locations-genai).\n- \u003cvar translate=\"no\"\u003eTEXT_PROMPT\u003c/var\u003e: The text prompt that guides what images the model generates. This field is required for both generation and editing.\n- \u003cvar translate=\"no\"\u003eIMAGE_COUNT\u003c/var\u003e: The number of generated images. Accepted integer values: 1-8 (`imagegeneration@002`), 1-4 (all other model versions). Default value: 4.\n- \u003cvar translate=\"no\"\u003eSAFETY_SETTING\u003c/var\u003e: string. Optional. A setting that controls safety filter thresholds for generated images. Available values:\n - `block_low_and_above`: The highest safety threshold, resulting in the largest amount of generated images that are filtered. Previous value: `block_most`.\n - `block_medium_and_above` (default): A medium safety threshold that balances filtering for potentially harmful and safe content. Previous value: `block_some`.\n - `block_only_high`: A safety threshold that reduces the number of requests blocked due to safety filters. This setting might increase objectionable content generated by Imagen. Previous value: `block_few`.\n- \u003cvar translate=\"no\"\u003ePERSON_SETTING\u003c/var\u003e: string. Optional. The safety setting that controls the type of people or face generation the model allows. Available values:\n - `allow_adult` (default): Allow generation of adults only, except for celebrity generation. Celebrity generation is not allowed for any setting.\n - `dont_allow`: Disable the inclusion of people or faces in generated images.\n- \u003cvar translate=\"no\"\u003eINCLUDE_RAI_REASON\u003c/var\u003e: boolean. Optional. Whether to enable the [Responsible AI filtered reason\n code](/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-categories) in responses with blocked input or output. Default value: `true`.\n- \u003cvar translate=\"no\"\u003eINCLUDE_SAFETY_ATTRIBUTES\u003c/var\u003e: boolean. Optional. Whether to enable rounded Responsible AI scores for a list of safety attributes in responses for unfiltered input and output. Safety attribute categories: `\"Death, Harm & Tragedy\"`, `\"Firearms & Weapons\"`, `\"Hate\"`, `\"Health\"`, `\"Illicit Drugs\"`, `\"Politics\"`, `\"Porn\"`, `\"Religion & Belief\"`, `\"Toxic\"`, `\"Violence\"`, `\"Vulgarity\"`, `\"War & Conflict\"`. Default value: `false`.\n\n\nHTTP method and URL:\n\n```\nPOST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagegeneration@006:predict\n```\n\n\nRequest JSON body:\n\n```\n{\n \"instances\": [\n {\n \"prompt\": \"TEXT_PROMPT\"\n }\n ],\n \"parameters\": {\n \"sampleCount\": IMAGE_COUNT,\n \"safetySetting\": \"\u003cvar translate=\"no\"\u003eSAFETY_SETTING\u003c/var\u003e\",\n \"personGeneration\": \"\u003cvar translate=\"no\"\u003ePERSON_SETTING\u003c/var\u003e\",\n \"includeRaiReason\": \u003cvar translate=\"no\"\u003eINCLUDE_RAI_REASON\u003c/var\u003e,\n \"includeSafetyAttributes\": \u003cvar translate=\"no\"\u003eINCLUDE_SAFETY_ATTRIBUTES\u003c/var\u003e\n }\n}\n```\n\nTo send your request, choose one of these options: \n\ncurl **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\ncurl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @request.json \\\n \"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagegeneration@006:predict\"\n```\n\nPowerShell **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method POST `\n -Headers $headers `\n -ContentType: \"application/json; charset=utf-8\" `\n -InFile request.json `\n -Uri \"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagegeneration@006:predict\" | Select-Object -Expand Content\n```\nThe response you get depends on the safety settings you set. For more information, see [Understand and configure\nResponsible AI (RAI) for Imagen](/vertex-ai/generative-ai/docs/image/responsible-ai-imagen).\n\n\u003cbr /\u003e\n\nWhat's next\n\n- [Responsible AI and usage guidelines for\n Imagen](/vertex-ai/generative-ai/docs/image/responsible-ai-imagen)\n\n- [Verify an image\n watermark](/vertex-ai/generative-ai/docs/image/verify-watermark)"]]