Gemini 3.5 Flash में नया क्या है

3.6 Flash & 3.5 Flash-Lite यह पेज

Gemini 3.5 Flash सामान्य रूप से उपलब्ध (GA) है. यह भरोसेमंद है और बड़े पैमाने पर प्रोडक्शन के लिए तैयार है. यह हमारा सबसे इंटेलिजेंट Flash मॉडल है. यह एजेंटिक एक्ज़ीक्यूशन, कोडिंग, और लंबे समय तक चलने वाले टास्क में लगातार बेहतरीन परफ़ॉर्मेंस देता है.

इस गाइड में, Gemini 3.5 Flash में किए गए सुधारों, एपीआई में हुए बदलावों, और माइग्रेशन के बारे में जानकारी दी गई है.

नया मॉडल

मॉडल मॉडल आईडी ब्यौरा
Gemini 3.5 Flash gemini-3.5-flash यह हमारा सबसे बेहतरीन मॉडल है. यह एजेंटिक और कोडिंग से जुड़े कामों को लगातार बेहतर तरीके से पूरा करता है.

Gemini 3.5 Flash में 10 लाख टोकन वाली कॉन्टेक्स्ट विंडो, ज़्यादा से ज़्यादा 65 हज़ार आउटपुट टोकन, और सोचने-समझने की क्षमता होती है. साथ ही, इसमें Gemini 3 Flash की तरह ही टूल और प्लैटफ़ॉर्म की सुविधाएं होती हैं. इनमें कंप्यूटर का इस्तेमाल (प्रीव्यू) भी शामिल है.

पूरी जानकारी के लिए, मॉडल की खास जानकारी देखें. कीमत की जानकारी के लिए, कीमत तय करने से जुड़ा पेज देखें.

क्विकस्टार्ट

इस गाइड में दिए गए सभी उदाहरणों में, Interactions API का इस्तेमाल किया गया है. GenerateContent API भी काम करता है. इसके लिए, कॉन्फ़िगरेशन के वही विकल्प और सुझाव लागू होते हैं.

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3.5-flash",
    input="Explain how parallel agentic execution works in three sentences."
)
print(interaction.output_text)

JavaScript

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

const client = new GoogleGenAI({});

async function main() {
  const interaction = await client.interactions.create({
    model: "gemini-3.5-flash",
    input: "Explain how parallel agentic execution works in three sentences.",
  });
  console.log(interaction.output_text);
}

main();

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateModelInteraction params =
    CreateModelInteraction.builder()
        .model(Model.of("gemini-3.5-flash"))
        .input(
            InteractionsInput.of(
                "Explain how parallel agentic execution works in three sentences."))
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

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.5-flash",
    "input": "Explain how parallel agentic execution works in three sentences."
  }'

नया क्या है

  • बेहतरीन परफ़ॉर्मेंस: हमारा सबसे बेहतरीन Flash मॉडल, एजेंटिक और कोडिंग से जुड़े कामों को बड़े पैमाने पर करने के लिए ऑप्टिमाइज़ किया गया है.
  • एजेंटिक एक्ज़ीक्यूशन: सब-एजेंट को डिप्लॉय करना, समस्याओं को हल करना, और बड़े पैमाने पर एजेंटिक लूप को तेज़ी से लागू करना.
  • कोडिंग: कोडिंग के साइकल को दोहराना, तेज़ी से एक्सप्लोर करना, और प्रोटोटाइपिंग करना. इससे अलग-अलग पाथ को टेस्ट किया जा सकता है और डाइनैमिक तरीके से समाधानों को एक्सप्लोर किया जा सकता है.
  • लंबी अवधि: कई चरणों वाले वर्कफ़्लो और बड़े पैमाने पर टूल का इस्तेमाल.
  • सोच को बनाए रखना: मॉडल, कई बार की गई बातचीत के दौरान, तर्क को अपने-आप बनाए रखता है. एपीआई में कोई बदलाव करने की ज़रूरत नहीं है.
  • डिफ़ॉल्ट तौर पर तय किया गया नया लेवल: डिफ़ॉल्ट थिंकिंग एफर्ट को high से बदलकर medium कर दिया गया है. ज़्यादा जानकारी के लिए, डिफ़ॉल्ट बिडिंग की नई रणनीति देखें.
  • low की सोचने की क्षमता बेहतर हुई है: अब low, कोड और एजेंटिक टास्क के लिए काफ़ी बेहतर हो गया है. इन टास्क को पूरा करने के लिए कम चरणों की ज़रूरत होती है. साथ ही, ये कम समय और कम लागत में अच्छी क्वालिटी देते हैं.
  • जीए रिलीज़: बड़े पैमाने पर प्रोडक्शन के लिए स्टेबल मॉडल.

