Gemini 3 की डेवलपर गाइड

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

Gemini 3 की सुविधा वाले ऐप्लिकेशन के हमारे कलेक्शन को एक्सप्लोर करें. इससे आपको पता चलेगा कि यह मॉडल, ऐडवांस रीज़निंग, ऑटोनॉमस कोडिंग, और मुश्किल मल्टीमॉडल टास्क को कैसे हैंडल करता है.

कोड की कुछ लाइनों के साथ शुरू करें:

Python

from google import genai

client = genai.Client()

response = client.models.generate_content(
    model="gemini-3-pro-preview",
    contents="Find the race condition in this multi-threaded C++ snippet: [code here]",
)

print(response.text)

JavaScript

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

const ai = new GoogleGenAI({});

async function run() {
  const response = await ai.models.generateContent({
    model: "gemini-3-pro-preview",
    contents: "Find the race condition in this multi-threaded C++ snippet: [code here]",
  });

  console.log(response.text);
}

run();

REST

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-preview:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [{
      "parts": [{"text": "Find the race condition in this multi-threaded C++ snippet: [code here]"}]
    }]
  }'

पेश है Gemini 3 सीरीज़

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

Gemini 3 Flash, 3-सीरीज़ का हमारा सबसे नया मॉडल है. इसमें Pro-लेवल की इंटेलिजेंस है. साथ ही, यह Flash की स्पीड और कीमत में उपलब्ध है.

Nano Banana Pro (इसे Gemini 3 Pro Image भी कहा जाता है), इमेज जनरेट करने वाला अब तक का हमारा सबसे शानदार मॉडल है.

Gemini 3 के सभी मॉडल फ़िलहाल, झलक के तौर पर उपलब्ध हैं.

मॉडल आईडी कॉन्टेक्स्ट विंडो (इन / आउट) जानकारी न मिलना कीमत (इनपुट / आउटपुट)*
gemini-3-pro-preview 10 लाख / 64 हज़ार जनवरी 2025 2 डॉलर / 12 डॉलर (<2 लाख टोकन)
4 डॉलर / 18 डॉलर (>2 लाख टोकन)
gemini-3-flash-preview 10 लाख / 64 हज़ार जनवरी 2025 0.50 डॉलर / 3 डॉलर
gemini-3-pro-image-preview 65 हज़ार / 32 हज़ार जनवरी 2025 $2 (टेक्स्ट इनपुट) / $0.134 (इमेज आउटपुट)**

* जब तक कोई सूचना न दी जाए, तब तक कीमत 10 लाख टोकन के हिसाब से ली जाती है. ** इमेज की कीमत, रिज़ॉल्यूशन के हिसाब से अलग-अलग होती है. ज़्यादा जानकारी के लिए, कीमत तय करने से जुड़ा पेज देखें.

सीमाओं, कीमत, और अन्य जानकारी के बारे में ज़्यादा जानने के लिए, मॉडल पेज देखें.

Gemini 3 में नई API सुविधाएं

Gemini 3 में नए पैरामीटर जोड़े गए हैं. इनकी मदद से डेवलपर को लेटेन्सी, लागत, और मल्टीमॉडल फ़िडेलिटी पर ज़्यादा कंट्रोल मिलता है.

सोचने का लेवल

Gemini 3 सीरीज़ के मॉडल, डिफ़ॉल्ट रूप से डाइनैमिक थिंकिंग का इस्तेमाल करते हैं, ताकि वे प्रॉम्प्ट के बारे में सोच-समझकर जवाब दे सकें. thinking_level पैरामीटर का इस्तेमाल किया जा सकता है. यह पैरामीटर, जवाब जनरेट करने से पहले मॉडल की इंटरनल रीज़निंग प्रोसेस की ज़्यादा से ज़्यादा डेप्थ को कंट्रोल करता है. Gemini 3, इन लेवल को टोकन की गारंटी के तौर पर नहीं, बल्कि सोचने के लिए उपलब्ध संसाधनों के तौर पर देखता है.

अगर thinking_level के लिए कोई वैल्यू नहीं डाली गई है, तो Gemini 3 डिफ़ॉल्ट रूप से high पर सेट होता है. अगर आपको मुश्किल लॉजिकल रीज़निंग की ज़रूरत नहीं है, तो कम समय में जवाब पाने के लिए, मॉडल के सोचने के लेवल को low पर सेट करें.

Gemini 3 Pro और Flash के सोचने के लेवल:

Gemini 3 Pro और Flash, दोनों में सूझ-बूझ के ये लेवल काम करते हैं:

  • low: इससे इंतज़ार का समय और लागत कम हो जाती है. आसान निर्देशों का पालन करने, चैट करने या ज़्यादा थ्रूपुट वाले ऐप्लिकेशन के लिए सबसे सही
  • high (डिफ़ॉल्ट, डाइनैमिक): इससे जवाब में ज़्यादा से ज़्यादा जानकारी शामिल की जाती है. मॉडल को पहले टोकन तक पहुंचने में ज़्यादा समय लग सकता है. हालांकि, आउटपुट ज़्यादा सोच-समझकर दिया जाएगा.

Gemini 3 Flash के सोचने के लेवल

