Thinking

Os modelos de raciocínio são treinados para gerar o "processo de raciocínio" que o modelo realiza como parte da resposta. Por isso, os modelos de pensamento crítico têm uma capacidade de raciocínio mais forte nas respostas do que os modelos básicos equivalentes.

O processo de pensamento é ativado por padrão. Ao usar o Vertex AI Studio, você pode conferir todo o processo de pensamento junto com a resposta gerada pelo modelo.

Modelos compatíveis

O recurso de pensamento é compatível com os seguintes modelos:

Usar um modelo de pensamento

Para usar o recurso "Pensar" com um modelo compatível, faça o seguinte:

Console

  1. Abra Vertex AI Studio > Criar comando.
  2. No painel Modelo, clique em Mudar modelo e selecione um dos modelos compatíveis no menu.
    • (Somente Gemini 2.5 Flash) O orçamento de raciocínio é definido como Automático por padrão quando o modelo é carregado.
  3. (Opcional) Dê instruções detalhadas sobre como o modelo deve formatar as respostas no campo Instruções do sistema.
  4. Digite um comando no campo Escreva seu comando.
  5. Clique em Executar.

O Gemini retorna uma resposta depois que ela é gerada. Dependendo da complexidade da resposta, a geração pode levar vários segundos:

(Somente Gemini 2.5 Flash) Para desativar o pensamento, defina Orçamento de pensamento como Desativado.

Python

Instalar

pip install --upgrade google-genai

Para saber mais, consulte a documentação de referência do SDK.

Defina variáveis de ambiente para usar o SDK de IA generativa com a Vertex AI:

# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values
# with appropriate values for your project.
export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT
export GOOGLE_CLOUD_LOCATION=global
export GOOGLE_GENAI_USE_VERTEXAI=True

from google import genai

client = genai.Client()
response = client.models.generate_content(
    model="gemini-2.5-pro",
    contents="solve x^2 + 4x + 4 = 0",
)
print(response.text)
# Example Response:
#     Okay, let's solve the quadratic equation x² + 4x + 4 = 0.
#
#     We can solve this equation by factoring, using the quadratic formula, or by recognizing it as a perfect square trinomial.
#
#     **Method 1: Factoring**
#
#     1.  We need two numbers that multiply to the constant term (4) and add up to the coefficient of the x term (4).
#     2.  The numbers 2 and 2 satisfy these conditions: 2 * 2 = 4 and 2 + 2 = 4.
#     3.  So, we can factor the quadratic as:
#         (x + 2)(x + 2) = 0
#         or
#         (x + 2)² = 0
#     4.  For the product to be zero, the factor must be zero:
#         x + 2 = 0
#     5.  Solve for x:
#         x = -2
#
#     **Method 2: Quadratic Formula**
#
#     The quadratic formula for an equation ax² + bx + c = 0 is:
#     x = [-b ± sqrt(b² - 4ac)] / (2a)
#
#     1.  In our equation x² + 4x + 4 = 0, we have a=1, b=4, and c=4.
#     2.  Substitute these values into the formula:
#         x = [-4 ± sqrt(4² - 4 * 1 * 4)] / (2 * 1)
#         x = [-4 ± sqrt(16 - 16)] / 2
#         x = [-4 ± sqrt(0)] / 2
#         x = [-4 ± 0] / 2
#         x = -4 / 2
#         x = -2
#
#     **Method 3: Perfect Square Trinomial**
#
#     1.  Notice that the expression x² + 4x + 4 fits the pattern of a perfect square trinomial: a² + 2ab + b², where a=x and b=2.
#     2.  We can rewrite the equation as:
#         (x + 2)² = 0
#     3.  Take the square root of both sides:
#         x + 2 = 0
#     4.  Solve for x:
#         x = -2
#
#     All methods lead to the same solution.
#
#     **Answer:**
#     The solution to the equation x² + 4x + 4 = 0 is x = -2. This is a repeated root (or a root with multiplicity 2).

Go

Saiba como instalar ou atualizar o Go.

Para saber mais, consulte a documentação de referência do SDK.

Defina variáveis de ambiente para usar o SDK de IA generativa com a Vertex AI:

# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values
# with appropriate values for your project.
export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT
export GOOGLE_CLOUD_LOCATION=global
export GOOGLE_GENAI_USE_VERTEXAI=True

