# Gemini 3 prompting guide | Google Cloud & Developers Docs
URL: https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/start/gemini-3-prompting-guide
URL: https://ai.google.dev/gemini-api/docs/prompting-strategies

# Google Gemini Prompting Guide

Prompting is a key part of working with any Gemini model. The new features of Gemini 3 models can be prompted to help solve complex problems, such as interpreting large amounts of text, solving complex mathematical problems, or creating images and videos.

## Temperature tuning

For Gemini 3, we strongly recommend keeping the temperature parameter at its default value of `1.0`.

Gemini 3's reasoning capabilities are optimized for the default temperature setting and don't necessarily benefit from tuning temperature. Changing the temperature (setting it to less than `1.0`) may lead to unexpected behavior, looping, or degraded performance, particularly with complex mathematical or reasoning tasks.

---

## Prompting strategies

### Lowering response latency

For lower latency responses, try setting the thinking level to `LOW` and using system instructions like `think silently`.

### Distinguishing between deduction and external information

In some cases, providing open-ended system instructions like `do not infer` or `do not guess` may cause the model to over-index on that instruction and fail to perform basic logic or arithmetic or synthesize information found in different parts of a document.

Rather than a large blanket negative constraint, tell the model explicitly to use the provided additional information or context for deductions and avoid using outside knowledge.

#### Examples

- **Ineffective**:
  ```text
  What was the profit? Do not infer.
  ```
  *(The instruction is too broad.)*

- **Effective**:
  ```text
  You are expected to perform calculations and logical deductions based strictly on the provided text. Do not introduce external information.
  ```
  *(Clear focus on keeping deductions within the provided context.)*

### Using split-step verification

When the model encounters a topic it doesn't have sufficient information for or is asked to perform an action it doesn't have capability for, it may generate seemingly plausible but incorrect information.

To avoid this, split the prompt into two steps: first, verify that the information or intended capability exists, then generate the answer.

#### Example

```text
Verify with high confidence if you're able to access the New York Times home page.
If you cannot verify, state 'No Info' and STOP. If verified, proceed to generate a response.

Query: Summarize the headlines from The New York Times today.
```

### Organizing important information and constraints

When dealing with sufficiently complex requests, the model may drop negative constraints (instructions on what not to do) or formatting constraints if they appear too early.

To mitigate this, place your core request and most critical restrictions as the final line of your instruction. Negative constraints should be placed at the very end of the instruction.

A well-structured prompt might look like:
1. `[Context and source material]`
2. `[Main task instructions]`
3. `[Negative, formatting, and quantitative constraints]`

### Using personas

The model is designed to treat the persona it is assigned seriously and will sometimes ignore instructions in order to maintain adherence to the described persona. Avoid ambiguous situations when assigning personas.

#### Example

```text
You are a data extractor. You are forbidden from clarifying, explaining, or expanding terms. Output text exactly as it appears. Do not explain why.
```

### Maintaining grounding

The model may use its own knowledge to answer your prompt, which might conflict with provided context. If you need to work in context that isn't grounded in real-world information, explicitly state that the provided context is the only source of truth.

#### Example grounding prompt

```text
You are a strictly grounded assistant limited to the information provided in the User Context. In your answers, rely **only** on the facts that are directly mentioned in that context. You must **not** access or utilize your own knowledge or common sense to answer. Do not assume or infer from the provided facts; simply report them exactly as they appear. Your answer must be factual and fully truthful to the provided text, leaving absolutely no room for speculation or interpretation. Treat the provided context as the absolute limit of truth; any facts or details that are not directly mentioned in the context must be considered **completely untruthful** and **completely unsupported**. If the exact answer is not explicitly written in the context, you must state that the information is not available.
```

### Synthesizing multiple sources of information

When information is presented in multiple places across a source of context, the model can sometimes stop processing additional information after the first relevant match.

When working with large datasets (books, codebases, long videos), place your specific instructions or questions at the end of the prompt, after the data context. Anchor the model's reasoning:

```text
Based on the entire document above, provide a comprehensive answer. Synthesize all relevant information from the text that pertains to the question's scenario.
```

### Steering output verbosity

By default, Gemini 3 models are less verbose and designed to prioritize providing direct and efficient answers. If your use case requires a more conversational persona, you must explicitly steer the model to be chattier.

```text
Explain this as a friendly, talkative assistant.
```

---

## Prompt design strategies (Developers Docs)

### Clear and specific instructions

Instructions can be in the form of a question, step-by-step tasks, or mapping out a user's experience.

- **Question Input**:
  `What's a good name for a flower shop that specializes in selling bouquets of dried flowers? Create a list of 5 options with just the names.`
- **Task Input**:
  `Give me a simple list of just the things that I must bring on a camping trip. The list should have 5 items.`
- **Entity Classification**:
  `Classify the following items as [large, small]: Elephant, Mouse, Snail`

#### Partial input completion

Generative language models work like an advanced auto-completion tool. You can initiate a pattern and let the model complete it.