ऊपर दिए गए लेवल के अलावा, Gemini 3 Flash में सोच के ये लेवल भी काम करते हैं. फ़िलहाल, Gemini 3 Pro में ये लेवल काम नहीं करते:

  • minimal: यह सेटिंग, ज़्यादातर क्वेरी के लिए “सोचने की ज़रूरत नहीं है” सेटिंग से मेल खाती है. मुश्किल कोडिंग टास्क के लिए, मॉडल बहुत कम सोच-विचार कर सकता है. यह चैट या ज़्यादा थ्रूपुट वाले ऐप्लिकेशन के लिए, इंतज़ार के समय को कम करता है.

  • medium: ज़्यादातर टास्क के लिए, सोच-समझकर जवाब देने वाला मॉडल.

Python

from google import genai
from google.genai import types

client = genai.Client()

response = client.models.generate_content(
    model="gemini-3-pro-preview",
    contents="How does AI work?",
    config=types.GenerateContentConfig(
        thinking_config=types.ThinkingConfig(thinking_level="low")
    ),
)

print(response.text)

JavaScript

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

const ai = new GoogleGenAI({});

const response = await ai.models.generateContent({
    model: "gemini-3-pro-preview",
    contents: "How does AI work?",
    config: {
      thinkingConfig: {
        thinkingLevel: "low",
      }
    },
  });

console.log(response.text);

REST

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-preview:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [{
      "parts": [{"text": "How does AI work?"}]
    }],
    "generationConfig": {
      "thinkingConfig": {
        "thinkingLevel": "low"
      }
    }
  }'

मीडिया रिज़ॉल्यूशन

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

अब हर मीडिया पार्ट के लिए या ग्लोबल तौर पर रिज़ॉल्यूशन सेट किया जा सकता है. इसके लिए, media_resolution_low, media_resolution_medium, media_resolution_high या media_resolution_ultra_high का इस्तेमाल करें. ग्लोबल तौर पर रिज़ॉल्यूशन सेट करने के लिए, generation_config का इस्तेमाल करें. अल्ट्रा हाई रिज़ॉल्यूशन के लिए, ग्लोबल तौर पर रिज़ॉल्यूशन सेट करने की सुविधा उपलब्ध नहीं है. यह जानकारी उपलब्ध न होने पर, मॉडल मीडिया टाइप के आधार पर सबसे सही डिफ़ॉल्ट सेटिंग का इस्तेमाल करता है.

सुझाई गई सेटिंग

मीडिया किस तरह का है सुझाई गई सेटिंग ज़्यादा से ज़्यादा टोकन इस्तेमाल से जुड़े दिशा-निर्देश
इमेज media_resolution_high 1120 ज़्यादातर इमेज विश्लेषण के टास्क के लिए, इस विकल्प का इस्तेमाल करने का सुझाव दिया जाता है, ताकि सबसे अच्छी क्वालिटी मिल सके.
PDF media_resolution_medium 560 दस्तावेज़ को समझने के लिए सबसे सही; क्वालिटी आम तौर पर medium पर पहुंच जाती है. high बढ़ाने से, स्टैंडर्ड दस्तावेज़ों के लिए ओसीआर के नतीजों में शायद ही कभी सुधार होता है.
वीडियो (सामान्य) media_resolution_low (या media_resolution_medium) 70 (हर फ़्रेम के लिए) ध्यान दें: वीडियो के लिए, कॉन्टेक्स्ट के इस्तेमाल को ऑप्टिमाइज़ करने के लिए, low और medium सेटिंग को एक जैसा (70 टोकन) माना जाता है. यह कार्रवाई की पहचान करने और उसके बारे में बताने से जुड़े ज़्यादातर टास्क के लिए काफ़ी है.
वीडियो (इसमें ज़्यादातर टेक्स्ट होता है) media_resolution_high 280 (हर फ़्रेम के लिए) इसकी ज़रूरत सिर्फ़ तब होती है, जब इस्तेमाल के उदाहरण में टेक्स्ट को पढ़ना (ओसीआर) या वीडियो फ़्रेम में मौजूद छोटी-छोटी चीज़ों को पढ़ना शामिल हो.
जाएं

Python

from google import genai
from google.genai import types
import base64

# The media_resolution parameter is currently only available in the v1alpha API version.
client = genai.Client(http_options={'api_version': 'v1alpha'})

response = client.models.generate_content(
    model="gemini-3-pro-preview",
    contents=[
        types.Content(
            parts=[
                types.Part(text="What is in this image?"),
                types.Part(
                    inline_data=types.Blob(
                        mime_type="image/jpeg",
                        data=base64.b64decode("..."),
                    ),
                    media_resolution={"level": "media_resolution_high"}
                )
            ]
        )
    ]
)

print(response.text)

JavaScript

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

// The media_resolution parameter is currently only available in the v1alpha API version.
const ai = new GoogleGenAI({ apiVersion: "v1alpha" });

async function run() {
  const response = await ai.models.generateContent({
    model: "gemini-3-pro-preview",
    contents: [
      {
        parts: [
          { text: "What is in this image?" },
          {
            inlineData: {
              mimeType: "image/jpeg",
              data: "...",
            },
            mediaResolution: {
              level: "media_resolution_high"
            }
          }
        ]
      }
    ]
  });

  console.log(response.text);
}

run();

REST

curl "https://generativelanguage.googleapis.com/v1alpha/models/gemini-3-pro-preview:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [{
      "parts": [
        { "text": "What is in this image?" },
        {
          "inlineData": {
            "mimeType": "image/jpeg",
            "data": "..."
          },
          "mediaResolution": {
            "level": "media_resolution_high"
          }
        }
      ]
    }]
  }'

तापमान

हमारा सुझाव है कि Gemini 3 के लिए, टेंपरेचर पैरामीटर को उसकी डिफ़ॉल्ट वैल्यू 1.0 पर सेट रखें.

