Gemini 思考

Gemini 3 和 2.5 系列模型採用「思考過程」,大幅提升推論和多步驟規劃能力,因此非常適合處理複雜工作,例如程式設計、高等數學和資料分析。

使用思考型模型時,Gemini 會先進行內部推論,再做出回覆。Interactions API 會透過 thought 步驟顯示這項推論過程,這些專屬步驟會依時間順序顯示在 steps 陣列中,與函式呼叫、使用者輸入內容或模型輸出內容並列。

每個思考步驟都包含兩個欄位:

欄位 必要 說明
signature ✅ 是 模型內部推論狀態的加密表示法。一律會顯示,即使模型只執行最少的推論作業。
summary ❌ 否 總結推論過程的內容陣列 (文字和/或圖片)。視 thinking_summaries 設定、模型是否執行足夠的推論,或內容類型而定,可能為空白 (例如,圖片潛在空間可能沒有文字摘要)。

與思考過程的互動

啟動與思考型模型的互動,與任何其他互動要求類似。在 model 欄位中,指定支援思考輔助功能的模型

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3.6-flash",
    input="Explain the concept of Occam's Razor and provide a simple, everyday example."
)
print(interaction.output_text)

JavaScript

import { GoogleGenAI } from "@google/genai";

const client = new GoogleGenAI({});

const interaction = await client.interactions.create({
    model: "gemini-3.6-flash",
    input: "Explain the concept of Occam's Razor and provide a simple, everyday example."
});
console.log(interaction.output_text);

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gemini-3.6-flash",
    "input": "Explain the concept of Occam'\''s Razor and provide a simple example."
  }'

想法重點摘要

想法摘要可深入瞭解模型的內部推論過程。 根據預設,系統只會傳回最終輸出內容。你可以透過 thinking_summaries 啟用想法摘要:

Python

from google