Gemini के बारे में सोच

Gemini मॉडल, "सोचने की प्रोसेस" का इस्तेमाल करते हैं. इससे, तर्क करने और कई चरणों वाली प्लानिंग करने की उनकी क्षमता बेहतर होती है. इसलिए, ये मॉडल कोडिंग, ऐडवांस गणित, और डेटा विश्लेषण जैसे मुश्किल कामों को बेहतर तरीके से कर पाते हैं.

इस गाइड में, Gemini API का इस्तेमाल करके, Gemini की सोचने-समझने की क्षमताओं का इस्तेमाल करने का तरीका बताया गया है.

सोच-समझकर कॉन्टेंट जनरेट करना

सोचने वाले मॉडल से अनुरोध करना, कॉन्टेंट जनरेट करने के किसी अन्य अनुरोध की तरह ही होता है. मुख्य अंतर यह है कि model फ़ील्ड में, सोचने की क्षमता वाले मॉडल में से किसी एक को तय किया जाता है. इसे टेक्स्ट जनरेट करने के इस उदाहरण में दिखाया गया है:

Python

from google import genai

client = genai.Client()
prompt = "Explain the concept of Occam's Razor and provide a simple, everyday example."
response = client.models.generate_content(
    model="gemini-3.8-flash",
    contents=prompt
)

print(response.text)

JavaScript

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

const ai = new GoogleGenAI({});

async function main() {
  const prompt = "Explain the concept of Occam's Razor and provide a simple, everyday example.";

  const response = await ai.models.generateContent({
    model: "gemini-3.8-flash",
    contents: prompt,
  });

  console.log(response.text);
}

main();

ऐप पर जाएं

package main

import (
  "context"
  "fmt"
  "log"
  "os"
  "google.golang.org/genai"
)

func main() {
  ctx := context.Background()
  client, err := genai.NewClient(ctx, nil)
  if err != nil {
      log.Fatal(err)
  }

  prompt := "Explain the concept of Occam's Razor and provide a simple, everyday example."
  model := "gemini-3.8-flash"

  resp, _ := client.Models.GenerateContent(ctx, model, genai.Text(prompt), nil)

  fmt.Println(resp.Text())
}