सही फ़्लैश मॉडल चुनना

Gemini 3.5 Flash, हमारा सबसे ऐडवांस और काबिल Flash मॉडल है. हालांकि, अलग-अलग इस्तेमाल के मामलों में, लागत और इंतज़ार के समय से जुड़ी अलग-अलग ज़रूरतें हो सकती हैं.

  • Gemini 3.1 Flash-Lite: कम लागत में ज़्यादा काम करने के लिए, Gemini 3.1 Flash-Lite का इस्तेमाल करें. यह उन कामों के लिए सबसे सही है जिनमें 3.5 Flash की तरह, ज़्यादा गहराई से तर्क करने की ज़रूरत नहीं होती. यह एक स्थिर और लंबे समय तक चलने वाला मॉडल है, जिसे बेहतर परफ़ॉर्मेंस के लिए ऑप्टिमाइज़ किया गया है. ज़्यादा जानकारी के लिए, Flash-Lite डेवलपर गाइड देखें.
  • Gemini 3 Flash की झलक: हम आपको सुझाव देते हैं कि आप GA की स्थिरता और बेहतर गहराई से विश्लेषण के लिए 3.5 Flash पर माइग्रेट करें. हालांकि, Gemini 3 Flash (Preview) उन डेवलपर के लिए उपलब्ध रहेगा जो झलक वाले मॉडल के साथ टेस्टिंग जारी रखना चाहते हैं.

व्यवहार में बदलाव

डिफ़ॉल्ट तौर पर तय किया गया नया प्रयास लेवल: medium

सोचने की डिफ़ॉल्ट क्षमता अब medium है. Gemini 3 Flash Preview में यह high थी. medium, कई तरह के टास्क के लिए बहुत अच्छे नतीजे देता है. साथ ही, यह ज़्यादा तेज़ और किफ़ायती है. मुश्किल समस्याओं के लिए, high मॉडल को ज़्यादा गहराई से सोचने के लिए बढ़ावा देता है.

कोशिश का लेवल कब इस्तेमाल करें
minimal जवाब देने में लगने वाले समय को कम करने के लिए ऑप्टिमाइज़ किया गया है. चैट जैसे इस्तेमाल के उदाहरण, तथ्यों के बारे में तुरंत जवाब पाना, टूल कॉल को आसान बनाना.
low कोडिंग और एजेंट से जुड़े ऐसे टास्क जिनमें इंतज़ार का समय कम हो और कम चरणों में पूरे किए जा सकें. यह विश्लेषण और लिखने से जुड़े ऐसे कामों के लिए भी अच्छी तरह से काम करता है जिनमें कुछ सोच-विचार करने की ज़रूरत होती है.
medium (डिफ़ॉल्ट) ज़्यादातर टास्क के लिए सबसे अच्छी क्वालिटी. इसका सुझाव, जटिल कोड और एजेंटिक इस्तेमाल के उदाहरणों के लिए दिया जाता है.
high इससे मॉडल को सोचने और टूल इस्तेमाल करने की ज़्यादा क्षमता मिलती है. यह मुश्किल लॉजिक, गणित के मुश्किल सवालों, और सबसे मुश्किल कोड या एजेंट टास्क के लिए सबसे अच्छा है. इससे ज़्यादा सोच-विचार करके जवाब देने और फ़ंक्शन कॉल करने की सुविधा मिलती है.

डिफ़ॉल्ट सेटिंग बदलने के लिए, अपने कॉन्फ़िगरेशन में thinking_level सेट करें:

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3.5-flash",
    input="Prove that the square root of 2 is irrational.",
    generation_config={"thinking_level": "high"},
)
print(interaction.output_text)