import (
	"context"
	"fmt"
	"io"

	"google.golang.org/genai"
)

// generateThinkingWithText shows how to generate thinking using a text prompt.
func generateThinkingWithText(w io.Writer) error {
	ctx := context.Background()

	client, err := genai.NewClient(ctx, &genai.ClientConfig{
		HTTPOptions: genai.HTTPOptions{APIVersion: "v1"},
	})
	if err != nil {
		return fmt.Errorf("failed to create genai client: %w", err)
	}

	resp, err := client.Models.GenerateContent(ctx,
		"gemini-2.5-flash",
		genai.Text("solve x^2 + 4x + 4 = 0"),
		nil,
	)
	if err != nil {
		return fmt.Errorf("failed to generate content: %w", err)
	}

	respText := resp.Text()

	fmt.Fprintln(w, respText)
	// Example response:
	// To solve the quadratic equation $x^2 + 4x + 4 = 0$, we can use a few methods:
	//
	// **Method 1: Factoring (Recognizing a Perfect Square Trinomial)**
	// **1. The Foundation: Data and Algorithms**
	//
	// Notice that the left side of the equation is a perfect square trinomial.
	// ...

	return nil
}

Controlar o raciocínio do modelo

Você pode controlar a quantidade de raciocínio que o modelo faz antes de retornar uma resposta. O método para controlar o pensamento varia de acordo com a versão do modelo.

Modelos Gemini 3 e mais recentes

Os modelos do Gemini 3 introduzem o parâmetro thinking_level, que simplifica a configuração do orçamento de pensamento em níveis. Por padrão, o Gemini 3 Pro usa o pensamento dinâmico para analisar os comandos. Para respostas mais rápidas e com menor latência quando não é necessário um raciocínio complexo, você pode restringir o thinking_level do modelo.

  • LOW: restringe o modelo a usar menos tokens para pensar e é adequado para tarefas mais simples em que não é necessário um raciocínio extenso. O LOW é ideal para tarefas de alta capacidade de processamento em que a velocidade é essencial:

    from google import genai
    from google.genai import types
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3-pro-preview",
        contents="How does AI work?",
        config=types.GenerateContentConfig(
            thinking_config=types.ThinkingConfig(
                thinking_level=types.ThinkingLevel.LOW
            )
        ),
    )
    print(response.text)
    
  • HIGH: permite que o modelo use mais tokens para pensar e é adequado para comandos complexos que exigem raciocínio profundo, como planejamento em várias etapas, geração de código verificada ou cenários avançados de chamada de função. Esse é o nível padrão do Gemini 3 Pro. Use essa configuração ao substituir tarefas que antes dependiam de modelos de raciocínio especializados:

    from google import genai
    from google.genai import types
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3-pro-preview",
        contents="Find the race condition in this multi-threaded C++ snippet: [code here]",
        config=types.GenerateContentConfig(
            thinking_config=types.ThinkingConfig(
                thinking_level=types.ThinkingLevel.HIGH
            )
        ),
    )
    print(response.text)
    

Não é possível desativar o recurso de pensamento do Gemini 3 Pro.

Se você especificar thinking_level e thinking_budget na mesma solicitação para um modelo do Gemini 3, o modelo vai retornar um erro.

Modelos Gemini 2.5 e anteriores

Para modelos anteriores ao Gemini 3, é possível controlar o raciocínio usando o parâmetro thinking_budget, que define um limite máximo para o número de tokens que o modelo pode usar no processo de raciocínio. Por padrão, se thinking_budget não estiver definido, o modelo vai controlar automaticamente o quanto ele pensa,até um máximo de 8.192 tokens. Para usar o orçamento dinâmico pela API, defina thinking_budget como -1.

É possível definir manualmente thinking_budget para um limite de token específico em situações em que você pode precisar de mais ou menos tempo de reflexão do que o padrão. Defina um limite de token mais baixo para tarefas menos complexas ou um limite mais alto para tarefas mais complexas. Se a latência for mais importante, use um orçamento menor ou desative o pensamento definindo o orçamento como 0.

A tabela a seguir mostra os valores mínimos e máximos que você pode definir para thinking_budget em cada modelo compatível:

Modelo Valor mínimo de token Quantidade máxima de tokens
Gemini 2.5 Flash 1 24.576
Gemini 2.5 Pro 128 32.768
Gemini 2.5 Flash-Lite 512 24.576