पिछले मॉडल में, क्रिएटिविटी और डिटरमिनिज़्म को कंट्रोल करने के लिए, अक्सर टेंपरेचर को ट्यून करने से फ़ायदा मिलता था. हालांकि, Gemini 3 की तर्क करने की क्षमताओं को डिफ़ॉल्ट सेटिंग के लिए ऑप्टिमाइज़ किया गया है. तापमान को बदलने (इसे 1.0 से कम पर सेट करने) से, मॉडल के काम करने के तरीके में अनचाहे बदलाव हो सकते हैं. जैसे, जवाब का बार-बार दोहराया जाना या परफ़ॉर्मेंस में गिरावट आना. ऐसा खास तौर पर, गणित के मुश्किल सवालों या तर्क से जुड़े टास्क में होता है.

हस्ताक्षर के बारे में जानकारी

Gemini 3, एपीआई कॉल के दौरान तर्क से जुड़े कॉन्टेक्स्ट को बनाए रखने के लिए, Thought signatures का इस्तेमाल करता है. ये सिग्नेचर, मॉडल की इंटरनल थॉट प्रोसेस के एन्क्रिप्ट किए गए वर्शन होते हैं. यह पक्का करने के लिए कि मॉडल में तर्क देने की क्षमता बनी रहे, आपको अपने अनुरोध में इन सिग्नेचर को मॉडल को ठीक उसी तरह वापस भेजना होगा जिस तरह से वे मिले थे:

  • फ़ंक्शन कॉलिंग (सख्ती से): एपीआई, "मौजूदा बातचीत" पर सख्ती से पुष्टि करने की सुविधा लागू करता है. हस्ताक्षर मौजूद न होने पर, 400 गड़बड़ी दिखेगी.

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

  • इमेज जनरेट/एडिट करना (सख्त): एपीआई, मॉडल के सभी हिस्सों पर पुष्टि करने की सख्त प्रक्रिया लागू करता है. इसमें thoughtSignature भी शामिल है. हस्ताक्षर मौजूद न होने पर, 400 गड़बड़ी दिखेगी.

फ़ंक्शन कॉल करना (सटीक पुष्टि)

जब Gemini कोई functionCall जनरेट करता है, तो वह thoughtSignature पर भरोसा करता है, ताकि अगले टर्न में टूल के आउटपुट को सही तरीके से प्रोसेस किया जा सके. "मौजूदा बातचीत" में, मॉडल (functionCall) और उपयोगकर्ता (functionResponse) के वे सभी चरण शामिल होते हैं जो पिछले स्टैंडर्ड उपयोगकर्ता text मैसेज के बाद हुए हैं.

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

टेक्स्ट और स्ट्रीमिंग

स्टैंडर्ड चैट या टेक्स्ट जनरेट करने के लिए, सिग्नेचर के मौजूद होने की गारंटी नहीं है.

  • स्ट्रीमिंग नहीं: जवाब के आखिरी हिस्से में thoughtSignature शामिल हो सकता है. हालांकि, यह हमेशा मौजूद नहीं होता. अगर कोई प्रॉडक्ट वापस आता है, तो आपको उसे वापस भेजना चाहिए, ताकि अच्छी परफ़ॉर्मेंस बनी रहे.
  • स्ट्रीमिंग: अगर कोई हस्ताक्षर जनरेट किया जाता है, तो हो सकता है कि वह फ़ाइनल चंक में आए. इसमें टेक्स्ट का खाली हिस्सा होता है. पक्का करें कि आपका स्ट्रीम पार्सर, हस्ताक्षर की जांच करता हो. भले ही, टेक्स्ट फ़ील्ड खाली हो.

इमेज जनरेट और एडिट करने की सुविधा

gemini-3-pro-image-preview के लिए, बातचीत करके बदलाव करने की सुविधा के लिए, थॉट सिग्नेचर ज़रूरी होते हैं. जब मॉडल से किसी इमेज में बदलाव करने के लिए कहा जाता है, तो वह पिछली बारी में मिले thoughtSignature का इस्तेमाल करता है. इससे उसे ओरिजनल इमेज की कंपोज़िशन और लॉजिक को समझने में मदद मिलती है.

  • बदलाव करना: जवाब के पहले हिस्से में, text या inlineData के बाद हस्ताक्षर ज़रूर होते हैं. साथ ही, हर inlineData हिस्से में भी हस्ताक्षर होते हैं. गड़बड़ियों से बचने के लिए, आपको इन सभी हस्ताक्षर को वापस भेजना होगा.

कोड के उदाहरण

एक के बाद एक कई फ़ंक्शन कॉल करना

उपयोगकर्ता ने एक ही बार में ऐसा सवाल पूछा है जिसमें दो अलग-अलग चरणों की ज़रूरत है (फ़्लाइट की जानकारी देखना -> टैक्सी बुक करना).

पहला चरण: मॉडल, फ़्लाइट टूल को कॉल करता है.
मॉडल, हस्ताक्षर <Sig_A> दिखाता है

// Model Response (Turn 1, Step 1)
  {
    "role": "model",
    "parts": [
      {
        "functionCall": { "name": "check_flight", "args": {...} },
        "thoughtSignature": "<Sig_A>" // SAVE THIS
      }
    ]
  }

दूसरा चरण: उपयोगकर्ता फ़्लाइट के नतीजे भेजता है
हमें <Sig_A> वापस भेजना होगा, ताकि मॉडल को ट्रेनिंग दी जा सके.