JavaScript

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

const client = new GoogleGenAI({});

async function main() {
  const interaction = await client.interactions.create({
    model: "gemini-3.5-flash",
    input: "Prove that the square root of 2 is irrational.",
    generationConfig: { thinkingLevel: "high" },
  });
  console.log(interaction.output_text);
}

main();

Java

import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.GenerationConfig;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ThinkingLevel;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;

Client client = new Client();

CreateModelInteraction params =
    CreateModelInteraction.builder()
        .model(Model.of("gemini-3.5-flash"))
        .input(InteractionsInput.of("Prove that the square root of 2 is irrational."))
        .generationConfig(GenerationConfig.builder().thinkingLevel(ThinkingLevel.HIGH).build())
        .build();

Interaction interaction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(interaction.outputText().orElse(""));

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.5-flash",
    "input": "Prove that the square root of 2 is irrational.",
    "generation_config": {"thinking_level": "high"}
  }'

इस टेबल में दिखाया गया है कि हर मॉडल के साथ, किस तरह की सोच का इस्तेमाल किया जा सकता है:

सोचने का लेवल Gemini 3.5 Flash Gemini 3.1 Pro Gemini 3.1 Flash-Lite Gemini 3 Flash ब्यौरा
minimal काम करता है काम नहीं करता है काम करता है (डिफ़ॉल्ट) काम करता है ज़्यादातर क्वेरी के लिए, यह "सोचने की ज़रूरत नहीं है" सेटिंग से मेल खाती है. ध्यान दें कि minimal इस बात की गारंटी नहीं देता कि सोचने-समझने की क्षमता बंद हो गई है. मॉडल, मुश्किल कामों के लिए बहुत कम तर्क दे सकता है.
low काम करता है काम करता है काम करता है काम करता है इससे इंतज़ार का समय और लागत कम होती है.
medium काम करता है (डिफ़ॉल्ट) काम करता है काम करता है काम करता है ज़्यादातर कामों के लिए, सोच-समझकर जवाब देता है.
high काम करता है (डाइनैमिक) काम करता है (डिफ़ॉल्ट, डाइनैमिक) काम करता है (डाइनैमिक) काम करता है (डिफ़ॉल्ट, डाइनैमिक) इससे गहराई से विश्लेषण की गहराई बढ़ जाती है.

विचार को बनाए रखना

यह मॉडल, कई बार की गई बातचीत के दौरान, तर्क को अपने-आप बनाए रखता है. बातचीत के इतिहास में मौजूद होने पर, विश्लेषण का कॉन्टेक्स्ट आगे बढ़ता है. इससे, कई चरणों वाले मुश्किल टास्क को पूरा करने में मदद मिलती है. जैसे, बार-बार डीबग करना और कोड को फिर से व्यवस्थित करना. एपीआई में कोई बदलाव करने की ज़रूरत नहीं है:

  • Interactions API: इसमें, थॉट अपने-आप सेव हो जाते हैं. व्यवहार में कोई बदलाव नहीं हुआ.
  • GenerateContent API: Gemini 3.5 Flash से शुरू होने वाले मॉडल, बातचीत के इतिहास में थॉट सिग्नेचर मौजूद होने पर, पिछले सभी टर्न से तर्क के कॉन्टेक्स्ट का इस्तेमाल करते हैं. इसे चालू करने के लिए, contents में बातचीत का पूरा और बिना बदलाव वाला इतिहास (इसमें सोच के सिग्नेचर भी शामिल हैं) पास करें. एसडीके, इसे अपने-आप मैनेज करते हैं.

Gemini 3.x में पैरामीटर से जुड़े अपडेट और सबसे सही तरीके

