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

नया मॉडल अन्य मॉडल

Gemini 3.5 Flash (gemini-3.5-flash), Gemini 3 सीरीज़ का पुराना Flash मॉडल है. gemini-3.5-flash को भेजे गए अनुरोध, अपने-आप Gemini 3.6 Flash पर रीडायरेक्ट हो जाते हैं. हमारे नए Flash मॉडल के बारे में जानने के लिए, Gemini 3.8 Flash पर जाएं.

इस गाइड को पुराने रेफ़रंस के लिए सेव किया गया है. इसमें Gemini 3.x API में हुए बदलावों और पैरामीटर से जुड़े सुझावों के बारे में बताया गया है.

मॉडल अवलोकन

मॉडल मॉडल आईडी स्थिति
Gemini 3.5 Flash gemini-3.5-flash अब सेवा में नहीं है (अपने-आप gemini-3.6-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(""));

ऐप पर जाएं

package main

import (
    "context"
    "fmt"
    "log"

    "google.golang.org/genai"
    "google.golang.org/genai/interactions/models/interactions"
    "google.golang.org/genai/interactions/models/operations"
)

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

    res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
        Body: operations.NewCreateInteractionRequestBody(interactions.CreateModelInteraction{
            Model: interactions.Model("gemini-3.5-flash"),
            Input: interactions.NewInteractionsInput("Explain how parallel agentic execution works in three sentences."),
        }),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Interaction.OutputText != nil {
        fmt.Println(*res.Interaction.OutputText)
    }
}

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."
  }'

नया क्या है

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

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

gemini-3.5-flash को बंद कर दिया गया है और इसे अपने-आप gemini-3.6-flash पर रीडायरेक्ट कर दिया जाता है. इसलिए, हमारा सुझाव है कि आप इनमें से किसी एक चालू मॉडल पर माइग्रेट करें:

  • Gemini 3.8 Flash: यह हमारा नया और सबसे ऐडवांस Flash मॉडल है. इसका इस्तेमाल, मुश्किल कोडिंग और एजेंटिक वर्कफ़्लो के लिए किया जा सकता है. Gemini 3.8 Flash की गाइड देखें.
  • Gemini 3.6 Flash: यह gemini-3.5-flash की जगह इस्तेमाल किया जा सकता है. इसमें टोकन का इस्तेमाल कम होता है और आउटपुट की कीमत भी कम होती है. Gemini 3.6 Flash और 3.5 Flash-Lite से जुड़ी गाइड देखें.
  • Gemini 3.5 Flash-Lite / Gemini 3.1 Flash-Lite: कम लागत में ज़्यादा काम करने के लिए, Gemini 3.5 Flash-Lite या Gemini 3.1 Flash-Lite का इस्तेमाल करें. इन मॉडल का इस्तेमाल उन कामों के लिए किया जा सकता है जिनमें Flash की पूरी क्षमता की ज़रूरत नहीं होती.

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

कोशिश का नया डिफ़ॉल्ट लेवल: 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(""));

ऐप पर जाएं

package main

import (
    "context"
    "fmt"
    "log"

    "google.golang.org/genai"
    "google.golang.org/genai/interactions/models/interactions"
    "google.golang.org/genai/interactions/models/operations"
)

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

    res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
        Body: operations.NewCreateInteractionRequestBody(interactions.CreateModelInteraction{
            Model: interactions.Model("gemini-3.5-flash"),
            Input: interactions.NewInteractionsInput("Prove that the square root of 2 is irrational."),
            GenerationConfig: &interactions.GenerationConfig{
                ThinkingLevel: interactions.ThinkingLevelHigh.ToPointer(),
            },
        }),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Interaction.OutputText != nil {
        fmt.Println(*res.Interaction.OutputText)
    }
}

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();

ऐप पर जाएं

package main

