Skip to content
Google Gemini Prompting Best Practices
On Trove · from Google

Google Gemini Prompting Best Practices

Comprehensive guide to prompting best practices for Google Gemini models including Gemini 3.1 Pro, 3 Pro, 3 Flash, 2.5 Pro, 2.5 Flash.

You can read the contents and the first 2,000 characters.
Free accounts get the whole book.

  • By Google
  • 138 chapters
  • Updated Nov 1, 2026
  • 69 readers

What’s inside

  • Introduction & Model Overview
  • Universal Prompting Techniques
  • Gemini 2.5 Pro Best Practices
  • Access the thinking process
  • Include a full codebase for analysis
  • Gemini 2.5 Flash Best Practices

What is Google Gemini Prompting Best Practices?

Comprehensive guide to prompting best practices for Google Gemini models including Gemini 3.1 Pro, 3 Pro, 3 Flash, 2.5 Pro, 2.5 Flash, and 2.5 Flash-Lite. Covers universal techniques, model-specific tips, thinking mode, function calling, multimodal capabilities, grounding, caching, and agentic patterns sourced from official Google documentation.

Read more

Google · markdown · Listed Feb 22, 2026

  • best-practices
  • agents
  • llms
  • prompting-guide

From the first page

Google Gemini is a family of multimodal large language models developed by Google DeepMind. Designed to understand and generate across text, images, audio, video, and code, the Gemini model family offers a range of options tailored to different performance, latency, and cost requirements. This chapter provides a comprehensive overview of the current model lineup, their capabilities, pricing, and guidance on choosing the right model for your use case.

The Gemini model family is organized into three active series, each representing a generation of capability improvements. Understanding which series and model to use is the first decision you need to make when building with Gemini.

The Gemini 3 series represents the latest generation of models, currently available in preview. These models introduce simplified thinking controls, improved conciseness, and enhanced multimodal capabilities.

All Gemini 3 models share a 1 million token context window, a 64K maximum output, and a knowledge cutoff of January 2025. They introduce the new thinkingLevel parameter (replacing thinkingBudget) and default to more concise responses compared to previous generations.

Preview · 2,000 of 182,216 characters

Contents

  1. 01Introduction & Model Overviewp.1
    1. Current Gemini Model Lineupp.1
    2. Model Comparison Tablep.1
    3. Platform Availabilityp.1
    4. Specialized Variantsp.1
    5. Decision Framework for Choosing the Right Modelp.1
    6. Free vs Paid vs Enterprise Tier Comparisonp.1
  2. 02Universal Prompting Techniquesp.2
    1. Clear and Specific Instructionsp.2
    2. Few-Shot Promptingp.2
    3. Chain of Thought Promptingp.2
    4. System Instructionsp.2
    5. Response Format Controlp.2
    6. Prosp.2
    7. Consp.2
    8. Verdictp.2
    9. +6 more sections
  3. 03Gemini 2.5 Pro Best Practicesp.3
    1. Overviewp.3
    2. Thinking Configurationp.3
  4. 04Access the thinking processp.4
    1. Deep Think Modep.4
    2. Pricingp.4
    3. Best Use Casesp.4
    4. Prompting Tips for 2.5 Prop.4
  5. 05Include a full codebase for analysisp.5
    1. When NOT to Use 2.5 Prop.5
  6. 06Gemini 2.5 Flash Best Practicesp.6
    1. Overviewp.6
    2. Thinking Configurationp.6
  7. 07Moderate thinking for a reasoning taskp.7
    1. Thinking Disabledp.7
  8. 08Zero thinking for a simple classification taskp.8
    1. Pricingp.8
    2. Flash-Lite Variantp.8
    3. Comparison: Flash vs Flash-Lite vs 2.0 Flashp.8
    4. Best Use Casesp.8
    5. Prompting Tips for 2.5 Flashp.8