// User Request (Turn 1, Step 2)
[
  { "role": "user", "parts": [{ "text": "Check flight AA100..." }] },
  { 
    "role": "model", 
    "parts": [
      { 
        "functionCall": { "name": "check_flight", "args": {...} }, 
        "thoughtSignature": "<Sig_A>" // REQUIRED
      } 
    ]
  },
  { "role": "user", "parts": [{ "functionResponse": { "name": "check_flight", "response": {...} } }] }
]

तीसरा चरण: मॉडल, टैक्सी टूल को कॉल करता है
मॉडल को <Sig_A> के ज़रिए फ़्लाइट में हुई देरी के बारे में पता चलता है. अब वह टैक्सी बुक करने का फ़ैसला करता है. इससे नया हस्ताक्षर <Sig_B> जनरेट होता है.

// Model Response (Turn 1, Step 3)
{
  "role": "model",
  "parts": [
    {
      "functionCall": { "name": "book_taxi", "args": {...} },
      "thoughtSignature": "<Sig_B>" // SAVE THIS
    }
  ]
}

चौथा चरण: उपयोगकर्ता, टैक्सी का नतीजा भेजता है
इस बातचीत को पूरा करने के लिए, आपको पूरी चेन वापस भेजनी होगी: <Sig_A> और <Sig_B>.

// User Request (Turn 1, Step 4)
[
  // ... previous history ...
  { 
    "role": "model", 
    "parts": [
       { "functionCall": { "name": "check_flight", ... }, "thoughtSignature": "<Sig_A>" } 
    ]
  },
  { "role": "user", "parts": [{ "functionResponse": {...} }] },
  { 
    "role": "model", 
    "parts": [
       { "functionCall": { "name": "book_taxi", ... }, "thoughtSignature": "<Sig_B>" } 
    ]
  },
  { "role": "user", "parts": [{ "functionResponse": {...} }] }
]

पैरलल फ़ंक्शन कॉलिंग

उपयोगकर्ता पूछता है: "पेरिस और लंदन का मौसम कैसा है." मॉडल, एक जवाब में दो फ़ंक्शन कॉल दिखाता है.

// User Request (Sending Parallel Results)
[
  {
    "role": "user",
    "parts": [
      { "text": "Check the weather in Paris and London." }
    ]
  },
  {
    "role": "model",
    "parts": [
      // 1. First Function Call has the signature
      {
        "functionCall": { "name": "check_weather", "args": { "city": "Paris" } },
        "thoughtSignature": "<Signature_A>" 
      },
      // 2. Subsequent parallel calls DO NOT have signatures
      {
        "functionCall": { "name": "check_weather", "args": { "city": "London" } }
      } 
    ]
  },
  {
    "role": "user",
    "parts": [
      // 3. Function Responses are grouped together in the next block
      {
        "functionResponse": { "name": "check_weather", "response": { "temp": "15C" } }
      },
      {
        "functionResponse": { "name": "check_weather", "response": { "temp": "12C" } }
      }
    ]
  }
]

टेक्स्ट/संदर्भ के हिसाब से तर्क (पुष्टि नहीं की गई)

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

// User Request (Follow-up question)
[
  { 
    "role": "user", 
    "parts": [{ "text": "What are the risks of this investment?" }] 
  },
  { 
    "role": "model", 
    "parts": [
      {
        "text": "I need to calculate the risk step-by-step. First, I'll look at volatility...",
        "thoughtSignature": "<Signature_C>" // Recommended to include
      }
    ]
  },
  { 
    "role": "user", 
    "parts": [{ "text": "Summarize that in one sentence." }] 
  }
]

इमेज जनरेट और एडिट करना

इमेज जनरेट करने के लिए, सिग्नेचर की पुष्टि करना ज़रूरी है. ये पहले हिस्से (टेक्स्ट या इमेज) और बाद के सभी इमेज वाले हिस्सों पर दिखते हैं. सभी को अगले टर्न में वापस कर दिया जाना चाहिए.

// Model Response (Turn 1)
{
  "role": "model",
  "parts": [
    // 1. First part ALWAYS has a signature (even if text)
    {
      "text": "I will generate a cyberpunk city...",
      "thoughtSignature": "<Signature_D>" 
    },
    // 2. ALL InlineData (Image) parts ALWAYS have signatures
    {
      "inlineData": { ... }, 
      "thoughtSignature": "<Signature_E>" 
    },
  ]
}

// User Request (Turn 2 - Requesting an Edit)
{
  "contents": [
    // History must include ALL signatures received
    {
      "role": "user",
      "parts": [{ "text": "Generate a cyberpunk city" }]
    },
    {
      "role": "model",
      "parts": [
         { "text": "...", "thoughtSignature": "<Signature_D>" },
         { "inlineData": "...", "thoughtSignature": "<Signature_E>" },
      ]
    },
    // New User Prompt
    {
      "role": "user",
      "parts": [{ "text": "Make it daytime." }]
    }
  ]
}

दूसरे मॉडल से माइग्रेट करना

अगर आपको किसी दूसरे मॉडल (जैसे, Gemini 2.5) का इस्तेमाल किया जाता है या Gemini 3 से जनरेट नहीं किया गया कस्टम फ़ंक्शन कॉल डाला जाता है, तो आपके पास मान्य हस्ताक्षर नहीं होगा.

इन खास स्थितियों में, पुष्टि करने की सख्त प्रक्रिया को बायपास करने के लिए, इस फ़ील्ड में यह डमी स्ट्रिंग डालें: "thoughtSignature": "context_engineering_is_the_way_to_go"