Se você definir thinking_budget como 0 ao usar o Gemini 2.5 Flash e o Gemini 2.5 Flash-Lite, o recurso de pensamento será desativado. Ele não pode ser desativado no Gemini 2.5 Pro.

Se você usar o parâmetro thinking_level com um modelo anterior ao Gemini 3, o modelo vai retornar um erro.

Console

  1. Abra Vertex AI Studio > Criar comando.
  2. No painel Modelo, clique em Mudar modelo e selecione um dos modelos compatíveis no menu.
  3. Selecione Manual no seletor suspenso Orçamento de pensamento e use o controle deslizante para ajustar o limite.

Python

Instalar

pip install --upgrade google-genai

Para saber mais, consulte a documentação de referência do SDK.

Defina variáveis de ambiente para usar o SDK de IA generativa com a Vertex AI:

# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values
# with appropriate values for your project.
export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT
export GOOGLE_CLOUD_LOCATION=global
export GOOGLE_GENAI_USE_VERTEXAI=True

from google import genai
from google.genai.types import GenerateContentConfig, ThinkingConfig

client = genai.Client()

response = client.models.generate_content(
    model="gemini-2.5-flash",
    contents="solve x^2 + 4x + 4 = 0",
    config=GenerateContentConfig(
        thinking_config=ThinkingConfig(
            thinking_budget=1024,  # Use `0` to turn off thinking
        )
    ),
)

print(response.text)
# Example response:
#     To solve the equation $x^2 + 4x + 4 = 0$, you can use several methods:
#     **Method 1: Factoring**
#     1.  Look for two numbers that multiply to the constant term (4) and add up to the coefficient of the $x$ term (4).
#     2.  The numbers are 2 and 2 ($2 \times 2 = 4$ and $2 + 2 = 4$).
#     ...
#     ...
#     All three methods yield the same solution. This quadratic equation has exactly one distinct solution (a repeated root).
#     The solution is **x = -2**.

# Token count for `Thinking`
print(response.usage_metadata.thoughts_token_count)
# Example response:
#     886

# Total token count
print(response.usage_metadata.total_token_count)
# Example response:
#     1525

Node.js

Instalar

npm install @google/genai

Para saber mais, consulte a documentação de referência do SDK.

Defina variáveis de ambiente para usar o SDK de IA generativa com a Vertex AI:

# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values
# with appropriate values for your project.
export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT
export GOOGLE_CLOUD_LOCATION=global
export GOOGLE_GENAI_USE_VERTEXAI=True

const {GoogleGenAI} = require('@google/genai');

const GOOGLE_CLOUD_PROJECT = process.env.GOOGLE_CLOUD_PROJECT;
const GOOGLE_CLOUD_LOCATION = process.env.GOOGLE_CLOUD_LOCATION || 'global';

async function generateWithThoughts(
  projectId = GOOGLE_CLOUD_PROJECT,
  location = GOOGLE_CLOUD_LOCATION
) {
  const client = new GoogleGenAI({
    vertexai: true,
    project: projectId,
    location: location,
  });

  const response = await client.models.generateContent({
    model: 'gemini-2.5-flash',
    contents: 'solve x^2 + 4x + 4 = 0',
    config: {
      thinkingConfig: {
        thinkingBudget: 1024,
      },
    },
  });

  console.log(response.text);
  // Example response:
  //  To solve the equation $x^2 + 4x + 4 = 0$, you can use several methods:
  //  **Method 1: Factoring**
  //  1.  Look for two numbers that multiply to the constant term (4) and add up to the coefficient of the $x$ term (4).
  //  2.  The numbers are 2 and 2 ($2 \times 2 = 4$ and $2 + 2 = 4$).
  //  ...
  //  ...
  //  All three methods yield the same solution. This quadratic equation has exactly one distinct solution (a repeated root).
  //  The solution is **x = -2**.

  // Token count for `Thinking`
  console.log(response.usageMetadata.thoughtsTokenCount);
  // Example response:
  //  886

  // Total token count
  console.log(response.usageMetadata.totalTokenCount);
  // Example response:
  //  1525
  return response.text;
}

Ver resumos de pensamentos

Resumos de pensamento são a saída abreviada do processo de raciocínio que o modelo passou ao gerar a resposta. É possível conferir resumos de ideias no Gemini 2.5 Flash e no Gemini 2.5 Pro. Para ver os resumos de ideias, faça o seguinte:

