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 में किए गए Baseline बदलावों और पैरामीटर के लिए दिए गए सुझावों की जानकारी शामिल है.
मॉडल अवलोकन
| मॉडल | मॉडल आईडी | स्थिति |
|---|---|---|
| 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)
}
}
आराम का समय
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को कोड और एजेंटिक टास्क के लिए काफ़ी बेहतर बनाया गया है. इन टास्क को पूरा करने में कम समय लगता है और कम चरणों की ज़रूरत होती है. साथ ही, यह कम लागत में बेहतर क्वालिटी देता है.
सही Flash मॉडल चुनना
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 के प्रीव्यू में 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)
}
}
आराम का समय
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` में बातचीत का पूरा,
बिना बदलाव वाला इतिहास (थॉट सिग्नेचर शामिल हैं
) पास करें
contents. एसडीके, इसे अपने-आप मैनेज करते हैं.
Gemini 3.x में पैरामीटर के अपडेट और सबसे सही तरीके
ये Gemini 3.x के सभी मॉडल पर लागू होते हैं. इनमें Gemini 3.5 Flash भी शामिल है.
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 स्ट्रिंग एनम का इस्तेमाल करें.
# ⚠️ 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
}
आराम का समय
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": "..."}]
}]
}'
मल्टीमोडल फ़ंक्शन के जवाब
हम अक्सर देखते हैं कि क्लाइंट, फ़ंक्शन के जवाब के बाहर इमेज उपलब्ध कराते हैं. इससे मॉडल का व्यवहार उम्मीद के मुताबिक नहीं होता. जैसे, थॉट लीकेज और आउटपुट की क्वालिटी कम हो सकती है. इसके बजाय, मल्टीमोडल फ़ंक्शन के जवाबों के एपीआई दस्तावेज़ों में दिए गए सुझाव का पालन करें. साथ ही, मॉडल को भेजे जाने वाले फ़ंक्शन के जवाब के हिस्सों में मल्टीमोडल कॉन्टेंट शामिल करें. मॉडल, ज़्यादा जानकारी वाला जवाब देने के लिए, अगले टर्न में इस मल्टीमोडल कॉन्टेंट को प्रोसेस कर सकता है.
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
}
टूल कॉल की संख्या कम करना
अगर आपको टूल कॉल का ज़्यादा इस्तेमाल करने की समस्या आ रही है, तो इन दो तकनीकों की मदद से इसे कम किया जा सकता है:
थिंकिंग का लेवल कम करके शुरू करें (
medium,low, याminimal): थिंकिंग के ऊंचे लेवल पर, मॉडल को एक्सप्लोर करने और पुष्टि करने के लिए ज़्यादा टूल इस्तेमाल करने के लिए बढ़ावा मिलता है. इसलिए, लेवल कम करने से टूल कॉल की संख्या कम हो सकती है.सिस्टम निर्देश जोड़ें: अगर थिंकिंग का लेवल अडजस्ट करने के बाद भी, टूल का ज़्यादा इस्तेमाल जारी रहता है, तो ऐसा प्रॉम्प्ट इस्तेमाल करें जिससे टूल के इस्तेमाल पर पाबंदी लगाई जा सके. उदाहरण के लिए:
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 मोड को इन-बिल्ट सुविधाओं (Search, यूआरएल कॉन्टेक्स्ट, कोड एक्ज़ीक्यूशन, फ़ंक्शन कॉलिंग) के साथ मिलाएं.
- मल्टीमोडल फ़ंक्शन के जवाब: फ़ंक्शन कॉल के नतीजों में इमेज, ऑडियो, और अन्य मीडिया रिटर्न करें.
- इमेज के साथ कोड एक्ज़ीक्यूशन: इमेज को प्रोसेस करने और जनरेट करने वाले कोड को एक्ज़ीक्यूट करें.
- टूल का एक साथ इस्तेमाल: एक ही अनुरोध में, इन-बिल्ट टूल और कस्टम फ़ंक्शन कॉलिंग का इस्तेमाल करें.
- मीडिया रिज़ॉल्यूशन:
इमेज, वीडियो, और पीडीएफ़ इनपुट के लिए टोकन के आवंटन पर फ़ाइन-ग्रेन कंट्रोल.
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 का इस्तेमाल जारी रखें. इसमें थिंकिंग की सुविधा बंद होनी चाहिए.
अक्सर पूछे जाने वाले सवाल
Gemini 3.5 Flash के लिए, नॉलेज कटऑफ़ क्या है? Gemini 3.5 Flash के लिए, नॉलेज कटऑफ़ जनवरी 2025 है. हाल ही की जानकारी पाने के लिए, Search Grounding टूल का इस्तेमाल करें.
कॉन्टेक्स्ट विंडो की सीमाएं क्या हैं? Gemini 3.5 Flash, 10 लाख टोकन वाली इनपुट कॉन्टेक्स्ट विंडो और ज़्यादा से ज़्यादा 65 हज़ार आउटपुट टोकन के साथ काम करता है.
क्या मेरा पुराना
thinking_budgetकोड अब भी काम करेगा? हां,thinking_budgetअब भी काम करता है, ताकि पुराने सिस्टम के साथ काम करने की सुविधा बनी रहे. हालांकि, ज़्यादा अनुमान के मुताबिक परफ़ॉर्मेंस पाने के लिए, हमारा सुझाव है कि आपthinking_levelपर माइग्रेट करें. एक ही अनुरोध में, दोनों का इस्तेमाल न करें.क्या Gemini 3.5 Flash, Batch API के साथ काम करता है? हां. ज़्यादा जानकारी के लिए, Batch API की गाइड देखें.
क्या कॉन्टेक्स्ट कैशिंग की सुविधा उपलब्ध है? हां, कॉन्टेक्स्ट कैशिंग की सुविधा उपलब्ध है.
कौनसे टूल काम करते हैं? Gemini 3.5 Flash, Google Search, Google Maps के साथ ग्राउंडिंग, फ़ाइल सर्च, कोड एक्ज़ीक्यूशन, यूआरएल कॉन्टेक्स्ट, और स्टैंडर्ड फ़ंक्शन कॉलिंग के साथ काम करता है. इसमें टूल का एक साथ इस्तेमाल और कंप्यूटर इस्तेमाल करने की सुविधा भी शामिल है.
अन्य मॉडल
आगे क्या करना है
- प्रॉम्प्ट डिज़ाइन की रणनीतियों के बारे में ज़्यादा जानने के लिए, प्रॉम्प्ट इंजीनियरिंग की गाइड देखें.
- Gemini 3 कुकबुक का इस्तेमाल शुरू करें
- Gemini API के ऑप्टिमाइज़ेशन और इन्फ़रेंस के बारे में जानें