आराम का समय

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent" \
 -H "x-goog-api-key: $GEMINI_API_KEY" \
 -H 'Content-Type: application/json' \
 -X POST \
 -d '{
   "contents": [
     {
       "parts": [
         {
           "text": "Explain the concept of Occam'\''s Razor and provide a simple, everyday example."
         }
       ]
     }
   ]
 }'
 ```

सूझ-बूझ से बनाई गई खास जानकारी

मॉडल के रॉ थॉट को कम शब्दों में पेश करने पर, थॉट की खास जानकारी मिलती है. इससे मॉडल के इंटरनल रीज़निंग प्रोसेस के बारे में अहम जानकारी मिलती है. ध्यान दें कि थिंकिंग लेवल और बजट, मॉडल के रॉ थॉट पर लागू होते हैं, न कि थॉट की खास जानकारी पर.

अनुरोध के कॉन्फ़िगरेशन में includeThoughts को true पर सेट करके, सोच-विचार की खास जानकारी पाने की सुविधा चालू की जा सकती है. इसके बाद, response पैरामीटर के parts को दोहराकर और thought बूलियन की जांच करके, खास जानकारी को ऐक्सेस किया जा सकता है.

यहां एक उदाहरण दिया गया है, जिसमें बताया गया है कि स्ट्रीमिंग के बिना, सोच-विचार की खास जानकारी को कैसे चालू किया जाए और उसे कैसे वापस पाया जाए. इससे जवाब के साथ, सोच-विचार की एक खास जानकारी मिलती है:

Python

from google import genai
from google.genai import types

client = genai.Client()
prompt = "What is the sum of the first 50 prime numbers?"
response = client.models.generate_content(
  model="gemini-3.8-flash",
  contents=prompt,
  config=types.GenerateContentConfig(
    thinking_config=types.ThinkingConfig(
      include_thoughts=True
    )
  )
)

for part in response.candidates[0].content.parts:
  if not part.text:
    continue
  if part.thought:
    print("Thought summary:")
    print(part.text)
    print()
  else:
    print("Answer:")
    print(part.text)
    print()

JavaScript

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

const ai = new GoogleGenAI({});

async function main() {
  const response = await ai.models.generateContent({
    model: "gemini-3.8-flash",
    contents: "What is the sum of the first 50 prime numbers?",
    config: {
      thinkingConfig: {
        includeThoughts: true,
      },
    },
  });

  for (const part of response.candidates[0].content.parts) {
    if (!part.text) {
      continue;
    }
    else if (part.thought) {
      console.log("Thoughts summary:");
      console.log(part.text);
    }
    else {
      console.log("Answer:");
      console.log(part.text);
    }
  }
}

main();

ऐप पर जाएं

package main

import (
  "context"
  "fmt"
  "google.golang.org/genai"
  "os"
)

func main() {
  ctx := context.Background()
  client, err := genai.NewClient(ctx, nil)
  if err != nil {
      log.Fatal(err)
  }

  contents := genai.Text("What is the sum of the first 50 prime numbers?")
  model := "gemini-3.8-flash"
  resp, _ := client.Models.GenerateContent(ctx, model, contents, &genai.GenerateContentConfig{
    ThinkingConfig: &genai.ThinkingConfig{
      IncludeThoughts: true,
    },
  })

  for _, part := range resp.Candidates[0].Content.Parts {
    if part.Text != "" {
      if part.Thought {
        fmt.Println("Thoughts Summary:")
        fmt.Println(part.Text)
      } else {
        fmt.Println("Answer:")
        fmt.Println(part.Text)
      }
    }
  }
}

यहां स्ट्रीमिंग के साथ थिंकिंग मोड का इस्तेमाल करने का एक उदाहरण दिया गया है. इसमें जनरेशन के दौरान, रोलिंग और इंक्रीमेंटल समरी मिलती हैं:

Python

from google import genai
from google.genai import types

client = genai.Client()

prompt = """
Alice, Bob, and Carol each live in a different house on the same street: red, green, and blue.
The person who lives in the red house owns a cat.
Bob does not live in the green house.
Carol owns a dog.
The green house is to the left of the red house.
Alice does not own a cat.
Who lives in each house, and what pet do they own?
"""

thoughts = ""
answer = ""

for chunk in client.models.generate_content_stream(
    model="gemini-3.8-flash",
    contents=prompt,
    config=types.GenerateContentConfig(
      thinking_config=types.ThinkingConfig(
        include_thoughts=True
      )
    )
):
  for part in chunk.candidates[0].content.parts:
    if not part.text:
      continue
    elif part.thought:
      if not thoughts:
        print("Thoughts summary:")
      print(part.text)
      thoughts += part.text
    else:
      if not answer:
        print("Answer:")
      print(part.text)
      answer += part.text

JavaScript

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

const ai = new GoogleGenAI({});

const prompt = `Alice, Bob, and Carol each live in a different house on the same
street: red, green, and blue. The person who lives in the red house owns a cat.
Bob does not live in the green house. Carol owns a dog. The green house is to
the left of the red house. Alice does not own a cat. Who lives in each house,
and what pet do they own?`;

let thoughts = "";
let answer = "";

async function main() {
  const response = await ai.models.generateContentStream({
    model: "gemini-3.8-flash",
    contents: prompt,
    config: {
      thinkingConfig: {
        includeThoughts: true,
      },
    },
  });

  for await (const chunk of response) {
    for (const part of chunk.candidates[0].content.parts) {
      if (!part.text) {
        continue;
      } else if (part.thought) {
        if (!thoughts) {
          console.log("Thoughts summary:");
        }
        console.log(part.text);
        thoughts = thoughts + part.text;
      } else {
        if (!answer) {
          console.log("Answer:");
        }
        console.log(part.text);
        answer = answer + part.text;
      }
    }
  }
}

await main();

ऐप पर जाएं

package main

import (
  "context"
  "fmt"
  "log"
  "os"
  "google.golang.org/genai"
)

const prompt = `
Alice, Bob, and Carol each live in a different house on the same street: red, green, and blue.
The person who lives in the red house owns a cat.
Bob does not live in the green house.
Carol owns a dog.
The green house is to the left of the red house.
Alice does not own a cat.
Who lives in each house, and what pet do they own?
`

func main() {
  ctx := context.Background()
  client, err := genai.NewClient(ctx, nil)
  if err != nil {
      log.Fatal(err)
  }

  contents := genai.Text(prompt)
  model := "gemini-3.8-flash"

  resp := client.Models.GenerateContentStream(ctx, model, contents, &genai.GenerateContentConfig{
    ThinkingConfig: &genai.ThinkingConfig{
      IncludeThoughts: true,
    },
  })

  for chunk := range resp {
    for _, part := range chunk.Candidates[0].Content.Parts {
      if len(part.Text) == 0 {
        continue
      }

      if part.Thought {
        fmt.Printf("Thought: %s\n", part.Text)
      } else {
        fmt.Printf("Answer: %s\n", part.Text)
      }
    }
  }
}

सोच-विचार करने की प्रोसेस को कंट्रोल करना

Gemini मॉडल, डिफ़ॉल्ट रूप से डाइनैमिक थिंकिंग का इस्तेमाल करते हैं. ये उपयोगकर्ता के अनुरोध की जटिलता के आधार पर, तर्क करने की कोशिश को अपने-आप अडजस्ट करते हैं. हालांकि, अगर आपके पास इंतज़ार के समय से जुड़ी कुछ खास पाबंदियाँ हैं या आपको मॉडल से सामान्य से ज़्यादा गहराई से तर्क करने की ज़रूरत है, तो आपके पास सोच-विचार करने के व्यवहार को कंट्रोल करने के लिए पैरामीटर इस्तेमाल करने का विकल्प है.

सूझ-बूझ वाले लेवल (Gemini 4 और Gemini 3)

thinkingLevel पैरामीटर, Gemini 4 के लिए ज़रूरी है और Gemini 3 मॉडल के लिए सुझाया गया है. इसकी मदद से, रीज़निंग के व्यवहार को कंट्रोल किया जा सकता है. Gemini 4 (gemini-4-argon) में low, medium (डिफ़ॉल्ट), और high का इस्तेमाल किया जा सकता है.

यहां दी गई टेबल में, हर तरह के मॉडल के लिए thinkingLevel की सेटिंग के बारे में बताया गया है:

सूझ-बूझ वाले मॉडल का लेवल Gemini 3.8 Flash Gemini 3.6 Flash Gemini 4 Argon Gemini 3.5 और 3.1 Flash-Lite Gemini 3.1 Flash-Lite Image Gemini 3 Flash Gemini Robotics ER 2 ब्यौरा
minimal इस्तेमाल नहीं किया जा सकता (गड़बड़ी) काम करता है इस्तेमाल नहीं किया जा सकता (गड़बड़ी) काम करता है (डिफ़ॉल्ट) इस्तेमाल किया जा सकता है (डिफ़ॉल्ट) काम करता है काम करता है ज़्यादातर क्वेरी के लिए, "कोई थिंकिंग मोड नहीं" सेटिंग से मैच करता है. ध्यान दें, minimal से यह गारंटी नहीं मिलती कि सोचने की प्रोसेस बंद हो गई है. ऐसा हो सकता है कि मॉडल, मुश्किल कामों के लिए बहुत कम तर्क दे.
low काम करता है काम करता है काम करता है काम करता है यह सुविधा उपलब्ध नहीं है काम करता है काम करता है इससे इंतज़ार का समय और लागत कम होती है.
medium इस्तेमाल किया जा सकता है (डिफ़ॉल्ट) इस्तेमाल किया जा सकता है (डिफ़ॉल्ट) इस्तेमाल किया जा सकता है (डिफ़ॉल्ट) काम करता है काम नहीं करता है काम करता है काम करता है ज़्यादातर टास्क के लिए, सोच-विचार करने का संतुलित तरीका.
high Supported (Dynamic) उपलब्ध है (डाइनैमिक) उपलब्ध है (डाइनैमिक) उपलब्ध है (डाइनैमिक) Supported (Dynamic) Supported (Default, Dynamic) सपोर्ट किया गया (डिफ़ॉल्ट, डाइनैमिक) इससे रीज़निंग की गहराई बढ़ जाती है. मॉडल को पहला (नॉन थिंकिंग) आउटपुट टोकन जनरेट करने में ज़्यादा समय लग सकता है. हालांकि, आउटपुट में ज़्यादा सटीक जानकारी मिलेगी.

यहां दिए गए उदाहरण में, थिंकिंग लेवल सेट करने का तरीका बताया गया है.

Python

from google import genai
from google.genai import types

client = genai.Client()

response = client.models.generate_content(
    model="gemini-3.8-flash",
    contents="Provide a list of 3 famous physicists and their key contributions",
    config=types.GenerateContentConfig(
        thinking_config=types.ThinkingConfig(thinking_level="low")
    ),
)

print(response.text)

JavaScript

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

const ai = new GoogleGenAI({});

async function main() {
  const response = await ai.models.generateContent({
    model: "gemini-3.8-flash",
    contents: "Provide a list of 3 famous physicists and their key contributions",
    config: {
      thinkingConfig: {
        thinkingLevel: ThinkingLevel.LOW,
      },
    },
  });

  console.log(response.text);
}

main();

ऐप पर जाएं

package main

import (
  "context"
  "fmt"
  "google.golang.org/genai"
  "os"
)

func main() {
  ctx := context.Background()
  client, err := genai.NewClient(ctx, nil)
  if err != nil {
      log.Fatal(err)
  }

  thinkingLevelVal := "low"

  contents := genai.Text("Provide a list of 3 famous physicists and their key contributions")
  model := "gemini-3.8-flash"
  resp, _ := client.Models.GenerateContent(ctx, model, contents, &genai.GenerateContentConfig{
    ThinkingConfig: &genai.ThinkingConfig{
      ThinkingLevel: &thinkingLevelVal,
    },
  })

fmt.Println(resp.Text())
}

आराम का समय

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
  "contents": [
    {
      "parts": [
        {
          "text": "Provide a list of 3 famous physicists and their key contributions"
        }
      ]
    }
  ],
  "generationConfig": {
    "thinkingConfig": {
          "thinkingLevel": "low"
    }
  }
}'

Gemini 4 Argon के लिए, सोच-समझकर जवाब देने की सुविधा को बंद नहीं किया जा सकता. Gemini 3 Flash और Flash-Lite में भी, सूझ-बूझ वाले मॉडल को पूरी तरह से बंद नहीं किया जा सकता. अगर आपने सूझ-बूझ वाला लेवल नहीं चुना है, तो Gemini, मॉडल के डिफ़ॉल्ट लेवल का इस्तेमाल करेगा. जैसे, Gemini 4 Argon, Gemini 3.8 Flash, और Gemini 3.6 Flash के लिए "medium".

Gemini 2.5 सीरीज़ के मॉडल, thinkingLevel के साथ काम नहीं करते; इसके बजाय, thinkingBudget का इस्तेमाल करें.

टोकन की सीमाएं और max_output_tokens

max_output_tokens जनरेशन पैरामीटर, किसी जवाब में जनरेट किए जा सकने वाले टोकन की ज़्यादा से ज़्यादा संख्या सेट करता है. इसमें थॉट टोकन भी शामिल हैं.

सेट किए जाने पर, यह पैरामीटर इंफ़्रास्ट्रक्चर की ओर से लागू किए गए हार्ड कटऑफ़ के तौर पर काम करता है. इससे मॉडल के थिंकिंग बजट (thinking_level) को तय करने के तरीके में कोई बदलाव नहीं होता.

अगर मॉडल, रीज़निंग के दौरान इस सीमा तक पहुंच जाता है, तो वह finish_reason: MAX_TOKENS के साथ आउटपुट जनरेट करना बंद कर देता है. साथ ही, अधूरा या खाली आउटपुट दिखाता है. हालांकि, जनरेट किए गए सभी थिंकिंग टोकन के लिए बिलिंग जारी रहती है. जवाबों को छोटा किए बिना लागत या इंतज़ार का समय कम करने के लिए, max_output_tokens की वैल्यू को कम करने के बजाय, thinking_level (low या medium) की वैल्यू को कम करें.

Gemini 4 के मॉडल (gemini-4-argon) के लिए, कॉन्टेक्स्ट और आउटपुट की इन सीमाओं को ध्यान में रखें:

  • 10 लाख टोकन वाली कॉन्टेक्स्ट विंडो: इनपुट, सोचने, और आउटपुट के लिए इस्तेमाल किए जाने वाले टोकन, 10 लाख टोकन वाली एक ही कॉन्टेक्स्ट विंडो (1,048,576 टोकन) शेयर करते हैं. अगर आपके इनपुट टोकन और max_output_tokens की संख्या 10,48,576 से ज़्यादा है, तो एपीआई, आउटपुट की सीमा को कॉन्टेक्स्ट विंडो में बची हुई जगह (1,048,576 माइनस आपके इनपुट टोकन) के हिसाब से अपने-आप तय कर देता है.
  • हर अनुरोध के लिए आउटपुट की सीमाएं (64 हज़ार स्ट्रीमिंग / 32 हज़ार नॉन-स्ट्रीमिंग) और लॉन्ग डिकोड (ज़्यादा से ज़्यादा 10 लाख टोकन): एक स्ट्रीमिंग अनुरोध (streamGenerateContent) से ज़्यादा से ज़्यादा 65,536 टोकन मिलते हैं. वहीं, एक नॉन-स्ट्रीमिंग अनुरोध (generateContent) से ज़्यादा से ज़्यादा 32,768 टोकन मिलते हैं. हर अनुरोध के लिए तय की गई सीमा (1,048,576 टोकन में से आपके इनपुट को घटाकर) से ज़्यादा टोकन जनरेट करने के लिए, max_output_tokens को सीमा से ज़्यादा पर सेट करें. Google GenAI के नए SDK टूल, डिफ़ॉल्ट रूप से (automatic_continuation=True) हॉप के दौरान अपने-आप काम करते रहते हैं. इसके अलावा, जब कोई हॉप finish_reason: "CONTINUATION" के साथ रुकता है, तो continuation_token का इस्तेमाल करके क्लाइंट लूप चलाया जा सकता है. कोड के उदाहरणों के लिए, लॉन्ग डिकोड देखें.

सूझ-बूझ से बनाए गए बजट

thinkingBudget पैरामीटर को Gemini 2.5 सीरीज़ के साथ लॉन्च किया गया था. यह मॉडल को बताता है कि तर्क करने के लिए कितने थिंकिंग टोकन इस्तेमाल करने हैं.

यहां हर तरह के मॉडल के लिए, thinkingBudget कॉन्फ़िगरेशन की जानकारी दी गई है. thinkingBudget को 0 पर सेट करके, सोचने की सुविधा को बंद किया जा सकता है. thinkingBudget को -1 पर सेट करने से, डाइनैमिक थिंकिंग चालू हो जाती है. इसका मतलब है कि मॉडल, अनुरोध की जटिलता के आधार पर बजट को अडजस्ट करेगा.

मॉडल डिफ़ॉल्ट सेटिंग
(थिंकिंग बजट सेट नहीं है)
रेंज गहराई से विचार करने की सुविधा बंद करना डाइनैमिक थिंकिंग की सुविधा चालू करना
2.5 Pro डाइनैमिक थिंकिंग 128 से 32768 लागू नहीं: गहराई से विचार करने की सुविधा बंद नहीं की जा सकती thinkingBudget = -1 (डिफ़ॉल्ट)
2.5 Flash डाइनैमिक थिंकिंग 0 से 24576 thinkingBudget = 0 thinkingBudget = -1 (डिफ़ॉल्ट)
2.5 Flash Preview डाइनैमिक थिंकिंग 0 से 24576 thinkingBudget = 0 thinkingBudget = -1 (डिफ़ॉल्ट)
2.5 Flash Lite मॉडल सोच-विचार नहीं करता 512 से 24576 thinkingBudget = 0 thinkingBudget = -1
2.5 Flash Lite Preview मॉडल सोच-विचार नहीं करता 512 से 24576 thinkingBudget = 0 thinkingBudget = -1
Robotics-ER 1.6 Preview डाइनैमिक थिंकिंग 0 से 24576 thinkingBudget = 0 thinkingBudget = -1 (डिफ़ॉल्ट)
2.5 Flash Live Native Audio Preview (09-2025) डाइनैमिक थिंकिंग 0 से 24576 thinkingBudget = 0 thinkingBudget = -1 (डिफ़ॉल्ट)

Python

from google import genai
from google.genai import types

client = genai.Client()

response = client.models.generate_content(
    model="gemini-2.5-flash",
    contents="Provide a list of 3 famous physicists and their key contributions",
    config=types.GenerateContentConfig(
        thinking_config=types.ThinkingConfig(thinking_budget=1024)
        # Turn off thinking:
        # thinking_config=types.ThinkingConfig(thinking_budget=0)
        # Turn on dynamic thinking:
        # thinking_config=types.ThinkingConfig(thinking_budget=-1)
    ),
)

print(response.text)

JavaScript

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

const ai = new GoogleGenAI({});

async function main() {
  const response = await ai.models.generateContent({
    model: "gemini-2.5-flash",
    contents: "Provide a list of 3 famous physicists and their key contributions",
    config: {
      thinkingConfig: {
        thinkingBudget: 1024,
        // Turn off thinking:
        // thinkingBudget: 0
        // Turn on dynamic thinking:
        // thinkingBudget: -1
      },
    },
  });

  console.log(response.text);
}

main();

ऐप पर जाएं

package main

import (
  "context"
  "fmt"
  "google.golang.org/genai"
  "os"
)

func main() {
  ctx := context.Background()
  client, err := genai.NewClient(ctx, nil)
  if err != nil {
      log.Fatal(err)
  }

  thinkingBudgetVal := int32(1024)

  contents := genai.Text("Provide a list of 3 famous physicists and their key contributions")
  model := "gemini-2.5-flash"
  resp, _ := client.Models.GenerateContent(ctx, model, contents, &genai.GenerateContentConfig{
    ThinkingConfig: &genai.ThinkingConfig{
      ThinkingBudget: &thinkingBudgetVal,
      // Turn off thinking:
      // ThinkingBudget: int32(0),
      // Turn on dynamic thinking:
      // ThinkingBudget: int32(-1),
    },
  })

fmt.Println(resp.Text())
}

REST

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
  "contents": [
    {
      "parts": [
        {
          "text": "Provide a list of 3 famous physicists and their key contributions"
        }
      ]
    }
  ],
  "generationConfig": {
    "thinkingConfig": {
          "thinkingBudget": 1024
    }
  }
}'

प्रॉम्प्ट के हिसाब से, मॉडल टोकन बजट से ज़्यादा या कम टोकन जनरेट कर सकता है.

थॉट सिग्नेचर

Gemini API, स्टेटलेस है. इसलिए, मॉडल हर एपीआई अनुरोध को अलग-अलग मानता है. साथ ही, सिलसिलेवार बातचीत के दौरान, पिछले चरणों के कॉन्टेक्स्ट को ऐक्सेस नहीं करता.

सिलसिलेवार बातचीत के दौरान, Gemini को बातचीत के कॉन्टेक्स्ट को बनाए रखने में मदद करने के लिए, थॉट सिग्नेचर मिलते हैं. ये मॉडल की इंटरनल थॉट प्रोसेस के एन्क्रिप्ट (सुरक्षित) किए गए वर्शन होते हैं.

  • Gemini 2.5 मॉडल, थॉट सिग्नेचर तब दिखाते हैं, जब थिंकिंग की सुविधा चालू हो और अनुरोध में फ़ंक्शन कॉलिंग शामिल हो. खास तौर पर, फ़ंक्शन के बारे में जानकारी.
  • Gemini 4 और Gemini 3 मॉडल, सभी तरह के पार्ट के लिए थॉट सिग्नेचर दिखा सकते हैं. हमारा सुझाव है कि आपको सभी हस्ताक्षर उसी तरह वापस भेजने चाहिए जैसे आपको मिले थे. हालांकि, फ़ंक्शन कॉल करने के लिए हस्ताक्षर ज़रूरी हैं. ज़्यादा जानने के लिए, थॉट सिग्नेचर पेज पर जाएं.

फ़ंक्शन कॉलिंग की सुविधा का इस्तेमाल करने से जुड़ी अन्य सीमाएं:

  • जवाब के अन्य हिस्सों में मॉडल से सिग्नेचर मिलते हैं. उदाहरण के लिए, फ़ंक्शन कॉल करना या टेक्स्ट वाले हिस्से. पूरे जवाब को वापस मॉडल को भेजें, ताकि वह अगले टर्न में सभी हिस्सों को शामिल कर सके.
  • हस्ताक्षर वाले हिस्सों को एक साथ न जोड़ें.
  • हस्ताक्षर वाले हिस्से को बिना हस्ताक्षर वाले हिस्से के साथ मर्ज न करें.

कीमत

थिंकिंग की सुविधा चालू होने पर, जवाब की कीमत आउटपुट टोकन और थिंकिंग टोकन की कुल संख्या के हिसाब से तय होती है. जनरेट किए गए थिंकिंग टोकन की कुल संख्या, thoughtsTokenCount फ़ील्ड से देखी जा सकती है.

Python

# ...
print("Thoughts tokens:", response.usage_metadata.thoughts_token_count)
print("Output tokens:", response.usage_metadata.candidates_token_count)

JavaScript

// ...
console.log(`Thoughts tokens: ${response.usageMetadata.thoughtsTokenCount}`);
console.log(`Output tokens: ${response.usageMetadata.candidatesTokenCount}`);

ऐप पर जाएं

// ...
fmt.Println("Thoughts tokens:", response.UsageMetadata.ThoughtsTokenCount)
fmt.Println("Output tokens:", response.UsageMetadata.CandidatesTokenCount)

सूझ-बूझ वाले मॉडल, फ़ाइनल जवाब की क्वालिटी को बेहतर बनाने के लिए पूरी जानकारी जनरेट करते हैं. इसके बाद, वे खास जानकारी आउटपुट करते हैं, ताकि जवाब जनरेट करने की प्रोसेस के बारे में अहम जानकारी दी जा सके. इसलिए, कीमत इस बात पर निर्भर करती है कि खास जानकारी जनरेट करने के लिए, मॉडल को कितने थॉट टोकन की ज़रूरत है. भले ही, एपीआई से सिर्फ़ खास जानकारी आउटपुट की जाती हो.

टोकन की गिनती गाइड में, टोकन के बारे में ज़्यादा जानकारी दी गई है.

सबसे सही तरीके

इस सेक्शन में, सूझ-बूझ वाले मॉडल का बेहतर तरीके से इस्तेमाल करने के बारे में कुछ सलाह दी गई है. हमेशा की तरह, प्रॉम्प्ट देने से जुड़े हमारे दिशा-निर्देशों और सबसे सही तरीकों का पालन करने से आपको सबसे अच्छे नतीजे मिलेंगे.

डीबग करना और स्टीयर करना

  • जवाब देने के तरीके की समीक्षा करना: जब आपको थिंकिंग मॉडल से अपनी उम्मीद के मुताबिक जवाब नहीं मिलता है, तो Gemini के जवाब देने के तरीके की खास जानकारी को ध्यान से देखने से मदद मिल सकती है. आपको यह पता चल सकता है कि Gemini ने टास्क को कैसे पूरा किया और नतीजे पर कैसे पहुंचा. साथ ही, इस जानकारी का इस्तेमाल करके, सही नतीजे पाने के लिए Gemini को बेहतर निर्देश दिए जा सकते हैं.

  • जवाब के लिए दिशा-निर्देश देना: अगर आपको कोई लंबा जवाब चाहिए, तो अपने प्रॉम्प्ट में दिशा-निर्देश दें. इससे मॉडल को सोचने-समझने में लगने वाले समय को कम करने में मदद मिलेगी. इससे आपको अपने जवाब के लिए, ज़्यादा टोकन आउटपुट रिज़र्व करने की सुविधा मिलती है.

टास्क की जटिलता

  • आसान टास्क (सोचने की प्रोसेस बंद हो सकती है): ऐसे सीधे-सादे अनुरोधों के लिए सोचने की प्रोसेस की ज़रूरत नहीं होती जिनमें जटिल तर्क की ज़रूरत नहीं होती. जैसे, तथ्यों को ढूंढना या उन्हें कैटगरी में बांटना. उदाहरण के लिए:
    • "DeepMind की स्थापना कहां हुई थी?"
    • "क्या इस ईमेल में मीटिंग के लिए कहा गया है या सिर्फ़ जानकारी दी गई है?"
  • सामान्य टास्क (डिफ़ॉल्ट/कुछ सोच-विचार): कई सामान्य अनुरोधों के लिए, सिलसिलेवार तरीके से प्रोसेस करने या बेहतर तरीके से समझने की ज़रूरत होती है. Gemini, सोचने की क्षमता का इस्तेमाल इन कामों के लिए कर सकता है:
    • प्रकाश संश्लेषण और बड़े होने की प्रक्रिया के बीच समानताएं बताओ.
    • इलेक्ट्रिक कारों और हाइब्रिड कारों की तुलना करें और उनके बीच अंतर बताएं.
  • मुश्किल टास्क (सोचने-समझने की ज़्यादा क्षमता): मुश्किल टास्क के लिए, जैसे कि गणित की मुश्किल समस्याओं को हल करना या कोडिंग से जुड़े टास्क, हमारा सुझाव है कि आप ज़्यादा थिंकिंग बजट सेट करें. इस तरह के टास्क के लिए, मॉडल को अपनी पूरी रीज़निंग और प्लानिंग की क्षमताओं का इस्तेमाल करना पड़ता है. जवाब देने से पहले, अक्सर कई इंटरनल स्टेप शामिल होते हैं. उदाहरण के लिए:
    • AIME 2025 में पहला सवाल हल करें: उन सभी पूर्णांक आधारों b > 9 का योग निकालें जिनके लिए 17b, 97b का भाजक है.
    • किसी वेब ऐप्लिकेशन के लिए Python कोड लिखो. यह ऐप्लिकेशन, शेयर बाज़ार के रीयल-टाइम डेटा को विज़ुअलाइज़ करता हो. साथ ही, इसमें उपयोगकर्ता की पुष्टि करने की सुविधा भी शामिल हो. इसे ज़्यादा से ज़्यादा असरदार बनाएं.

इस्तेमाल किए जा सकने वाले मॉडल, टूल, और सुविधाएँ

सोच-विचार करने की सुविधाएँ, 4, 3, और 2.5 सीरीज़ के सभी मॉडल पर उपलब्ध हैं. आपको मॉडल की खास जानकारी पेज पर, मॉडल की सभी क्षमताओं के बारे में जानकारी मिलेगी.

सूझ-बूझ वाले मॉडल, Gemini के सभी टूल और सुविधाओं के साथ काम करते हैं. इससे मॉडल, बाहरी सिस्टम के साथ इंटरैक्ट कर सकते हैं, कोड को एक्ज़ीक्यूट कर सकते हैं या रीयल-टाइम जानकारी को ऐक्सेस कर सकते हैं. साथ ही, नतीजों को अपनी रीजनिंग और फ़ाइनल जवाब में शामिल कर सकते हैं.

सूझ-बूझ वाले मॉडल के साथ टूल इस्तेमाल करने के उदाहरण, [सूझ-बूझ वाले मॉडल के लिए कुकबुक][Colab] में देखे जा सकते हैं.

आगे क्या करना है?

[Colab]: https://colab.sandbox.google.com/github/google-gemini/cookbook/blob/main/quickstarts/Get_started_thinking.ipynb