Console

Os resumos de ideias são ativados por padrão no Vertex AI Studio. É possível conferir o processo de pensamento resumido do modelo abrindo o painel Pensamentos.

Python

Instalar

pip install --upgrade google-genai

Para saber mais, consulte a documentação de referência do SDK.

Defina variáveis de ambiente para usar o SDK de IA generativa com a Vertex AI:

# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values
# with appropriate values for your project.
export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT
export GOOGLE_CLOUD_LOCATION=global
export GOOGLE_GENAI_USE_VERTEXAI=True

from google import genai
from google.genai.types import GenerateContentConfig, ThinkingConfig

client = genai.Client()
response = client.models.generate_content(
    model="gemini-2.5-pro",
    contents="solve x^2 + 4x + 4 = 0",
    config=GenerateContentConfig(
        thinking_config=ThinkingConfig(include_thoughts=True)
    ),
)

print(response.text)
# Example Response:
#     Okay, let's solve the quadratic equation x² + 4x + 4 = 0.
#     ...
#     **Answer:**
#     The solution to the equation x² + 4x + 4 = 0 is x = -2. This is a repeated root (or a root with multiplicity 2).

for part in response.candidates[0].content.parts:
    if part and part.thought:  # show thoughts
        print(part.text)
# Example Response:
#     **My Thought Process for Solving the Quadratic Equation**
#
#     Alright, let's break down this quadratic, x² + 4x + 4 = 0. First things first:
#     it's a quadratic; the x² term gives it away, and we know the general form is
#     ax² + bx + c = 0.
#
#     So, let's identify the coefficients: a = 1, b = 4, and c = 4. Now, what's the
#     most efficient path to the solution? My gut tells me to try factoring; it's
#     often the fastest route if it works. If that fails, I'll default to the quadratic
#     formula, which is foolproof. Completing the square? It's good for deriving the
#     formula or when factoring is difficult, but not usually my first choice for
#     direct solving, but it can't hurt to keep it as an option.
#
#     Factoring, then. I need to find two numbers that multiply to 'c' (4) and add
#     up to 'b' (4). Let's see... 1 and 4 don't work (add up to 5). 2 and 2? Bingo!
#     They multiply to 4 and add up to 4. This means I can rewrite the equation as
#     (x + 2)(x + 2) = 0, or more concisely, (x + 2)² = 0. Solving for x is now
#     trivial: x + 2 = 0, thus x = -2.
#
#     Okay, just to be absolutely certain, I'll run the quadratic formula just to
#     double-check. x = [-b ± √(b² - 4ac)] / 2a. Plugging in the values, x = [-4 ±
#     √(4² - 4 * 1 * 4)] / (2 * 1). That simplifies to x = [-4 ± √0] / 2. So, x =
#     -2 again – a repeated root. Nice.
#
#     Now, let's check via completing the square. Starting from the same equation,
#     (x² + 4x) = -4. Take half of the b-value (4/2 = 2), square it (2² = 4), and
#     add it to both sides, so x² + 4x + 4 = -4 + 4. Which simplifies into (x + 2)²
#     = 0. The square root on both sides gives us x + 2 = 0, therefore x = -2, as
#      expected.
#
#     Always, *always* confirm! Let's substitute x = -2 back into the original
#     equation: (-2)² + 4(-2) + 4 = 0. That's 4 - 8 + 4 = 0. It checks out.
#
#     Conclusion: the solution is x = -2. Confirmed.

Node.js

Instalar

npm install @google/genai

Para saber mais, consulte a documentação de referência do SDK.

Defina variáveis de ambiente para usar o SDK de IA generativa com a Vertex AI:

# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values
# with appropriate values for your project.
export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT
export GOOGLE_CLOUD_LOCATION=global
export GOOGLE_GENAI_USE_VERTEXAI=True

const {GoogleGenAI} = require('@google/genai');

const GOOGLE_CLOUD_PROJECT = process.env.GOOGLE_CLOUD_PROJECT;
const GOOGLE_CLOUD_LOCATION = process.env.GOOGLE_CLOUD_LOCATION || 'global';

