提示 Gemini 思考模型

本指南將概略說明 Gemini Thinking 模型的使用方式。這些模型可讓開發人員將複雜問題拆解為較小且更易於管理的步驟,以便解決問題。這種逐步的做法不僅可提升挑戰性任務的成效,還可讓開發人員深入瞭解 Gemini 的推理過程,並在 Google AI Studio UI 中查看相關資訊。目前支援思考功能的模型包括 Gemini 2.0 Flash ThinkingGemini 2.5 Pro Experimental with thinking 實驗模型。

提示技巧

有效的提示是充分發揮 Gemini 思考模型效益的關鍵。以下提供一些可考慮的做法:

開始使用

請先提供一般說明,說明預期的結果。從簡單的提示開始,觀察模型一開始如何解決挑戰。

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.
<...>
  

提供逐步說明

如果初次嘗試未能獲得預期結果,請提供更明確的逐步操作說明,引導 Gemini 解決問題,以便更有效率地解決問題。這樣一來,您就能透過明確的建議和指引,引導模型對任務的初步理解。

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.
<...>
  

使用 Thinking 進行多重拍攝提示

搭配思考功能使用多重拍攝提示,可進一步提升 Gemini 的理解能力,並提高回覆準確度。提供幾個輸入/輸出組合範例,說明提示中所需的行為和輸出格式。

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
  

定義輸出內容和行為

建構使用者可直接與模型互動的應用程式時,建議您提供 Gemini 輸出內容和回覆的聲音和格式指南。

系統指示

系統指令是一組指令,模型會先處理這組指令,再處理提示。每當模型收到提示時,系統就會重新載入這些指令,並告知模型您希望其如何運作及回應。例如,您可以加入角色或人物角色、背景資訊和格式指示等內容。

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.
  

驗證與反思

請直接在系統操作說明或提示中加入特定驗證步驟。舉例來說,請 Gemini 驗證來源、查看推理過程、找出潛在錯誤,並檢查最終答案。

    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.
  

運用思考工具

Gemini Thinking 模型可運用工具執行除了產生文字以外的動作。這可讓他們與外部系統互動、執行程式碼或存取即時資訊,並將結果納入推理和最終回應。您可以透過 API 設定啟用工具。

搜尋工具

搜尋工具可讓模型查詢外部搜尋引擎,找出最新資訊或訓練資料以外的資訊。這項功能可用於回答有關近期事件或非常具體主題的問題。

What were the major scientific breakthroughs announced last week?
  
Based on recent search results, here are some highlights from the past week in science:

*   **[Specific Breakthrough 1]:** [Brief description based on search results, e.g., A new study published in Nature details advancements in battery technology...]
*   **[Specific Breakthrough 2]:** [Brief description based on search results, e.g., Researchers at MIT announced progress in understanding dark matter...]
*   **[Specific Breakthrough 3]:** [Brief description based on search results, e.g., The James Webb Space Telescope captured new images revealing...]

(Note: The model would use the search tool to find relevant news and articles from the specified timeframe and synthesize the information. Grounding metadata citing the sources would also typically be available via the API.)
  

程式碼執行工具

程式碼執行工具可讓模型編寫及執行程式碼 (例如Python) 執行計算、操控資料,或解決以演算法最佳處理的問題。模型會接收程式碼的輸出內容,並可在回應中使用這項資訊。

What is the sum of the first 50 prime numbers?
Generate and run Python code for the calculation, and make sure you get all 50.
Provide the final sum clearly.
  
Okay, I can calculate that. I will generate Python code to find the first 50 prime numbers and sum them up.

```python
def is_prime(num):
    if num < 2:
        return False
    for i in range(2, int(num**0.5) + 1):
        if num % i == 0:
            return False
    return True

primes = []
num = 2
while len(primes) < 50:
    if is_prime(num):
        primes.append(num)
    num += 1

total_sum = sum(primes)
print(total_sum)
```

Running the code...

Code Execution Result:
Outcome: OK
Output:

5117
Use code with caution.
The sum of the first 50 prime numbers is 5117.

結構化輸出

您可以指示模型依據特定結構 (例如 JSON) 格式化輸出內容。這對於將模型輸出內容整合至應用程式特別實用。您可以直接在提示中指定所需的格式和結構定義,或使用 `response_mime_type` 等 API 參數,在可用時取得更強大的控制權。

Provide a list of 3 famous physicists and their key contributions
in JSON format.
Use this JSON schema:

Physicist = {'name': str, 'contribution': str, 'era': str}
Return: list[Physicist]
```json
[
{
"name": "Albert Einstein",
"contribution": "Theory of Relativity (Special and General)",
"era": "Early 20th Century"
},
{
"name": "Isaac Newton",
"contribution": "Laws of Motion and Universal Gravitation",
"era": "Late 17th / Early 18th Century"
},
{
"name": "Marie Curie",
"contribution": "Pioneering research on radioactivity",
"era": "Late 19th / Early 20th Century"
}
]
```

偵錯和轉向

Google AI Studio 可讓開發人員在 UI 中查看模型的想法。這項功能可協助開發人員在偵錯時查看提示訊息:

分析思考過程

仔細檢查 Gemini 的思考過程,找出可能出錯的部分。這項分析可提供寶貴的線索,協助您改善提示,並在應用程式中一致地獲得預期回應。

情境範例:如果 Gemini 的思考過程顯示它誤解了複雜指令中的某個步驟,您可以調整提示訊息,以便說明該步驟。

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/or 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

善用長篇輸出內容和長篇思考

思考會產生「想法」,做為 Token Output 的一部分,展示 Gemini 的詳細推理。如何發揮這些輸出的最大效益:

查看原因

請仔細留意 Gemini 的推理過程 (可在 Google AI Studio UI 中查看),以及它如何分解工作,並做出輸出結果的選擇。這有助於您瞭解系統如何得出結論。

提供推理指引

如果您希望輸出內容特別冗長,建議您在提示中提供更多指引,以便限制完成提示中任務所需的思考量。這樣一來,您就能為回應保留更多符記輸出內容。

範例:如要產生詳細報表,您可以在提示中指定各個部分和子部分,引導 Gemini 思考並有效地安排輸出內容。

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...
<...>

技術詳細資料

  • 可用模型:Gemini 2.0 Flash Thinking、Gemini 2.5 Pro Experimental (含 Thinking)
  • 多模態輸入:文字、音訊、圖片和 PDF (支援的內容可能因特定型號版本而異)
  • 輸出內容:僅文字 (最終回應)
  • 符號輸入:長脈絡,最多可達 100 萬個符號 (請參閱特定模型說明文件)
  • 權杖輸出:最多 64k 個權杖 (請參閱特定模型的說明文件)

注意:符號總輸出內容包含模型的「想法」和回應。視要求的複雜度和工具使用情況而定,最終回應輸出的長度上限可能有所不同。

透過實施這些技巧並運用工具,Gemini Thinking 模型可協助您處理各種複雜的工作,並可能帶來更出色的成果。

後續步驟