ये नीतियां, Gemini 3.5 Flash के साथ-साथ Gemini 3.x के सभी मॉडल पर लागू होती हैं.

  • temperature, top_p, top_k: हम डिफ़ॉल्ट वैल्यू में बदलाव न करने का सुझाव देते हैं. Gemini 3 की तर्क करने की क्षमताओं को डिफ़ॉल्ट सेटिंग के लिए ऑप्टिमाइज़ किया गया है.
  • thinking_budget के बजाय, thinking_level का इस्तेमाल करें.
  • फ़ंक्शन कॉल करने के जवाब का मेल खाना: id, name, और जवाब की संख्या, पिछले कॉल से मेल खानी चाहिए.
  • मल्टीमोडल फ़ंक्शन के जवाब: मल्टीमोडल कॉन्टेंट को फ़ंक्शन के जवाब में शामिल करें, न कि उसके बाहर.
  • फ़ंक्शन के जवाबों में इनलाइन निर्देश: इन्हें फ़ंक्शन के जवाब वाले टेक्स्ट में जोड़ा जाता है, अलग-अलग हिस्सों में नहीं.
  • ज़रूरत से ज़्यादा टूल कॉल कम करें: एजेंटिक वर्कफ़्लो में टूल कॉल कम करने के लिए, कम थिंकिंग लेवल का इस्तेमाल करें या सिस्टम के निर्देशों के साथ एक्सपेरिमेंट करें.

अपने कोड को अपडेट करने का तरीका जानने के लिए, यहां दिए गए सेक्शन देखें.

सैंपलिंग पैरामीटर (अब इस्तेमाल करने का सुझाव नहीं दिया जाता)

temperature, top_p, और top_k को अब Gemini 3.x के सभी मॉडल के लिए इस्तेमाल करने का सुझाव नहीं दिया जाता. Gemini 3 की तर्क करने की क्षमताओं को डिफ़ॉल्ट सेटिंग के लिए ऑप्टिमाइज़ किया गया है. सभी अनुरोधों से इन पैरामीटर को हटाएं.

# ⚠️ Remove these parameters (not recommended)
generation_config = {
    "temperature": 0.7,
    "top_p": 0.9,
    "top_k": 40,
}

निश्चितता बनाए रखने के लिए, हमारा सुझाव है कि आप अपने इस्तेमाल के खास उदाहरण के लिए, साफ़ तौर पर नियमों के साथ सिस्टम के निर्देश तय करें.

thinking_budget (अब इसका सुझाव नहीं दिया जाता)

Gemini 3.x के सभी मॉडल में, रॉ न्यूमेरिक thinking_budget पैरामीटर का इस्तेमाल करने का सुझाव नहीं दिया जाता. इसके बजाय, thinking_level स्ट्रिंग enum का इस्तेमाल करें.

# ⚠️ Before (not recommended)
generation_config = {
    "thinking": {"thinking_budget": 7500},
}

# ✅ After
generation_config = {
    "thinking": {"thinking_level": "medium"},
}

उपलब्ध वैल्यू: minimal, low, medium (डिफ़ॉल्ट), और high.

फ़ंक्शन कॉलिंग: जवाब का सटीक मिलान

फ़ंक्शन के जवाबों के मेल न खाने पर, Interactions API पहले से ही गड़बड़ी का मैसेज दिखाता है. GenerateContent API में अब तक कोई गड़बड़ी नहीं हुई है. हालांकि, जवाबों के मेल न खाने की वजह से, मॉडल ज़्यादातर मामलों में finish_reason: STOP के साथ खाली जवाब देता है. हमेशा इन नियमों का पालन करें:

आवश्यकता विवरण
id को शामिल करें हर FunctionResponse में, उससे जुड़े FunctionCall का id शामिल होना चाहिए
मैच name जवाब में मौजूद name, कॉल में मौजूद name से मेल खाना चाहिए
मिलते-जुलते एलिमेंट की संख्या हर FunctionCall के लिए, एक FunctionResponse वापस करें

Python

# ✅ Include matching call_id and name in the function_result
final_interaction = client.interactions.create(
    model="gemini-3.5-flash",
    previous_interaction_id=interaction.id,
    tools=[my_tool],
    input=[{
        "type": "function_result",
        "name": fc_step.name,
        "call_id": fc_step.id,
        "result": [{"type": "text", "text": json.dumps(result)}],
    }],
)

JavaScript

// ✅ Include matching call_id and name in the function_result
const finalInteraction = await client.interactions.create({
  model: "gemini-3.5-flash",
  previousInteractionId: interaction.id,
  tools: [myTool],
  input: [{
    type: "function_result",
    name: fcStep.name,
    call_id: fcStep.id,
    result: [{ type: "text", text: JSON.stringify(result) }],
  }],
});