टूल की मदद से स्ट्रक्चर्ड आउटपुट जनरेट करना

Gemini 3 मॉडल की मदद से, स्ट्रक्चर्ड आउटपुट को बिल्ट-इन टूल के साथ जोड़ा जा सकता है. इनमें Google Search से मिली जानकारी का इस्तेमाल करना, यूआरएल का कॉन्टेक्स्ट, और कोड एक्ज़ीक्यूट करना शामिल हैं.

Python

from google import genai
from google.genai import types
from pydantic import BaseModel, Field
from typing import List

class MatchResult(BaseModel):
    winner: str = Field(description="The name of the winner.")
    final_match_score: str = Field(description="The final match score.")
    scorers: List[str] = Field(description="The name of the scorer.")

client = genai.Client()

response = client.models.generate_content(
    model="gemini-3-pro-preview",
    contents="Search for all details for the latest Euro.",
    config={
        "tools": [
            {"google_search": {}},
            {"url_context": {}}
        ],
        "response_mime_type": "application/json",
        "response_json_schema": MatchResult.model_json_schema(),
    },  
)

result = MatchResult.model_validate_json(response.text)
print(result)

JavaScript

import { GoogleGenAI } from "@google/genai";
import { z } from "zod";
import { zodToJsonSchema } from "zod-to-json-schema";

const ai = new GoogleGenAI({});

const matchSchema = z.object({
  winner: z.string().describe("The name of the winner."),
  final_match_score: z.string().describe("The final score."),
  scorers: z.array(z.string()).describe("The name of the scorer.")
});

async function run() {
  const response = await ai.models.generateContent({
    model: "gemini-3-pro-preview",
    contents: "Search for all details for the latest Euro.",
    config: {
      tools: [
        { googleSearch: {} },
        { urlContext: {} }
      ],
      responseMimeType: "application/json",
      responseJsonSchema: zodToJsonSchema(matchSchema),
    },
  });

  const match = matchSchema.parse(JSON.parse(response.text));
  console.log(match);
}

run();

REST

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-preview:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [{
      "parts": [{"text": "Search for all details for the latest Euro."}]
    }],
    "tools": [
      {"googleSearch": {}},
      {"urlContext": {}}
    ],
    "generationConfig": {
        "responseMimeType": "application/json",
        "responseJsonSchema": {
            "type": "object",
            "properties": {
                "winner": {"type": "string", "description": "The name of the winner."},
                "final_match_score": {"type": "string", "description": "The final score."},
                "scorers": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "The name of the scorer."
                }
            },
            "required": ["winner", "final_match_score", "scorers"]
        }
    }
  }'

Image generation

Gemini 3 Pro Image की मदद से, टेक्स्ट प्रॉम्प्ट से इमेज जनरेट की जा सकती हैं और उनमें बदलाव किया जा सकता है. यह प्रॉम्प्ट के बारे में "सोचने" के लिए तर्क का इस्तेमाल करता है. साथ ही, यह रीयल-टाइम डेटा को ऐक्सेस कर सकता है. जैसे, मौसम का पूर्वानुमान या स्टॉक चार्ट. इसके बाद, यह Google Search से मिली जानकारी का इस्तेमाल करके, ज़्यादा सटीक इमेज जनरेट करता है.

नई और बेहतर सुविधाएँ:

  • 4K और टेक्स्ट रेंडरिंग: 2K और 4K रिज़ॉल्यूशन तक के टेक्स्ट और डायग्राम जनरेट करें.
  • भरोसेमंद जानकारी के आधार पर इमेज जनरेट करना: google_search टूल का इस्तेमाल करके, तथ्यों की पुष्टि करें और असल दुनिया की जानकारी के आधार पर इमेज जनरेट करें.
  • बातचीत करके इमेज में बदलाव करना: इमेज में बदलाव करने के लिए, सिर्फ़ बदलाव करने के लिए कहें. जैसे, "बैकग्राउंड में सूर्यास्त की तस्वीर लगाओ"). यह वर्कफ़्लो, बातचीत के दौरान विज़ुअल कॉन्टेक्स्ट को बनाए रखने के लिए थॉट सिग्नेचर पर निर्भर करता है.

आस्पेक्ट रेशियो, बदलाव करने के वर्कफ़्लो, और कॉन्फ़िगरेशन के विकल्पों के बारे में पूरी जानकारी के लिए, इमेज जनरेट करने से जुड़ी गाइड देखें.

Python

from google import genai
from google.genai import types

client = genai.Client()

response = client.models.generate_content(
    model="gemini-3-pro-image-preview",
    contents="Generate an infographic of the current weather in Tokyo.",
    config=types.GenerateContentConfig(
        tools=[{"google_search": {}}],
        image_config=types.ImageConfig(
            aspect_ratio="16:9",
            image_size="4K"
        )
    )
)

image_parts = [part for part in response.parts if part.inline_data]

if image_parts:
    image = image_parts[0].as_image()
    image.save('weather_tokyo.png')
    image.show()

JavaScript

import { GoogleGenAI } from "@google/genai";
import * as fs from "node:fs";

const ai = new GoogleGenAI({});

