# Prompts for Gemini: format control, grounding, and structured output

> How to write prompts that get consistent, well-structured output from Gemini — including format examples, grounding constraints, and multimodal tips.

Source: Promptea — https://www.promptea.me/en/guides/gemini-prompt-guide · Language: English · Last updated: 2026-11-14

## What makes Gemini different

- Gemini responds well to a visible output template — showing the exact format you expect reduces variation.
- It benefits from an explicit example of the final structure, even a short one.
- For grounded tasks, specify the source: 'Base your answer only on the text below — do not add outside knowledge.'
- Gemini tends to be verbose; set a hard word or sentence limit to prevent padding.
- For multimodal prompts (image + text), state what role the image plays before the question.

## Patterns that work well with Gemini

- Show a mini template: 'Return your answer in this format: [field]: [value]'.
- Separate context from instruction with a header line (e.g., '--- Context ---', '--- Task ---').
- Ask it to list assumptions before the final answer on ambiguous tasks.
- For long inputs, use a priority hint: 'Focus on the sections marked [PRIORITY]'.
- If you need JSON, define the schema inline and add 'Return ONLY valid JSON, no explanation'.

To get a version of your prompt laid out for Gemini (context first, question last), pick Gemini in the [prompt analyzer](https://www.promptea.me/en/analyzer).

## Templates

### Structured analysis with format template

```text
Analyze the topic below and return your answer in the exact format shown.

Topic: [describe the topic or question]

Format (use exactly this structure):
Summary: [1 sentence]
Key points:
- [point 1]
- [point 2]
- [point 3]
Assumptions I'm making: [list any assumptions]
Confidence: [high / medium / low] — [reason in 1 sentence]

Constraints:
- Max 200 words total.
- If a field cannot be filled, write 'N/A' — do not omit it.
```

[Open in Promptea](https://www.promptea.me/en/analyzer?prompt=Analyze+the+topic+below+and+return+your+answer+in+the+exact+format+shown.%0A%0ATopic%3A+%5Bdescribe+the+topic+or+question%5D%0A%0AFormat+%28use+exactly+this+structure%29%3A%0ASummary%3A+%5B1+sentence%5D%0AKey+points%3A%0A-+%5Bpoint+1%5D%0A-+%5Bpoint+2%5D%0A-+%5Bpoint+3%5D%0AAssumptions+I%27m+making%3A+%5Blist+any+assumptions%5D%0AConfidence%3A+%5Bhigh+%2F+medium+%2F+low%5D+%E2%80%94+%5Breason+in+1+sentence%5D%0A%0AConstraints%3A%0A-+Max+200+words+total.%0A-+If+a+field+cannot+be+filled%2C+write+%27N%2FA%27+%E2%80%94+do+not+omit+it.&purpose=text&target=gemini)

### Grounded Q&A (source-only answers)

```text
Answer the question below using ONLY the source text provided.

Rules:
1. Do not add facts from outside the source.
2. If the answer is not in the source, say: "Not found in source."
3. Quote the relevant sentence (max 1 sentence) before your answer.
4. Keep the answer to 2-3 sentences.

--- Source ---
[paste source text here]
--- End source ---

Question: [your question]
```

[Open in Promptea](https://www.promptea.me/en/analyzer?prompt=Answer+the+question+below+using+ONLY+the+source+text+provided.%0A%0ARules%3A%0A1.+Do+not+add+facts+from+outside+the+source.%0A2.+If+the+answer+is+not+in+the+source%2C+say%3A+%22Not+found+in+source.%22%0A3.+Quote+the+relevant+sentence+%28max+1+sentence%29+before+your+answer.%0A4.+Keep+the+answer+to+2-3+sentences.%0A%0A---+Source+---%0A%5Bpaste+source+text+here%5D%0A---+End+source+---%0A%0AQuestion%3A+%5Byour+question%5D&purpose=text&target=gemini)

## Frequently asked questions

### Why does Gemini ignore my format instructions?

Usually because the format was described in words but not shown. Add a literal template — even a 2-line example — and Gemini follows it much more reliably.

### How do I stop Gemini from adding extra commentary?

End the prompt with an explicit constraint: 'Return ONLY the structured output above — no extra text, no preamble.' Repeating it at the end reinforces it.