Java

import java.util.Arrays;
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Function;
import com.google.genai.gaos.models.interactions.FunctionResultStep;
import com.google.genai.gaos.models.interactions.FunctionResultStepResultUnion;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.TextContent;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.List;

Client client = new Client();

// Assumes interactionId, callId, functionName, myTool, and resultJson from previous step
String interactionId = "interaction-id-123";
String callId = "call-id-123";
String functionName = "get_weather";
Function myTool = Function.builder().name(functionName).build();
String resultJson = "{\"temperature\": \"72F\"}";

// ✅ Include matching callId and name in the FunctionResultStep
FunctionResultStep functionResult =
    FunctionResultStep.builder()
        .name(functionName)
        .callId(callId)
        .result(
            FunctionResultStepResultUnion.of(
                Arrays.asList(TextContent.builder().text(resultJson).build())))
        .build();

CreateModelInteraction params =
    CreateModelInteraction.builder()
        .model(Model.of("gemini-3.5-flash"))
        .previousInteractionId(interactionId)
        .tools(Arrays.asList(myTool))
        .input(InteractionsInput.ofStep(Arrays.asList(functionResult)))
        .build();

Interaction finalInteraction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

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.5-flash",
    "previous_interaction_id": "<INTERACTION_ID>",
    "tools": [...],
    "input": [{
      "type": "function_result",
      "name": "my_function",
      "call_id": "<CALL_ID>",
      "result": [{"type": "text", "text": "..."}]
    }]
  }'

टेक्स्ट, इमेज, और वीडियो वगैरह का इस्तेमाल करके की गई क्वेरी के जवाब

हम अक्सर देखते हैं कि क्लाइंट, फ़ंक्शन के जवाब के बाहर इमेज उपलब्ध कराते हैं. इससे मॉडल का व्यवहार अप्रत्याशित हो सकता है.उदाहरण के लिए, थॉट लीकेज. साथ ही, इससे आउटपुट की क्वालिटी खराब हो सकती है. इसके बजाय, Multimodal Function Responses API के दस्तावेज़ में दिए गए सुझाव का पालन करें. साथ ही, फ़ंक्शन के जवाब के उन हिस्सों में मल्टीमॉडल कॉन्टेंट शामिल करें जिन्हें आपको मॉडल को भेजना है. मॉडल, इस मल्टीमॉडल कॉन्टेंट को अपने अगले टर्न में प्रोसेस कर सकता है, ताकि ज़्यादा जानकारी वाला जवाब दिया जा सके.

Python

# ✅ Include multimodal content in the function response
final_interaction = client.interactions.create(
    model="gemini-3.5-flash",
    previous_interaction_id=interaction.id,
    input=[
        {
            "type": "function_result",
            "name": tool_call.name,
            "call_id": tool_call.id,
            "result": [
                {"type": "text", "text": "instrument.jpg"},
                {
                    "type": "image",
                    "mime_type": "image/jpeg",
                    "data": base64_image_data,
                },
            ],
        }
    ],
)

JavaScript

// ✅ Include multimodal content in the function response
const finalInteraction = await client.interactions.create({
  model: "gemini-3.5-flash",
  previousInteractionId: interaction.id,
  input: [{
    type: "function_result",
    name: toolCall.name,
    call_id: toolCall.id,
    result: [
      { type: "text", text: "instrument.jpg" },
      {
        type: "image",
        mime_type: "image/jpeg",
        data: base64ImageData,
      },
    ],
  }],
});

Java

import java.util.Arrays;
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.FunctionResultStep;
import com.google.genai.gaos.models.interactions.FunctionResultStepResultUnion;
import com.google.genai.gaos.models.interactions.ImageContent;
import com.google.genai.gaos.models.interactions.ImageContentMimeType;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.TextContent;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.List;

Client client = new Client();

// Assumes interactionId, callId, functionName, and base64ImageData from previous step
String interactionId = "interaction-id-123";
String callId = "call-id-123";
String functionName = "get_instrument_image";
String base64ImageData = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=";