See all 138 parts
  1. 09Batch API examplep.9
  2. 10Gemini 3 Series Best Practicesp.10
    1. Models Overviewp.10
    2. The New thinkingLevel Parameterp.10
    3. Migration from Gemini 2.5 to Gemini 3p.10
    4. Media Resolution Controlp.10
    5. Structured Output with Built-in Toolsp.10
    6. Code Execution with Images (Gemini 3 Flash)p.10
    7. Multimodal Function Responses with FunctionResponseBlobp.10
  3. 11Return an image from a function callp.11
    1. Computer Usep.11
    2. Limitationsp.11
  4. 12Thinking Mode Deep Divep.12
    1. How Thinking Worksp.12
    2. thinkingLevel (Gemini 3)p.12
  5. 13Fast classification -- no reasoning neededp.13
  6. 14Comparing two approaches -- moderate reasoningp.14
  7. 15Complex mathematical proof -- full reasoningp.15
    1. thinkingBudget (Gemini 2.5)p.15
    2. Dynamic Thinkingp.15
  8. 16Dynamic thinking -- recommended defaultp.16
    1. Thought Summariesp.16
  9. 17Streaming with thoughtsp.17
    1. Thought Signaturesp.17
  10. 18When importing external conversation historyp.18
  11. 19The SDK handles signature requirements when you use the chat interfacep.19
    1. Pricing: Thinking Tokensp.19
    2. When to Use vs Skip Thinkingp.19
    3. Deep Think Mode (Gemini 2.5 Pro)p.19
  12. 20Deep Think for a hard optimization problemp.20
  13. 21Function Calling & Tool Usep.21
    1. The 4-Step Function Calling Flowp.21
  14. 22The response contains a function call, not textp.22
    1. Step 3: Execute the Function Codep.22
  15. 23Extract and executep.23
    1. Step 4: Generate the Final Responsep.23
  16. 24Build the function responsep.24
  17. 25Send the full conversation back to the modelp.25
  18. 26"The weather in Tokyo is currently 22 degrees Celsius and partly cloudyp.26
  19. 27with 65% humidity."p.27
    1. Calling Modesp.27
    2. Parallel Function Callingp.27
  20. 28The response contains multiple function call partsp.28
  21. 29Output:p.29
  22. 30Call: get_weather({"location": "New York, NY"})p.30
  23. 31Call: get_weather({"location": "London, UK"})p.31
  24. 32Call: get_weather({"location": "Tokyo, Japan"})p.32
    1. Executing in Parallelp.32
  25. 33Extract all function calls from the responsep.33
  26. 34Execute them all at oncep.34
    1. Returning Resultsp.34
  27. 35Build all function responsesp.35
  28. 36Send all results back in a single turnp.36
  29. 37"Here's the current weather:p.37
  30. 38- New York: 18°C, sunnyp.38
  31. 39- London: 12°C, overcastp.39
  32. 40- Tokyo: 22°C, partly cloudy"p.40
    1. Compositional Function Callingp.40
  33. 41Define both function declarationsp.41
    1. The Chaining Processp.41
  34. 42Model returns: get_current_location()p.42
  35. 43Returns: {"city": "San Francisco", "state": "CA"}p.43
  36. 44Model returns: get_weather({"location": "San Francisco, CA"})p.44
  37. 45"You're currently in San Francisco, CA. The weather is 18°C and foggy."p.45
    1. Automatic Function Calling (Python SDK)p.45
  38. 46Pass functions directly -- the SDK handles everythingp.46
  39. 47The response is already the final text -- no manual function execution neededp.47
    1. Built-in Toolsp.47
  40. 48Response includes current news with source citationsp.48
  41. 49Access grounding metadata for source attributionp.49
    1. Code Executionp.49
    2. URL Contextp.49
    3. File Searchp.49
  42. 50Upload a file firstp.50
  43. 51Use file search to query across uploaded documentsp.51
    1. Structured Outputs for Toolsp.51
  44. 52Parse the response directly into a Pydantic modelp.52
    1. MCP (Model Context Protocol) Integrationp.52
  45. 53Connect to an MCP serverp.53
  46. 54List available tools from the MCP serverp.54
  47. 55Use MCP tools with Geminip.55
    1. Automatic Tool Calling with MCPp.55
  48. 56The SDK handles everything automaticallyp.56
  49. 57Final answer incorporating data from the MCP tool serverp.57
    1. Best Practicesp.57
  50. 58Bad: Unclear what this doesp.58
  51. 59Good: Clear purpose and behaviorp.59
    1. 2. Use Strong Typing with Enumsp.59
  52. 60Bad: Free-form string invites errorsp.60
  53. 61Good: Constrained enum prevents invalid valuesp.61
    1. 3. Limit Tools to 10-20 Per Requestp.61
    2. 4. Configure Temperature Appropriatelyp.61
  54. 62For older Gemini models or when you need strict determinismp.62
  55. 63For Gemini 2.5 models -- default temperature often works bestp.63
    1. 5. Validate High-Consequence Actionsp.63
    2. 6. Check the Finish Reasonp.63
    3. 7. Implement Robust Error Handlingp.63
    4. 8. Be Mindful of Token Usagep.63
  56. 64Calculate approximate token usage from declarationsp.64
    1. Gemini 2.5 Limitation: Built-in Tools and Custom Functionsp.64
  57. 65This will NOT work with Gemini 2.5 modelsp.65
  58. 66Instead, use EITHER custom functions:p.66
  59. 67OR built-in tools:p.67
    1. Thought Signatures in Function Callingp.67
  60. 68Correct: Preserve the model's response exactly as receivedp.68
  61. 69Send it back unchanged in the conversation historyp.69
  62. 70INCORRECT: Reconstructing function calls loses the thought signaturep.70
  63. 71Do NOT do this:p.71
  64. 72This loses the thought signature and will cause a 400 errorp.72
    1. SDK Handlingp.72
  65. 73Using the SDK's built-in chat -- signatures are handled automaticallyp.73
  66. 74SDK automatically handles function execution, signatures, and response cyclesp.74
  67. 75Multimodal Capabilitiesp.75
    1. Image Understandingp.75
  68. 76Upload the file oncep.76
  69. 77Reference it in as many requests as neededp.77
    1. Supported Formats and Limitsp.77
    2. Token Calculation for Imagesp.77
    3. Object Detection with Bounding Boxesp.77
    4. Best Practices for Image Promptingp.77
  70. 78Correct ordering: image first, then textp.78
  71. 79Avoid: text first, then imagep.79
    1. Video Understandingp.79
  72. 80Upload video via File APIp.80
  73. 81Wait for processing to completep.81
  74. 82Ask questions about the videop.82
    1. Audio Processingp.82
    2. PDF Document Understandingp.82
    3. Media Resolution Control (Gemini 3)p.82
  75. 83Example: Processing a long video at low resolution for general summaryp.83
  76. 84Example: Processing a code walkthrough video at high resolutionp.84
    1. Native Image Generationp.84
  77. 85Save the generated imagep.85
    1. Nano Banana Pro (gemini-3-pro-image-preview)p.85
    2. Prompting Tips for Image Generationp.85
  78. 86Less effectivep.86
  79. 87More effectivep.87
    1. Reference Image Support (Nano Banana Pro)p.87
  80. 88Upload reference imagesp.88
    1. Live APIp.88
  81. 89Server-side: Generate an ephemeral tokenp.89
  82. 90Send token.token to the client applicationp.90
  83. 91Client uses this token to connect directly to the Live APIp.91
    1. Multi-Turn Image Editingp.91
  84. 92Turn 1: Generate the initial imagep.92
  85. 93Turn 2: Add elementsp.93
  86. 94Turn 3: Modify the lightingp.94
  87. 95Turn 4: Style changep.95
    1. Combining Modalities in a Single Requestp.95
  88. 96Analyze a video alongside its transcript PDFp.96
    1. Image-to-Image Comparisonp.96
  89. 97Compare two product imagesp.97
    1. Summaryp.97
  90. 98Grounding, Caching & Advanced Featuresp.98
    1. Grounding with Google Searchp.98
  91. 99Access the response textp.99
  92. 100Access grounding metadata and citationsp.100
    1. Dynamic Retrieval Configurationp.100
    2. Pricingp.100
    3. Combining Google Search with URL Contextp.100
  93. 101Step 1: Use Google Search to find relevant sourcesp.101
  94. 102Step 2: Extract URLs from grounding metadata, then use URL Contextp.102
  95. 103for deep analysis of the most relevant pagesp.103
  96. 104Use URL Context to deeply analyze specific pagesp.104
    1. Grounding with Google Mapsp.104
    2. Context Cachingp.104
  97. 105These two requests share the same system instruction prefix.p.105
  98. 106The system may automatically cache the shared content.p.106
  99. 107Request 1p.107
  100. 108Request 2 - the shared system instruction may be served from cachep.108
    1. Explicit Caching (Manual TTL)p.108
  101. 109Step 1: Create a cache with a large documentp.109
  102. 110Step 2: Use the cache in subsequent requestsp.110
  103. 111Step 3: Update the TTL if you need more timep.111
  104. 112Step 4: Delete the cache when donep.112
    1. Managing Cachesp.112
  105. 113List all active cachesp.113
  106. 114Get details of a specific cachep.114
    1. Long Context Tipsp.114
  107. 115LESS EFFECTIVE: Asking for multiple facts in one queryp.115
  108. 116MORE EFFECTIVE: Separate queries for each factp.116
    1. Query Placement Is Criticalp.116
  109. 117CORRECT: Query after contextp.117
  110. 118INCORRECT: Query before contextp.118
    1. URL Contextp.118
    2. Structured Output / JSON Modep.118
  111. 119The response is guaranteed to be valid JSON matching the schemap.119
    1. Code Executionp.119
  112. 120Access the executed code and its outputp.120
    1. Safety Settingsp.120
    2. Sampling Parametersp.120
  113. 121Deterministic output (e.g., for classification tasks)p.121
  114. 122Creative output (e.g., for brainstorming)p.122
    1. Top-Kp.122
    2. Top-P (Nucleus Sampling)p.122
    3. Max Output Tokensp.122
  115. 123Short, concise answerp.123
  116. 124Long-form contentp.124
    1. Chapter Summaryp.124
  117. 125Agentic Patterns & Google ADKp.125
    1. Agent Design Dimensionsp.125
    2. Agentic System Prompt Templatep.125
    3. Google ADK (Agent Development Kit)p.125
  118. 126Define toolsp.126
  119. 127Create an ADK agentp.127
  120. 128Run the agentp.128
    1. Sequential Workflow Examplep.128
  121. 129Stage 1: Research agentp.129
  122. 130Stage 2: Analysis agentp.130
  123. 131Stage 3: Writer agentp.131
  124. 132Chain them togetherp.132
    1. A2A Protocolp.132
    2. ReAct Patternp.132
    3. Computer Use for Agentsp.132
  125. 133The model returns actions like:p.133
  126. 134Convert to actual pixel coordinatesp.134
    1. Multi-Context Window Strategiesp.134
  127. 135Cache the agent's reference documentationp.135
  128. 136Use the cache in each agent turnp.136
    1. Deployment Optionsp.136
  129. 137Install ADKp.137
  130. 138Run locally with debug loggingp.138
    1. Building Effective Agents: Summary of Best Practicesp.138