async function generateWithThoughts(
  projectId = GOOGLE_CLOUD_PROJECT,
  location = GOOGLE_CLOUD_LOCATION
) {
  const client = new GoogleGenAI({
    vertexai: true,
    project: projectId,
    location: location,
  });

  const response = await client.models.generateContent({
    model: 'gemini-2.5-pro',
    contents: 'solve x^2 + 4x + 4 = 0',
    config: {
      thinkingConfig: {
        includeThoughts: true,
      },
    },
  });

  console.log(response.text);
  // Example Response:
  //  Okay, let's solve the quadratic equation x² + 4x + 4 = 0.
  //  ...
  //  **Answer:**
  //  The solution to the equation x² + 4x + 4 = 0 is x = -2. This is a repeated root (or a root with multiplicity 2).

  for (const part of response.candidates[0].content.parts) {
    if (part && part.thought) {
      console.log(part.text);
    }
  }

  // Example Response:
  // **My Thought Process for Solving the Quadratic Equation**
  //
  // Alright, let's break down this quadratic, x² + 4x + 4 = 0. First things first:
  // it's a quadratic; the x² term gives it away, and we know the general form is
  // ax² + bx + c = 0.
  //
  // So, let's identify the coefficients: a = 1, b = 4, and c = 4. Now, what's the
  // most efficient path to the solution? My gut tells me to try factoring; it's
  // often the fastest route if it works. If that fails, I'll default to the quadratic
  // formula, which is foolproof. Completing the square? It's good for deriving the
  // formula or when factoring is difficult, but not usually my first choice for
  // direct solving, but it can't hurt to keep it as an option.
  //
  // Factoring, then. I need to find two numbers that multiply to 'c' (4) and add
  // up to 'b' (4). Let's see... 1 and 4 don't work (add up to 5). 2 and 2? Bingo!
  // They multiply to 4 and add up to 4. This means I can rewrite the equation as
  // (x + 2)(x + 2) = 0, or more concisely, (x + 2)² = 0. Solving for x is now
  // trivial: x + 2 = 0, thus x = -2.
  //
  // Okay, just to be absolutely certain, I'll run the quadratic formula just to
  // double-check. x = [-b ± √(b² - 4ac)] / 2a. Plugging in the values, x = [-4 ±
  // √(4² - 4 * 1 * 4)] / (2 * 1). That simplifies to x = [-4 ± √0] / 2. So, x =
  // -2 again – a repeated root. Nice.
  //
  // Now, let's check via completing the square. Starting from the same equation,
  // (x² + 4x) = -4. Take half of the b-value (4/2 = 2), square it (2² = 4), and
  // add it to both sides, so x² + 4x + 4 = -4 + 4. Which simplifies into (x + 2)²
  // = 0. The square root on both sides gives us x + 2 = 0, therefore x = -2, as
  //  expected.
  //
  // Always, *always* confirm! Let's substitute x = -2 back into the original
  // equation: (-2)² + 4(-2) + 4 = 0. That's 4 - 8 + 4 = 0. It checks out.
  //
  // Conclusion: the solution is x = -2. Confirmed.

  return response.text;
}

Assinaturas de pensamento

As assinaturas de pensamento são representações criptografadas do processo de pensamento interno do modelo que preservam o estado de raciocínio do Gemini durante conversas de várias rodadas, especialmente ao usar chamada de função.

Para garantir que o modelo mantenha o contexto completo em várias trocas de uma conversa, retorne as assinaturas de pensamento das respostas anteriores nas solicitações subsequentes. Se você estiver usando o SDK oficial de IA generativa do Google (Python, Node.js, Go ou Java) e os recursos padrão de histórico de chat ou anexando a resposta completa do modelo ao histórico, as assinaturas de pensamento serão processadas automaticamente.

Para mais informações, consulte Assinaturas de pensamento.

Técnicas de criação de comandos

Comandos eficazes são cruciais para maximizar os benefícios dos modelos de pensamento do Gemini. Esta seção descreve algumas práticas de comandos para modelos de pensamento.

Comece com instruções gerais que descrevem o resultado desejado. Comece com um comando de baixa complexidade e observe as ideias iniciais do modelo sobre como responder.

Describe the most unusual or striking architectural feature you've ever seen in a building or structure.
  
<...>
The most unusual architectural feature that has truly stayed with me is the "floating roof" of the
  Heydar Aliyev Center in Baku, Azerbaijan, designed by Zaha Hadid Architects.