async function run() {
  const response = await ai.models.generateContent({
    model: "gemini-3-pro-image-preview",
    contents: "Generate a visualization of the current weather in Tokyo.",
    config: {
      tools: [{ googleSearch: {} }],
      imageConfig: {
        aspectRatio: "16:9",
        imageSize: "4K"
      }
    }
  });

  for (const part of response.candidates[0].content.parts) {
    if (part.inlineData) {
      const imageData = part.inlineData.data;
      const buffer = Buffer.from(imageData, "base64");
      fs.writeFileSync("weather_tokyo.png", buffer);
    }
  }
}

run();

REST

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [{
      "parts": [{"text": "Generate a visualization of the current weather in Tokyo."}]
    }],
    "tools": [{"googleSearch": {}}],
    "generationConfig": {
        "imageConfig": {
          "aspectRatio": "16:9",
          "imageSize": "4K"
      }
    }
  }'

जवाब का उदाहरण

टोक्यो का मौसम

मल्टीमॉडल फ़ंक्शन के जवाब

मल्टीमॉडल फ़ंक्शन कॉलिंग की मदद से, उपयोगकर्ताओं को फ़ंक्शन के ऐसे जवाब मिलते हैं जिनमें मल्टीमॉडल ऑब्जेक्ट शामिल होते हैं. इससे मॉडल की फ़ंक्शन कॉलिंग की क्षमताओं का बेहतर इस्तेमाल किया जा सकता है. स्टैंडर्ड फ़ंक्शन कॉलिंग की सुविधा, सिर्फ़ टेक्स्ट पर आधारित फ़ंक्शन के जवाबों के साथ काम करती है:

Python

from google import genai
from google.genai import types

import requests

client = genai.Client()

# This is a manual, two turn multimodal function calling workflow:

# 1. Define the function tool
get_image_declaration = types.FunctionDeclaration(
  name="get_image",
  description="Retrieves the image file reference for a specific order item.",
  parameters={
      "type": "object",
      "properties": {
          "item_name": {
              "type": "string",
              "description": "The name or description of the item ordered (e.g., 'instrument')."
          }
      },
      "required": ["item_name"],
  },
)
tool_config = types.Tool(function_declarations=[get_image_declaration])

# 2. Send a message that triggers the tool
prompt = "Show me the instrument I ordered last month."
response_1 = client.models.generate_content(
  model="gemini-3-flash-preview",
  contents=[prompt],
  config=types.GenerateContentConfig(
      tools=[tool_config],
  )
)

# 3. Handle the function call
function_call = response_1.function_calls[0]
requested_item = function_call.args["item_name"]
print(f"Model wants to call: {function_call.name}")

# Execute your tool (e.g., call an API)
# (This is a mock response for the example)
print(f"Calling external tool for: {requested_item}")

function_response_data = {
  "image_ref": {"$ref": "instrument.jpg"},
}
image_path = "https://goo.gle/instrument-img"
image_bytes = requests.get(image_path).content
function_response_multimodal_data = types.FunctionResponsePart(
  inline_data=types.FunctionResponseBlob(
    mime_type="image/jpeg",
    display_name="instrument.jpg",
    data=image_bytes,
  )
)

# 4. Send the tool's result back
# Append this turn's messages to history for a final response.
history = [
  types.Content(role="user", parts=[types.Part(text=prompt)]),
  response_1.candidates[0].content,
  types.Content(
    role="tool",
    parts=[
        types.Part.from_function_response(
          name=function_call.name,
          response=function_response_data,
          parts=[function_response_multimodal_data]
        )
    ],
  )
]

response_2 = client.models.generate_content(
  model="gemini-3-flash-preview",
  contents=history,
  config=types.GenerateContentConfig(
      tools=[tool_config],
      thinking_config=types.ThinkingConfig(include_thoughts=True)
  ),
)

print(f"\nFinal model response: {response_2.text}")

JavaScript

import { GoogleGenAI, Type } from '@google/genai';

const client = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

// This is a manual, two turn multimodal function calling workflow:
// 1. Define the function tool
const getImageDeclaration = {
  name: 'get_image',
  description: 'Retrieves the image file reference for a specific order item.',
  parameters: {
    type: Type.OBJECT,
    properties: {
      item_name: {
        type: Type.STRING,
        description: "The name or description of the item ordered (e.g., 'instrument').",
      },
    },
    required: ['item_name'],
  },
};

const toolConfig = {
  functionDeclarations: [getImageDeclaration],
};

// 2. Send a message that triggers the tool
const prompt = 'Show me the instrument I ordered last month.';
const response1 = await client.models.generateContent({
  model: 'gemini-3-flash-preview',
  contents: prompt,
  config: {
    tools: [toolConfig],
  },
});

// 3. Handle the function call
const functionCall = response1.functionCalls[0];
const requestedItem = functionCall.args.item_name;
console.log(`Model wants to call: ${functionCall.name}`);

// Execute your tool (e.g., call an API)
// (This is a mock response for the example)
console.log(`Calling external tool for: ${requestedItem}`);

const functionResponseData = {
  image_ref: { $ref: 'instrument.jpg' },
};

const imageUrl = "https://goo.gle/instrument-img";
const response = await fetch(imageUrl);
const imageArrayBuffer = await response.arrayBuffer();
const base64ImageData = Buffer.from(imageArrayBuffer).toString('base64');

const functionResponseMultimodalData = {
  inlineData: {
    mimeType: 'image/jpeg',
    displayName: 'instrument.jpg',
    data: base64ImageData,
  },
};

// 4. Send the tool's result back
// Append this turn's messages to history for a final response.
const history = [
  { role: 'user', parts: [{ text: prompt }] },
  response1.candidates[0].content,
  {
    role: 'tool',
    parts: [
      {
        functionResponse: {
          name: functionCall.name,
          response: functionResponseData,
          parts: [functionResponseMultimodalData],
        },
      },
    ],
  },
];