// ✅ Include multimodal content in the function response
FunctionResultStep functionResult =
    FunctionResultStep.builder()
        .name(functionName)
        .callId(callId)
        .result(
            FunctionResultStepResultUnion.of(
                Arrays.asList(
                    TextContent.builder().text("instrument.jpg").build(),
                    ImageContent.builder()
                        .mimeType(ImageContentMimeType.IMAGE_JPEG)
                        .data(base64ImageData)
                        .build())))
        .build();

CreateModelInteraction params =
    CreateModelInteraction.builder()
        .model(Model.of("gemini-3.5-flash"))
        .previousInteractionId(interactionId)
        .input(InteractionsInput.ofStep(Arrays.asList(functionResult)))
        .build();

Interaction finalInteraction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

फ़ंक्शन के जवाबों में इनलाइन निर्देश

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

Python

# ✅ Append inline instructions to the end of the function response separated by two newlines
result_text = f"{json.dumps(result)}\n\n<your inline instructions>"

final_interaction = client.interactions.create(
    model="gemini-3.5-flash",
    previous_interaction_id=interaction.id,
    tools=[my_tool],
    input=[{
        "type": "function_result",
        "name": fc_step.name,
        "call_id": fc_step.id,
        "result": [{"type": "text", "text": result_text}],
    }],
)

JavaScript

// ✅ Append inline instructions to the end of the function response separated by two newlines
const resultText = `${JSON.stringify(result)}\n\n<your inline instructions>`;

const finalInteraction = await client.interactions.create({
  model: "gemini-3.5-flash",
  previousInteractionId: interaction.id,
  tools: [myTool],
  input: [{
    type: "function_result",
    name: fcStep.name,
    call_id: fcStep.id,
    result: [{ type: "text", text: resultText }],
  }],
});

Java

import java.util.Arrays;
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Function;
import com.google.genai.gaos.models.interactions.FunctionResultStep;
import com.google.genai.gaos.models.interactions.FunctionResultStepResultUnion;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.TextContent;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.List;

Client client = new Client();

// Assumes interactionId, callId, functionName, myTool, and resultJson from previous step
String interactionId = "interaction-id-123";
String callId = "call-id-123";
String functionName = "get_weather";
Function myTool = Function.builder().name(functionName).build();
String resultJson = "{\"temperature\": \"72F\"}";

// ✅ Append inline instructions to the end of the function response separated by two newlines
String resultText = resultJson + "\n\n<your inline instructions>";

FunctionResultStep functionResult =
    FunctionResultStep.builder()
        .name(functionName)
        .callId(callId)
        .result(
            FunctionResultStepResultUnion.of(
                Arrays.asList(TextContent.builder().text(resultText).build())))
        .build();

CreateModelInteraction params =
    CreateModelInteraction.builder()
        .model(Model.of("gemini-3.5-flash"))
        .previousInteractionId(interactionId)
        .tools(Arrays.asList(myTool))
        .input(InteractionsInput.ofStep(Arrays.asList(functionResult)))
        .build();

Interaction finalInteraction =
    client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

ग़ैर-ज़रूरी टूल कॉल कम करना

अगर आपको टूल कॉल का ज़्यादा इस्तेमाल करने की समस्या आ रही है, तो इन दो तकनीकों से इसे कम किया जा सकता है:

  1. सोचने के लेवल को कम करके शुरू करें (medium, low या minimal): सोचने के लेवल को ज़्यादा रखने पर, मॉडल को एक्सप्लोर करने और पुष्टि करने के लिए ज़्यादा टूल इस्तेमाल करने के लिए बढ़ावा मिलता है. इसलिए, लेवल को कम करने से टूल कॉल कम हो सकते हैं.

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

    You have a limited action budget of <n> tool calls. Use them efficiently.
    

माइग्रेशन की चेकलिस्ट

हमारा सुझाव है कि आप google-genai SDK v2.0.0 या उसके बाद के वर्शन पर अपडेट करें. इस वर्शन में, Interactions API में बड़े बदलाव किए गए हैं. ज़्यादा जानकारी के लिए, एपीआई में हुए बड़े बदलावों के बारे में जानकारी देने वाली गाइड देखें.