Visually, it's breathtaking. Imagine a vast, undulating landscape of pure white, seemingly draped
over the building. It's not just a roof in the traditional sense; it's an extension of the ground,
flowing seamlessly upwards and over the building's various spaces before curving back down to meet
the earth again. There are no sharp angles, no rigid lines. Instead, everything is fluid, organic,
and continuous. It resembles a giant, pristine white wave frozen in motion, or perhaps a sand dune
sculpted by an unseen wind.
<...>
  

Fornecer instruções detalhadas

Se a tentativa inicial não produzir o resultado esperado, refine sua solicitação fornecendo instruções passo a passo mais explícitas para guiar o Gemini pelo processo de resolução de problemas, para uma abordagem mais focada. Isso permite que você oriente a compreensão inicial da tarefa pelo modelo com sugestões e orientações explícitas.

Now imagine that architectural feature is not just for looks, but has a specific function or
purpose related to the building's environment or the people who use it. Explain what that
function could be and how it enhances the building's overall design and usability.
  
<...>
Let's imagine that the "floating roof" of the Heydar Aliyev Center is not purely aesthetic but
serves a crucial environmental and user-centric function: it's designed as a sophisticated climate
moderator and natural ventilation system for the Baku environment.

Here's how this function would work and enhance the building:

Function: Passive Climate Control and Natural Ventilation System

Shading and Solar Heat Mitigation: The undulating curves of the white GFRC roof are strategically
shaped and oriented to provide optimal shading throughout the day, year-round. Baku experiences
intense sun, especially during the summer. The overhanging curves, acting like giant brise-soleils,
would block direct sunlight from hitting the building's glass facade, significantly reducing solar
heat gain. The varying heights and depths of the curves would create dynamic shade patterns, ensuring
that different parts of the building are shaded at different times of the day, optimizing comfort
and reducing the need for excessive air conditioning. The white color of the GFRC further enhances
this by reflecting a large portion of the solar radiation.
<...>
  

Comandos multishot com raciocínio

O uso de vários comandos com o raciocínio pode melhorar ainda mais a compreensão do Gemini e a precisão das respostas. Forneça vários exemplos de pares de entrada e saída, demonstrando o comportamento e o formato de saída preferidos no comando.

Example 1:
User: What is the tallest mountain in the world?
Assistant: Mount Everest

Example 2:
User: What is the largest ocean?
Assistant: Pacific Ocean

User: What is the longest river in the world?
Assistant:
  
Amazon River
  

Definir saída e comportamento

Ao criar um aplicativo em que os usuários vão interagir diretamente com o modelo, você pode querer orientar sobre como a saída e as respostas do Gemini serão apresentadas e formatadas.

Instruções do sistema

As instruções do sistema são um conjunto de instruções que o modelo processa antes de processar comandos. Elas são chamadas sempre que o modelo recebe um comando e informam como você quer que ele se comporte e responda. Por exemplo, você pode incluir itens como o papel ou perfil, informações contextuais e instruções de formatação.

System Instruction: You are a helpful and concise coding tutor. Always provide code examples and explain them briefly.

User Prompt: Explain what is a closure in Javascript and give an example.
  
    function outerFunction(outerVar) {
      function innerFunction(innerVar) {
        console.log(outerVar); // Accessing outerVar from outerFunction's scope
        console.log(innerVar);
      }
      return innerFunction;
    }

    const closureExample = outerFunction('I am from outer');
    closureExample('I am from inner');

Explanation:

A closure is created when a function (innerFunction in this example) is defined inside another function
(outerFunction) and the inner function remembers and has access to the variables from the outer
function's scope, even after the outer function has finished executing.

In the example:

outerFunction is called with 'I am from outer' and returns innerFunction.

closureExample now holds a reference to innerFunction.

When closureExample('I am from inner') is called, innerFunction executes.

Even though outerFunction has already finished, innerFunction can still access and use outerVar
(which is 'I am from outer') because of the closure.

In essence, the innerFunction "closes over" the variables of its outer function's scope, creating
a closure.
  

Verificação e reflexão

Inclua etapas específicas de verificação nas instruções do sistema ou nos comandos diretamente. Por exemplo, peça para o Gemini verificar as fontes, revisar o raciocínio, identificar possíveis erros e checar a resposta final.

    Verify the following statement and provide your sources: The capital of Brazil is Rio de Janeiro.
  
The statement "The capital of Brazil is Rio de Janeiro" is incorrect.

The current capital of Brazil is Brasília.