import (
    "context"
    "log"

    "google.golang.org/genai"
    "google.golang.org/genai/interactions/models/interactions"
    "google.golang.org/genai/interactions/models/operations"
)

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

    // Assumes interactionID, callID, functionName, myTool, and resultJSON from previous step
    interactionID := "interaction-id-123"
    callID := "call-id-123"
    functionName := "get_weather"
    myTool := interactions.NewTool(interactions.Function{Name: genai.Ptr(functionName)})
    resultJSON := `{"temperature": "72F"}`

    // ✅ Include matching CallID and Name in the FunctionResultStep
    functionResult := interactions.NewStep(interactions.FunctionResultStep{
        Name:   genai.Ptr(functionName),
        CallID: callID,
        Result: interactions.NewFunctionResultStepResultUnion([]interactions.FunctionResultSubcontent{
            interactions.NewFunctionResultSubcontent(interactions.TextContent{Text: resultJSON}),
        }),
    })

    finalRes, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
        Body: operations.NewCreateInteractionRequestBody(interactions.CreateModelInteraction{
            Model:                 interactions.Model("gemini-3.5-flash"),
            PreviousInteractionID: genai.Ptr(interactionID),
            Tools:                 []interactions.Tool{myTool},
            Input:                 interactions.NewInteractionsInput([]interactions.Step{functionResult}),
        }),
    })
    if err != nil {
        log.Fatal(err)
    }
    _ = finalRes
}

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();

ऐप पर जाएं

package main

import (
    "context"
    "log"

    "google.golang.org/genai"
    "google.golang.org/genai/interactions/models/interactions"
    "google.golang.org/genai/interactions/models/operations"
)

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

    // Assumes interactionID, callID, functionName, and base64ImageData from previous step
    interactionID := "interaction-id-123"
    callID := "call-id-123"
    functionName := "get_instrument_image"
    base64ImageData := "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="

    // ✅ Include multimodal content in the function response
    functionResult := interactions.NewStep(interactions.FunctionResultStep{
        Name:   genai.Ptr(functionName),
        CallID: callID,
        Result: interactions.NewFunctionResultStepResultUnion([]interactions.FunctionResultSubcontent{
            interactions.NewFunctionResultSubcontent(interactions.TextContent{
                Text: "instrument.jpg",
            }),
            interactions.NewFunctionResultSubcontent(interactions.ImageContent{
                MimeType: interactions.ImageContentMimeType("image/jpeg").ToPointer(),
                Data:     genai.Ptr(base64ImageData),
            }),
        }),
    })

    finalRes, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
        Body: operations.NewCreateInteractionRequestBody(interactions.CreateModelInteraction{
            Model:                 interactions.Model("gemini-3.5-flash"),
            PreviousInteractionID: genai.Ptr(interactionID),
            Input:                 interactions.NewInteractionsInput([]interactions.Step{functionResult}),
        }),
    })
    if err != nil {
        log.Fatal(err)
    }
    _ = finalRes
}

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

हम अक्सर देखते हैं कि क्लाइंट, फ़ंक्शन के जवाबों के साथ-साथ अतिरिक्त निर्देश भी देते हैं. ऐसा वे बाद के 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();

ऐप पर जाएं

package main

import (
    "context"
    "log"

    "google.golang.org/genai"
    "google.golang.org/genai/interactions/models/interactions"
    "google.golang.org/genai/interactions/models/operations"
)

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

    // Assumes interactionID, callID, functionName, myTool, and resultJSON from previous step
    interactionID := "interaction-id-123"
    callID := "call-id-123"
    functionName := "get_weather"
    myTool := interactions.NewTool(interactions.Function{Name: genai.Ptr(functionName)})
    resultJSON := `{"temperature": "72F"}`

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

    functionResult := interactions.NewStep(interactions.FunctionResultStep{
        Name:   genai.Ptr(functionName),
        CallID: callID,
        Result: interactions.NewFunctionResultStepResultUnion([]interactions.FunctionResultSubcontent{
            interactions.NewFunctionResultSubcontent(interactions.TextContent{Text: resultText}),
        }),
    })

    finalRes, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
        Body: operations.NewCreateInteractionRequestBody(interactions.CreateModelInteraction{
            Model:                 interactions.Model("gemini-3.5-flash"),
            PreviousInteractionID: genai.Ptr(interactionID),
            Tools:                 []interactions.Tool{myTool},
            Input:                 interactions.NewInteractionsInput([]interactions.Step{functionResult}),
        }),
    })
    if err != nil {
        log.Fatal(err)
    }
    _ = finalRes
}

ज़रूरत न होने पर टूल कॉल कम करना

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

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

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

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

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 से मिली जानकारी का इस्तेमाल करना, फ़ाइलें खोजना, कोड एक्ज़ीक्यूट करना, यूआरएल का कॉन्टेक्स्ट, और स्टैंडर्ड फ़ंक्शन कॉलिंग. इनमें एक साथ कई टूल इस्तेमाल करना और कंप्यूटर का इस्तेमाल करना शामिल हैं.

अन्य मॉडल

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