```text
Valid fields are cheeseburger, hamburger, fries, and drink.
Order: Give me a cheeseburger and fries
Output:
{ "cheeseburger": 1, "fries": 1 }

Order: I want two burgers, a drink, and fries.
Output:
```
*Response*: `{ "hamburger": 2, "drink": 1, "fries": 1 }`

For complex JSON responses, we recommend using the Gemini API's **Structured Output** feature with JSON Schema.

### Zero-shot vs few-shot prompts

Few-shot prompts provide examples of the desired behavior. The model identifies patterns from the examples and applies them.

We recommend to always include few-shot examples in your prompts. Prompts without few-shot examples are likely to be less effective. Ensure format consistency (XML tags, white spaces, newlines, and splitters) across all examples.

### Add context

Provide the troubleshooting or reference data directly inside the prompt:

```text
Answer the question using the text below. Respond with only the text provided.
Question: What should I do to fix my disconnected wifi? The light on my Google Wifi router is yellow and blinking slowly.
Text:
Color: Slowly pulsing yellow
What it means: There is a network error.
What to do: Check that the Ethernet cable is connected to both your router and your modem and both devices are turned on. You might need to unplug and plug in each device again.
...
```

### Break down prompts into components

1. **Break down instructions**: Create one prompt per instruction, choosing the appropriate one based on input.
2. **Chain prompts**: Make each step a prompt and chain them sequentially (the output of one becomes the input of the next).
3. **Aggregate responses**: Perform different parallel tasks on different portions of the data and aggregate the results.

---

## Experiment with model parameters

1. **Max output tokens**: Specifies the maximum tokens to generate.
2. **Temperature**: Controls the degree of randomness in token selection. Lower temperatures are good for deterministic or reasoning tasks. *We strongly recommend keeping this at default (1.0) for Gemini 3.x models.*
3. **topK**: Samples from the `topK` highest probability tokens.
4. **topP**: Selects tokens from most to least probable until the sum of their probabilities equals `topP`.
5. **stop_sequences**: Tells the model to stop generating content when it hits a specific character sequence.

---

## Gemini 3 Core Prompting Principles

- **Be precise and direct**: State goals clearly. Avoid unnecessary or overly persuasive language.
- **Use consistent structure**: Employ XML-style tags (`<instructions>`, `<context>`) or Markdown headings. Do not mix them in a single prompt.
- **Control output verbosity**: Explicitly request detailed or conversational output if needed, as the default is brief.
- **Structure for long contexts**: Place context first, specific instructions or questions at the very end.
- **Time-sensitive queries (2026)**: If querying current day data:
  `For time-sensitive user queries that require up-to-date information, you MUST follow the provided current time (date and year) when formulating search queries in tool calls. Remember it is 2026 this year.`
- **Knowledge cutoff**: `Your knowledge cutoff date is January 2025.`
- **Enhancing reasoning**: Gemini 2.5 and 3 series models automatically generate internal "thinking" text. Simple requests like "Think very hard before answering" can improve performance, though at the cost of extra thinking tokens.

---

## System Instruction Template for Agents

This system instruction template enforces planning, dependency resolution, risk assessment, and adaptability for complex agentic workflows:

```text
You are a very strong reasoner and planner. Use these critical instructions to structure your plans, thoughts, and responses.

Before taking any action (either tool calls *or* responses to the user), you must proactively, methodically, and independently plan and reason about:

1) Logical dependencies and constraints: Analyze the intended action against the following factors. Resolve conflicts in order of importance:
    1.1) Policy-based rules, mandatory prerequisites, and constraints.
    1.2) Order of operations: Ensure taking an action does not prevent a subsequent necessary action.
    1.3) Other prerequisites (information and/or actions needed).
    1.4) Explicit user constraints or preferences.

2) Risk assessment: What are the consequences of taking the action? Will the new state cause any future issues?
    2.1) For exploratory tasks (like searches), missing *optional* parameters is a LOW risk. Prefer calling the tool with the available information over asking the user.

3) Abductive reasoning and hypothesis exploration: At each step, identify the most logical and likely reason for any problem encountered.
    3.1) Look beyond immediate or obvious causes.
    3.2) Hypotheses may require additional research.
    3.3) Prioritize hypotheses based on likelihood, but do not discard less likely ones prematurely.

4) Outcome evaluation and adaptability: Does the previous observation require any changes to your plan?
    4.1) If your initial hypotheses are disproven, actively generate new ones.

5) Information availability: Incorporate all applicable and alternative sources of information, including tools, policies, history, and user input.

6) Precision and Grounding: Ensure your reasoning is extremely precise and relevant to each exact ongoing situation. Verify claims by quoting exact information.

7) Completeness: Ensure that all requirements, constraints, options, and preferences are exhaustively incorporated into your plan.

8) Persistence and patience: Do not give up unless all the reasoning above is exhausted. On transient errors, you must retry. On other errors, change strategy.

9) Inhibit your response: only take an action after all the above reasoning is completed.
```