Rio de Janeiro was the capital of Brazil for a significant period, from 1763 to 1960. However, the
capital was moved to Brasília in 1960 as part of a plan to develop the country's interior and create
a more centrally located capital.

Verification and Sources:

You can easily verify this information from numerous reliable sources:

Encyclopedias:

Britannica: Searching for "Brazil" on Britannica will clearly state Brasília as the capital.

https://www.britannica.com/place/Brazil (Look for the "Capital" information in the introductory summary or "Geography" section)

Wikipedia: The Wikipedia article for "Brazil" also states Brasília as the capital.

https://en.wikipedia.org/wiki/Brazil (Look in the infobox or introductory section)

Government and Official Sources:

CIA World Factbook: This is a highly reliable source for country information. Searching for "Brazil"
will list Brasília as the capital.

https://www.cia.gov/the-world-factbook/countries/brazil/ (Look under "Government" > "Capital")

Official Website of the Brazilian Government (if accessible and in English): While navigating official
government websites can sometimes be complex, they would definitively list Brasília as the capital.

Geographic Resources:

National Geographic: Their website and publications will confirm Brasília as the capital of Brazil.

Atlases and Geography Textbooks: Any modern atlas or geography textbook will list Brasília as the capital.

Why the confusion?

The confusion might arise because:

Rio de Janeiro is a very famous Brazilian city: It's a major tourist destination, known for its
beaches, Carnival, and iconic landmarks like Christ the Redeemer. Its past status as capital adds
to its historical significance and public recognition.

Historical context: Rio de Janeiro was the capital for a long time. People who learned about Brazil
in the past might remember it as the capital.

In conclusion, the statement is false. The capital of Brazil is Brasília, not Rio de Janeiro. Rio
de Janeiro was the former capital but is no longer the current capital.

You can confidently use the sources listed above to verify this information.
  

Depuração e direcionamento

O Vertex AI Studio oferece aos desenvolvedores acesso aos pensamentos do modelo na UI. Isso é útil para um desenvolvedor que está revisando o comando ao depurar:

Analisar o processo de pensamento

Analise com cuidado o processo de pensamento do Gemini para identificar áreas em que ele pode ter se desviado. Essa análise pode fornecer pistas valiosas para refinar seus comandos e receber a resposta esperada de forma consistente no seu aplicativo.

Exemplo: se o processo de pensamento do Gemini mostrar que ele não entendeu uma etapa de uma instrução complexa, você pode refinar o comando para esclarecer essa etapa específica.

Step 1: Summarize the following article about quantum physics.
Step 2: Translate the summary into Spanish.
Step 3: Extract the key entities from the Spanish summary.

Article: ... [Article Text] ...
The user wants me to process an article about Google's new quantum chip called Willow in three steps:
Step 1: Summarize the article.
Step 2: Translate the summary into Spanish.
Step 3: Extract the key entities from the Spanish summary.

Let's break down each step.

Step 1: Summarize the article.
I need to read the article and identify the main points. The article is about Google's new quantum
chip, Willow, and its achievements. The key achievements are:

Exponential error reduction as qubits scale up.

Outperforming supercomputers in a benchmark computation (RCS).

Willow is a step towards commercially relevant quantum computing.

It's the first system below threshold for quantum error correction.

It achieved a benchmark computation in under 5 minutes that would take a supercomputer 10 septillion years.

It was fabricated in a new facility.

It has state-of-the-art performance and high quality qubits.

Google is looking towards real-world applications with Willow.

Quantum computing will benefit AI.

I will synthesize these points into a concise summary.

Step 2: Translate the summary into Spanish.
Once I have the summary in English, I will translate it into Spanish. I need to ensure the translation
is accurate and natural-sounding in Spanish.

Step 3: Extract the key entities from the Spanish summary.
After translating the summary, I will identify and extract the key entities. Key entities are typically
nouns or noun phrases that represent important objects, concepts, or actors. In this context, they
will likely include:

Names of chips (Willow, Sycamore)

Companies/Organizations (Google Quantum AI, Google Research)

Technologies (quantum chip, quantum computer, qubits, quantum error correction, superconducting
quantum system, classical computers, supercomputers, AI)

Benchmarks (random circuit sampling, RCS)

People (Julian Kelly, Peter Shor, David Deutsch, Sergio Boixo, Hartmut Neven, John Preskill)