Gemini 3 Flash की झलक आज़माने की सुविधा से माइग्रेट करना

  • मॉडल का नाम अपडेट करें: gemini-3-flash-previewgemini-3.5-flash
  • कीमत की समीक्षा करें. Gemini 3.5 Flash, Gemini 3 Flash Preview से ज़्यादा महंगा है. अगर आपको कम लागत में काम करना है, तो Gemini 3.1 Flash-Lite पर माइग्रेट करें. ज़्यादा जानकारी के लिए, कीमत तय करने से जुड़ा पेज देखें.
  • अपने कॉन्फ़िगरेशन से temperature, top_p, top_k हटाएं. अब इनका इस्तेमाल करने का सुझाव नहीं दिया जाता.
  • thinking_budget को thinking_level से बदलें.
  • id और उससे मेल खाने वाले name को सभी FunctionResponse हिस्सों में जोड़ें.
  • अपने प्रॉम्प्ट की जांच करें. डिफ़ॉल्ट कोशिश को highmedium में बदल दिया गया है; क्वालिटी, स्पीड, और लागत की पुष्टि करें.
  • विचार को बनाए रखने की सुविधा, अब डिफ़ॉल्ट रूप से चालू है. जवाब देने के लिए इस्तेमाल किया गया कॉन्टेक्स्ट, हर बार के जवाब में शामिल होता है. इससे परफ़ॉर्मेंस बेहतर होती है, लेकिन टोकन का इस्तेमाल बढ़ सकता है.
  • ज़रूरत से ज़्यादा टूल कॉल कम करें: इसके लिए, सबसे पहले सोचने की क्षमता (medium, low या minimal) को कम करें. अगर टूल का इस्तेमाल ज़्यादा हो रहा है, तो टूल के इस्तेमाल को सीमित करने के लिए, सिस्टम से जुड़े निर्देश जोड़ें.
  • कंप्यूटर का इस्तेमाल किया जा सकता है.

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

ऊपर दी गई सभी सुविधाएं. इसके अलावा, ये सुविधाएं भी मिलेंगी:

  • प्रॉम्प्ट को आसान बनाएं. अगर आपने सोच-समझकर, एक-एक करके जवाब देने के लिए प्रॉम्प्ट इंजीनियरिंग का इस्तेमाल किया है, तो इसके बजाय आसान प्रॉम्प्ट के साथ thinking_level: "medium" या "high" का इस्तेमाल करें.
  • PDF और मीडिया वर्कलोड की जांच करें. अगर आपने डेंस दस्तावेज़ पार्स करने के लिए किसी खास व्यवहार पर भरोसा किया है, तो media_resolution_high सेटिंग की जांच करें. इससे यह पक्का किया जा सकेगा कि नतीजे अब भी सटीक हैं. Gemini 3 के डिफ़ॉल्ट सेटिंग पर माइग्रेट करने से, PDF के लिए टोकन का इस्तेमाल बढ़ सकता है. हालांकि, वीडियो के लिए यह कम हो सकता है. अगर अनुरोध, कॉन्टेक्स्ट विंडो से ज़्यादा हैं, तो media_resolution को साफ़ तौर पर कम करें. ज़्यादा जानकारी के लिए, मीडिया रिज़ॉल्यूशन से जुड़े दस्तावेज़ देखें.
  • एक साथ कई टूल इस्तेमाल करने की सुविधा का फ़ायदा पाएं. एक ही अनुरोध में, Google Search, यूआरएल कॉन्टेक्स्ट, कोड एक्ज़ीक्यूशन, और कस्टम फ़ंक्शन का इस्तेमाल किया जा सकता है.
  • अगर मल्टीमोडल फ़ंक्शन के जवाबों का इस्तेमाल किया जा रहा है, तो मल्टीमोडल कॉन्टेंट को फ़ंक्शन के जवाब वाले हिस्सों में डालें, न कि उनके साथ.
  • फ़ंक्शन के जवाबों के साथ इनलाइन निर्देशों का इस्तेमाल करते समय, उन्हें अलग-अलग हिस्सों के तौर पर नहीं, बल्कि दो नई लाइनों से अलग किए गए फ़ंक्शन के जवाब वाले टेक्स्ट में जोड़ें.
  • Gemini 3.x में इमेज सेगमेंटेशन मौजूद नहीं है. सेगमेंटेशन से जुड़े वर्कलोड के लिए, Gemini 2.5 Flash का इस्तेमाल जारी रखें. हालांकि, इसके लिए आपको 'सोचने' की सुविधा बंद करनी होगी.
  • अपने कॉन्फ़िगरेशन से candidate_count को हटाएं (Gemini 3.x में मौजूद नहीं है)

