このガイドでは、Gemini の思考モデルの使用方法について説明します。これらのモデルにより、デベロッパーは複雑な問題をより小さく管理しやすいステップに分割して、問題に取り組むことができます。このステップバイステップのアプローチにより、困難なタスクでのパフォーマンスが向上するだけでなく、Google AI Studio UI で確認できる Gemini の推論プロセスに関する貴重な分析情報をデベロッパーに提供できます。現在、思考機能を持つモデルには、Gemini 2.0 Flash Thinking と試験運用版の Gemini 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. <...> |
思考を伴うマルチショット プロンプト
思考と組み合わせたマルチショット プロンプトを使用すると、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 |
長いアウトプットと長尺の思考を最大限に活用する
思考は、Gemini の詳細な推論を示すトークン出力の一部として「思考」を生成します。これらの出力を最大限に活用するには:
理由を確認する
Gemini の推論プロセス(Google AI Studio UI で確認可能)、タスクの分割方法、出力に選択された内容に特に注意してください。これにより、AI がどのように結論に至ったかを把握できます。
推論のガイダンスを提供
出力の長さが特に長い場合は、プロンプトに詳細なガイダンスを提供して、プロンプトで提示されたタスクを完了するために必要な思考量を制限することをおすすめします。これにより、レスポンス用にトークン出力をより多く予約できます。
例: 詳細なレポートの場合は、プロンプトでセクションとサブセクションを指定して、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 with thinking
- マルチモーダル入力: テキスト、音声、画像、PDF(サポートはモデルのバージョンによって異なる場合があります)
- 出力: テキストのみ(最終レスポンス)
- トークン入力: 長いコンテキスト(最大 100 万トークンまで可能)(特定のモデルのドキュメントを参照)
- トークンの出力: 最大 64,000 トークン(特定のモデルのドキュメントを参照)
注: トークンの合計出力には、モデルの「思考」とレスポンスの両方が含まれます。リクエストの複雑さとツールの使用状況に応じて、最終的なレスポンス出力の最大長は異なります。
こうした手法を実装し、ツールを活用することで、Gemini の思考モデルはさまざまな複雑なタスクへの取り組みを支援し、成果の向上につながる可能性があります。
次のステップ
- プロンプト設計について理解できたら、Google AI Studio を使用して独自のプロンプトを作成してみてください。
- プロンプト設計について詳しくは、プロンプト戦略のトピックをご覧ください。
- マルチモーダル プロンプトについて詳しくは、メディア ファイルによるプロンプトをご覧ください。