Concepts (exponential error reduction, below threshold, beyond breakeven, state-of-the-art performance,
commercially relevant applications, quantum mechanics, multiverse, T1 times, system benchmarks,
algorithmic benchmarks)

I will need to carefully review the Spanish summary to identify these entities and list them out.

Provide corrective feedback

If you observe errors or inconsistencies in Gemini's reasoning, provide corrective feedback in your prompt and the system instructions to anticipate where the model's response may deviate from your desired outcome.

You are an expert in botany. When asked to identify a plant, focus on leaf shape, flower structure, and stem characteristics.

Identify this plant based on these characteristics: ... [Plant Characteristics Description] ...

Previous incorrect response focused on habitat only. Please disregard habitat and focus on morphology.
Previous incorrect response focused on habitat only. Please disregard habitat and focus on morphology.
Tabebuia vellosoi

Aproveitar ao máximo respostas longas e reflexões mais elaboradas

O pensamento gera "pensamentos" como parte da saída de token que mostra o raciocínio detalhado do Gemini. Para aproveitar ao máximo essas saídas:

Analisar o raciocínio

Preste atenção ao processo de raciocínio do Gemini (disponível na interface do Vertex AI Studio), como ele dividiu a tarefa e as escolhas que fez para sua saída. Isso pode ajudar você a entender como ele chegou à conclusão.

Orientar o raciocínio

Se você quiser que a saída seja muito longa, é recomendável dar mais orientações no comando para restringir a quantidade de raciocínio necessária para realizar a tarefa apresentada. Assim, você pode reservar mais da saída de token para sua resposta.

*Exemplo: para um relatório detalhado, especifique seções e subseções no comando para orientar o raciocínio do Gemini e estruturar a saída de forma eficiente.

Generate a detailed report on the impact of climate change on coastal ecosystems.

Report Structure:

Introduction

Rising Sea Levels
2.1. Impact on Mangroves
2.2. Impact on Coral Reefs

Ocean Acidification
3.1. Impact on Shellfish
3.2. Impact on Plankton

Extreme Weather Events
4.1. Increased Storm Intensity
4.2. Coastal Erosion

Conclusion

Provide detailed analysis within each section.
<...>
Climate Change Impact on Coastal Ecosystems: A Detailed Report

1.  Introduction

Coastal ecosystems, the dynamic interface between land and sea, are among the most productive and
biodiverse environments on Earth. They provide crucial ecosystem services, including coastal protection,
fisheries, carbon sequestration, and support for a vast array of species. However, these vital
ecosystems are increasingly threatened by the multifaceted impacts of climate change. Driven by
anthropogenic greenhouse gas emissions, climate change is manifesting in several interconnected ways
that are profoundly altering the physical and chemical conditions of coastal environments. This report
will delve into the key impacts of climate change on coastal ecosystems, focusing on rising sea levels,
ocean acidification, and extreme weather events, and their specific consequences for critical habitats
like mangroves and coral reefs, and key organisms like shellfish and plankton. Understanding these
impacts is crucial for developing effective conservation and management strategies to mitigate the
damage and enhance the resilience of these invaluable ecosystems.

2.  Rising Sea Levels

Rising sea levels are a direct and significant consequence of global warming, driven by thermal
expansion of seawater and the melting of land ice (glaciers and ice sheets). This phenomenon poses a
direct threat to low-lying coastal ecosystems by inundating habitats, altering salinity regimes, and
increasing erosion rates. The rate of sea level rise is accelerating, and projections for the 21st
century indicate a continued upward trend, with potentially devastating consequences for coastal
environments.

2.1. Impact on Mangroves

Mangrove forests are unique coastal ecosystems found in tropical and subtropical intertidal zones.
They provide numerous benefits, including coastal protection against storms, nursery grounds for
fish and invertebrates, and significant carbon sequestration...
<...>

Preços

Você recebe cobranças pelos tokens gerados durante o processo de pensamento de um modelo. Em alguns modelos, como o Gemini 3 Pro e o Gemini 2.5 Pro, o raciocínio é ativado por padrão, e você recebe cobranças por esses tokens.

Para mais informações, consulte Preços da Vertex AI. Para saber como gerenciar custos, consulte Controlar o orçamento de pensamento.

A seguir

Teste um modelo de pensamento com nosso notebook do Colab ou abra o console da Vertex AI e faça um teste por conta própria.