Gemini 3 की परिवार के लिए उपलब्ध सुविधाएं

Gemini 3.5 Flash में, Gemini 3 मॉडल फ़ैमिली की सभी सुविधाएं शामिल हैं. इनमें कंप्यूटर का इस्तेमाल करने की सुविधा भी शामिल है. Gemini 3 में लॉन्च की गई ये सुविधाएं अब भी उपलब्ध हैं:

  • सोचना: एन्क्रिप्ट (सुरक्षित) किया गया एपीआई कॉल के दौरान, तर्क से जुड़े कॉन्टेक्स्ट को सुरक्षित रखा जाता है. Interactions API में अपने-आप; GenerateContent में इंप्लिसिट.
  • टूल की मदद से स्ट्रक्चर्ड आउटपुट: JSON मोड को बिल्ट-इन टूल (खोज, यूआरएल कॉन्टेक्स्ट, कोड एक्ज़ीक्यूट करना, फ़ंक्शन कॉल करना) के साथ मिलाएं.
  • कई मोड में फ़ंक्शन के जवाब: फ़ंक्शन कॉल के नतीजों में इमेज, ऑडियो, और अन्य मीडिया दिखाएं.
  • इमेज के साथ कोड को एक्ज़ीक्यूट करना: इमेज को प्रोसेस करने और जनरेट करने वाले कोड को एक्ज़ीक्यूट करें.
  • एक साथ कई टूल का इस्तेमाल करना: एक ही अनुरोध में, पहले से मौजूद टूल और कस्टम फ़ंक्शन कॉलिंग का इस्तेमाल करें.
  • मीडिया रिज़ॉल्यूशन: इमेज, वीडियो, और PDF इनपुट के लिए टोकन के बंटवारे पर बेहतर कंट्रोल. Gemini 3 मॉडल, अलग-अलग फ़िडेलिटी वाले प्रॉम्प्ट के लिए, हर कॉन्टेंट आइटम के हिसाब से रिज़ॉल्यूशन सेटिंग (low, medium, high, ultra_high) का इस्तेमाल करते हैं.
  • थॉट सिग्नेचर: मॉडल की इंटरनल रीज़निंग के एन्क्रिप्ट (सुरक्षित) किए गए वर्शन. स्टेटलेस मोड में, सिलसिलेवार बातचीत में फ़ंक्शन कॉलिंग के लिए ज़रूरी है. इसे Interactions API और आधिकारिक एसडीके अपने-आप मैनेज करते हैं.

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

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

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

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

सीमाएं

  • Gemini 3.x में इमेज सेगमेंटेशन मौजूद नहीं है. सेगमेंटेशन से जुड़े वर्कलोड के लिए, Gemini 2.5 Flash का इस्तेमाल जारी रखें. हालांकि, इसके लिए आपको 'सोचने' की सुविधा बंद करनी होगी.

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

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

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

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

  4. क्या Gemini 3.5 Flash, बैच एपीआई के साथ काम करता है? हां. ज़्यादा जानकारी के लिए, Batch API गाइड देखें.

  5. क्या कॉन्टेक्स्ट के लिए कैश मेमोरी की सुविधा काम करती है? हां, कॉन्टेक्स्ट के लिए कैश मेमोरी की सुविधा काम करती है.

  6. किन टूल का इस्तेमाल किया जा सकता है? Gemini 3.5 Flash इन सुविधाओं के साथ काम करता है: Google Search, Google Maps से जानकारी पाना, फ़ाइलें खोजना, कोड एक्ज़ीक्यूट करना, यूआरएल का कॉन्टेक्स्ट, और स्टैंडर्ड फ़ंक्शन कॉलिंग, इनमें ये शामिल हैं: एक साथ कई टूल इस्तेमाल करना और कंप्यूटर का इस्तेमाल करना.

अगले चरण