A partir de 29 de abril de 2025, os modelos Gemini 1.5 Pro e Gemini 1.5 Flash não estarão disponíveis em projetos que não os usaram antes, incluindo novos projetos. Para mais detalhes, consulte Versões e ciclo de vida do modelo.
Nesta página, descrevemos como definir filtros de IA responsável (RAI, na sigla em inglês) na
Imagen na Vertex AI.
Há vários parâmetros de filtragem da RAI que podem ser usados com
modelos da Imagen na Vertex AI. Por exemplo, é possível permitir que o modelo informe códigos de filtro de RAI
para conteúdo bloqueado, desative pessoas ou geração de rostos usando filtros de RAI,
defina o nível de filtragem de conteúdo ou retorne pontuações de RAI arredondadas da lista de
atributos de segurança para entrada e saída.
As configurações disponíveis dependem da versão do modelo do Imagen que você usa. Para mais informações, consulte Modelos
do Imagen e a Referência
da API.
Clique em Imagen. A página de geração de imagens do Imagen Media Studio é exibida.
No painel Configurações, ajuste as seguintes opções:
Modelo: escolha um modelo entre as opções disponíveis.
Para mais informações sobre os modelos disponíveis, consulte Modelos do Imagen.
Número de resultados: ajuste o controle deslizante ou insira um valor entre 1 e 4.
Na seção Segurança, configure as seguintes opções:
Selecione uma das seguintes configurações de Geração de pessoas:
Permitir (somente adultos): gera somente pessoas ou rostos adultos.
Não gere pessoas ou rostos de jovens ou crianças.
Permitir (todas as idades): gera pessoas ou rostos de todas as idades.
Não permitir: não gera pessoas nem rostos.
Selecione uma das seguintes configurações de Limite do filtro de segurança:
Bloquear muitos: bloqueia a maior parte do conteúdo nocivo.
Bloquear alguns: bloqueia alguns comandos e respostas problemáticos.
Bloquear poucos: bloqueia poucos comandos e respostas problemáticos.
Na caixa Escreva seu comando, insira o comando de texto que descreve
as imagens a serem geradas. Por exemplo, ilustração em aquarela de pequeno barco na água durante a manhã.
Clique em sendGerar.
REST
Antes de usar os dados da solicitação,
faça as seguintes substituições:
LOCATION: a região do seu projeto. Por exemplo, us-central1, europe-west2 ou asia-northeast3. Para uma lista
de regiões disponíveis, consulte
IA generativa em locais da Vertex AI.
TEXT_PROMPT: o comando de texto que orienta quais imagens o modelo gera. Este campo é obrigatório para geração e edição.
IMAGE_COUNT: o número de imagens geradas.
Valores inteiros aceitos: 1 a 8 (imagegeneration@002), 1 a 4 (todas as outras versões de modelo).
Valor padrão: 4.
SAFETY_SETTING: string. Opcional. Uma configuração que controla os limites de filtro de segurança
para as imagens geradas. Valores disponíveis:
block_low_and_above: o limite de segurança mais alto, resultando na maior quantidade de imagens geradas que são filtradas. Valor anterior: block_most.
block_medium_and_above (padrão): um limite de segurança médio que equilibra
a filtragem de
conteúdo potencialmente nocivo e seguro. Valor anterior: block_some.
block_only_high: um limite de segurança que reduz o número de solicitações bloqueadas devido a filtros de segurança. Essa configuração pode aumentar o conteúdo censurável gerado pelo
Imagen. Valor anterior: block_few.
PERSON_SETTING: string. Opcional. A configuração de segurança que controla o tipo de
pessoas ou geração de rostos permitida pelo modelo. Valores disponíveis:
allow_adult (padrão): permite a geração somente de adultos, exceto para celebridades. A geração de celebridades não é permitida em nenhuma configuração.
dont_allow: desativa a inclusão de pessoas ou rostos nas imagens geradas.
INCLUDE_RAI_REASON: booleano. Opcional. Define se o código de motivo filtrado da IA responsável será ativado em respostas com entrada ou saída bloqueada. Valor padrão: true.
INCLUDE_SAFETY_ATTRIBUTES: booleano. Opcional. Define se as pontuações de IA responsável arredondadas serão ativadas para uma lista de atributos de segurança nas respostas de entrada e saída não filtradas. Categorias de atributos de segurança: "Death, Harm & Tragedy", "Firearms & Weapons", "Hate", "Health", "Illicit Drugs", "Politics", "Porn", "Religion & Belief", "Toxic", "Violence", "Vulgarity", "War & Conflict". Valor padrão: false.
Método HTTP e URL:
POST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagegeneration@006:predict
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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)"]]