const response2 = await client.models.generateContent({
  model: 'gemini-3-flash-preview',
  contents: history,
  config: {
    tools: [toolConfig],
    thinkingConfig: { includeThoughts: true },
  },
});

console.log(`\nFinal model response: ${response2.text}`);

REST

IMG_URL="https://goo.gle/instrument-img"

MIME_TYPE=$(curl -sIL "$IMG_URL" | grep -i '^content-type:' | awk -F ': ' '{print $2}' | sed 's/\r$//' | head -n 1)
if [[ -z "$MIME_TYPE" || ! "$MIME_TYPE" == image/* ]]; then
  MIME_TYPE="image/jpeg"
fi

# Check for macOS
if [[ "$(uname)" == "Darwin" ]]; then
  IMAGE_B64=$(curl -sL "$IMG_URL" | base64 -b 0)
elif [[ "$(base64 --version 2>&1)" = *"FreeBSD"* ]]; then
  IMAGE_B64=$(curl -sL "$IMG_URL" | base64)
else
  IMAGE_B64=$(curl -sL "$IMG_URL" | base64 -w0)
fi

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [
      ...,
      {
        "role": "user",
        "parts": [
        {
            "functionResponse": {
              "name": "get_image",
              "response": {
                "image_ref": {
                  "$ref": "instrument.jpg"
                }
              },
              "parts": [
                {
                  "inlineData": {
                    "displayName": "instrument.jpg",
                    "mimeType":"'"$MIME_TYPE"'",
                    "data": "'"$IMAGE_B64"'"
                  }
                }
              ]
            }
          }
        ]
      }
    ]
  }'

Gemini 2.5 से माइग्रेट करना

Gemini 3, अब तक का हमारा सबसे बेहतरीन मॉडल है. यह Gemini 2.5 से ज़्यादा बेहतर है. माइग्रेट करते समय, इन बातों का ध्यान रखें:

  • सोच-समझकर जवाब देना: अगर आपने Gemini 2.5 को सोच-समझकर जवाब देने के लिए, प्रॉम्प्ट इंजीनियरिंग की मुश्किल तकनीकों (जैसे, चेन ऑफ़ थॉट) का इस्तेमाल किया था, तो thinking_level: "high" और आसान प्रॉम्प्ट के साथ Gemini 3 को आज़माएँ.
  • तापमान की सेटिंग: अगर आपके मौजूदा कोड में तापमान को साफ़ तौर पर सेट किया गया है (खास तौर पर, भरोसेमंद आउटपुट के लिए कम वैल्यू पर सेट किया गया है), तो हमारा सुझाव है कि आप इस पैरामीटर को हटा दें. साथ ही, Gemini 3 के डिफ़ॉल्ट तापमान 1.0 का इस्तेमाल करें. इससे, लूपिंग से जुड़ी संभावित समस्याओं या मुश्किल टास्क में परफ़ॉर्मेंस में गिरावट से बचा जा सकेगा.
  • PDF और दस्तावेज़ को समझना: PDF के लिए, ओसीआर का डिफ़ॉल्ट रिज़ॉल्यूशन बदल गया है. अगर आपने दस्तावेज़ को पार्स करने के लिए, किसी खास तरीके का इस्तेमाल किया है, तो नई media_resolution_high सेटिंग को आज़माएं. इससे यह पक्का किया जा सकेगा कि जानकारी सटीक बनी रहे.
  • टोकन का इस्तेमाल: Gemini 3 के डिफ़ॉल्ट सेटिंग पर माइग्रेट करने से, PDF के लिए टोकन का इस्तेमाल बढ़ सकता है. हालांकि, वीडियो के लिए टोकन का इस्तेमाल कम हो सकता है. अगर डिफ़ॉल्ट रिज़ॉल्यूशन ज़्यादा होने की वजह से, अनुरोध अब कॉन्टेक्स्ट विंडो से ज़्यादा हो जाते हैं, तो हमारा सुझाव है कि मीडिया रिज़ॉल्यूशन को साफ़ तौर पर कम करें.
  • इमेज सेगमेंटेशन: इमेज सेगमेंटेशन की सुविधाएं (ऑब्जेक्ट के लिए पिक्सल-लेवल के मास्क दिखाना) Gemini 3 Pro या Gemini 3 Flash में काम नहीं करती हैं. जिन कामों के लिए इमेज सेगमेंटेशन की सुविधा की ज़रूरत होती है उनके लिए, हमारा सुझाव है कि आप सूझ-बूझ वाली सुविधा बंद करके Gemini 2.5 Flash या Gemini Robotics-ER 1.5 का इस्तेमाल जारी रखें.
  • टूल के साथ काम करने की सुविधा: Maps grounding और कंप्यूटर इस्तेमाल करने वाले टूल, Gemini 3 मॉडल के साथ काम नहीं करते. इसलिए, इन्हें माइग्रेट नहीं किया जाएगा. इसके अलावा, फ़िलहाल बिल्ट-इन टूल के साथ फ़ंक्शन कॉलिंग का इस्तेमाल नहीं किया जा सकता.

OpenAI के साथ काम करने की सुविधा

OpenAI के साथ काम करने वाली लेयर का इस्तेमाल करने वाले लोगों के लिए, स्टैंडर्ड पैरामीटर अपने-आप Gemini के मिलते-जुलते पैरामीटर पर मैप हो जाते हैं:

  • reasoning_effort (OAI) को thinking_level (Gemini) पर मैप किया जाता है. ध्यान दें कि Gemini 3 Flash पर, reasoning_effort मीडियम, thinking_level हाई पर मैप करता है.

प्रॉम्प्ट लिखने के सबसे सही तरीके

Gemini 3, रीज़निंग करने वाला मॉडल है. इससे प्रॉम्प्ट देने का तरीका बदल जाता है.

  • सटीक निर्देश: अपने इनपुट प्रॉम्प्ट में कम शब्दों का इस्तेमाल करें. Gemini 3, सीधे और साफ़ तौर पर दिए गए निर्देशों का सबसे अच्छा जवाब देता है. यह पुराने मॉडल के लिए इस्तेमाल की गई, बहुत ज़्यादा शब्दों वाली या बहुत मुश्किल प्रॉम्प्ट इंजीनियरिंग तकनीकों का ज़्यादा विश्लेषण कर सकता है.
  • जवाब में शब्दों का इस्तेमाल: डिफ़ॉल्ट रूप से, Gemini 3 कम शब्दों में जवाब देता है. यह सीधे तौर पर और असरदार तरीके से जवाब देने को प्राथमिकता देता है. अगर आपको अपने इस्तेमाल के उदाहरण के लिए, ज़्यादा बातचीत करने वाले या "चैटिंग" वाले पर्सोना की ज़रूरत है, तो आपको प्रॉम्प्ट में मॉडल को साफ़ तौर पर बताना होगा. उदाहरण के लिए, "इसे एक दोस्त की तरह, बातचीत करने वाले असिस्टेंट के तौर पर समझाओ").
  • संदर्भ मैनेज करना: बड़े डेटासेट (जैसे, पूरी किताबें, कोडबेस या लंबे वीडियो) के साथ काम करते समय, अपने खास निर्देश या सवाल, प्रॉम्प्ट के आखिर में रखें. ऐसा डेटा के संदर्भ के बाद करें. मॉडल के जवाब को दिए गए डेटा से जोड़ें. इसके लिए, अपने सवाल की शुरुआत "ऊपर दी गई जानकारी के आधार पर..." जैसे वाक्यांश से करें.

प्रॉम्प्ट इंजीनियरिंग गाइड में, प्रॉम्प्ट डिज़ाइन करने की रणनीतियों के बारे में ज़्यादा जानें.

अक्सर पूछे जाने वाले सवाल

  1. Gemini 3 के लिए, जानकारी अपडेट होने की आखिरी तारीख क्या है? Gemini 3 मॉडल के लिए, जानकारी के अपडेट होने की आखिरी तारीख जनवरी 2025 है. ज़्यादा नई जानकारी पाने के लिए, खोज के नतीजों से जुड़ी जानकारी टूल का इस्तेमाल करें.

  2. कॉन्टेक्स्ट विंडो की सीमाएं क्या हैं? Gemini 3 मॉडल, 10 लाख टोकन वाली कॉन्टेक्स्ट विंडो के साथ काम करते हैं. साथ ही, ये 64 हज़ार टोकन तक का आउटपुट दे सकते हैं.

  3. क्या Gemini 3 को बिना किसी शुल्क के इस्तेमाल किया जा सकता है? Gemini 3 Flash gemini-3-flash-preview के लिए, Gemini API में बिना शुल्क वाला टियर उपलब्ध है. Google AI Studio में, Gemini 3 Pro और Flash, दोनों को बिना किसी शुल्क के आज़माया जा सकता है. हालांकि, फ़िलहाल Gemini API में gemini-3-pro-preview के लिए, बिना किसी शुल्क वाला टियर उपलब्ध नहीं है.

  4. क्या मेरा पुराना thinking_budget कोड अब भी काम करेगा? हां, thinking_budget अब भी पुराने सिस्टम के साथ काम करता है. हालांकि, हमारा सुझाव है कि आप thinking_level पर माइग्रेट करें, ताकि आपको बेहतर परफ़ॉर्मेंस मिल सके. एक ही अनुरोध में दोनों का इस्तेमाल न करें.

  5. क्या Gemini 3, Batch API के साथ काम करता है? हाँ, Gemini 3, Batch API के साथ काम करता है.

  6. क्या कॉन्टेक्स्ट को कैश मेमोरी में सेव करने की सुविधा उपलब्ध है? हां, Gemini 3 के लिए कॉन्टेक्स्ट को कैश मेमोरी में सेव करने की सुविधा उपलब्ध है.

  7. Gemini 3 में किन टूल का इस्तेमाल किया जा सकता है? Gemini 3, Google Search, फ़ाइल खोजने, कोड चलाने, और यूआरएल के कॉन्टेक्स्ट के साथ काम करता है. यह आपके कस्टम टूल के लिए, स्टैंडर्ड फ़ंक्शन कॉलिंग की सुविधा भी देता है. हालांकि, यह सुविधा बिल्ट-इन टूल के साथ काम नहीं करती. कृपया ध्यान दें कि फ़िलहाल, Google Maps से मिली जानकारी का इस्तेमाल करना और कंप्यूटर का इस्तेमाल करना जैसी सुविधाएं उपलब्ध नहीं हैं.

अगले चरण

  • Gemini 3 Cookbook का इस्तेमाल शुरू करना
  • थिंकिंग लेवल और थिंकिंग बजट से थिंकिंग लेवल पर माइग्रेट करने के तरीके के बारे में जानने के लिए, Cookbook की गाइड देखें.