জেমিনি ৩ এবং ২.৫ সিরিজের মডেলগুলো এমন একটি 'চিন্তন প্রক্রিয়া' ব্যবহার করে যা তাদের যুক্তিবোধ এবং বহু-ধাপের পরিকল্পনা করার ক্ষমতাকে উল্লেখযোগ্যভাবে উন্নত করে, ফলে এগুলো কোডিং, উচ্চতর গণিত এবং ডেটা বিশ্লেষণের মতো জটিল কাজের জন্য অত্যন্ত কার্যকর হয়ে ওঠে।
আপনি যখন একটি থিঙ্কিং মডেল ব্যবহার করেন, তখন জেমিনি প্রতিক্রিয়া জানানোর আগে অভ্যন্তরীণভাবে যুক্তি-বিশ্লেষণ করে। ইন্টারঅ্যাকশনস এপিআই এই যুক্তি-বিশ্লেষণকে thought স্টেপস-এর মাধ্যমে প্রকাশ করে; এই নির্দিষ্ট ধাপগুলো steps অ্যারেতে ফাংশন কল, ব্যবহারকারীর ইনপুট বা মডেল আউটপুটের পাশাপাশি কালানুক্রমিকভাবে প্রদর্শিত হয়।
প্রতিটি চিন্তার ধাপে দুটি ক্ষেত্র থাকে:
| মাঠ | প্রয়োজনীয় | বর্ণনা |
|---|---|---|
signature | ✅ হ্যাঁ | মডেলের অভ্যন্তরীণ যুক্তি অবস্থার একটি এনক্রিপ্টেড উপস্থাপনা। এটি সর্বদা উপস্থিত থাকে, এমনকি যখন মডেলটি ন্যূনতম যুক্তি সম্পাদন করে তখনও। |
summary | ❌ না | যুক্তির সারসংক্ষেপকারী বিষয়বস্তুর (টেক্সট এবং/অথবা ছবি) একটি অ্যারে। thinking_summaries কনফিগারেশন, মডেলটি যথেষ্ট যুক্তি বিশ্লেষণ করেছে কিনা, বা বিষয়বস্তুর ধরনের উপর নির্ভর করে এটি খালি থাকতে পারে (উদাহরণস্বরূপ, ছবির ল্যাটেন্টের টেক্সট সারসংক্ষেপ নাও থাকতে পারে)। |
চিন্তার সাথে মিথস্ক্রিয়া
একটি থিংকিং মডেলের সাথে ইন্টারঅ্যাকশন শুরু করা অন্য যেকোনো ইন্টারঅ্যাকশন অনুরোধের মতোই। model ফিল্ডে থিংকিং সাপোর্টসহ মডেলগুলোর মধ্যে একটি নির্দিষ্ট করুন:
পাইথন
from google import genai
client = genai.Client()
interaction = client.interactions.create(
model="gemini-3.8-flash",
input="Explain the concept of Occam's Razor and provide a simple, everyday example."
)
print(interaction.output_text)
জাভাস্ক্রিপ্ট
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
model: "gemini-3.8-flash",
input: "Explain the concept of Occam's Razor and provide a simple, everyday example."
});
console.log(interaction.output_text);
জাভা
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.8-flash"))
.input(
InteractionsInput.of(
"Explain the concept of Occam's Razor and provide a simple, everyday example."))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println(interaction.outputText().orElse(""));
বিশ্রাম
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.8-flash",
"input": "Explain the concept of Occam'\''s Razor and provide a simple example."
}'
চিন্তার সারাংশ
চিন্তার সারাংশ মডেলের অভ্যন্তরীণ যুক্তি প্রক্রিয়া সম্পর্কে অন্তর্দৃষ্টি প্রদান করে। ডিফল্টরূপে, শুধুমাত্র চূড়ান্ত আউটপুট ফেরত দেওয়া হয়। আপনি thinking_summaries এর মাধ্যমে চিন্তার সারাংশ সক্রিয় করতে পারেন:
পাইথন
from google import genai
client = genai.Client()
interaction = client.interactions.create(
model="gemini-3.8-flash",
input="What is the sum of the first 50 prime numbers?",
generation_config={
"thinking_summaries": "auto"
}
)
for step in interaction.steps:
if step.type == "thought":
print("Thought summary:")
if step.summary:
for content_block in step.summary:
if content_block.type == "text":
print(content_block.text)
print()
elif step.type == "model_output":
for content_block in step.content:
if content_block.type == "text":
print("Answer:")
print(content_block.text)
print()
জাভাস্ক্রিপ্ট
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
model: "gemini-3.8-flash",
input: "What is the sum of the first 50 prime numbers?",
generation_config: {
thinking_summaries: "auto"
}
});
for (const step of interaction.steps) {
if (step.type === "thought") {
console.log("Thought summary:");
if (step.summary) {
for (const contentBlock of step.summary) {
if (contentBlock.type === "text") console.log(contentBlock.text);
}
}
} else if (step.type === "model_output") {
for (const contentBlock of step.content) {
if (contentBlock.type === "text") {
console.log("Answer:");
console.log(contentBlock.text);
}
}
}
}
জাভা
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.Content;
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.ModelOutputStep;
import com.google.genai.gaos.models.interactions.Step;
import com.google.genai.gaos.models.interactions.TextContent;
import com.google.genai.gaos.models.interactions.ThinkingSummaries;
import com.google.genai.gaos.models.interactions.ThoughtStep;
import com.google.genai.gaos.models.interactions.ThoughtSummaryContent;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import java.util.Collections;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("gemini-3.8-flash"))
.input(InteractionsInput.of("What is the sum of the first 50 prime numbers?"))
.generationConfig(
GenerationConfig.builder().thinkingSummaries(ThinkingSummaries.AUTO).build())
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
for (Step step : interaction.steps().orElse(Collections.emptyList())) {
if (step instanceof ThoughtStep thoughtStep) {
System.out.println("Thought summary:");
for (ThoughtSummaryContent contentBlock : thoughtStep.summary().orElse(Collections.emptyList())) {
if (contentBlock instanceof TextContent textContent) {
System.out.println(textContent.text().orElse(""));
}
}
System.out.println();
} else if (step instanceof ModelOutputStep outputStep) {
for (Content contentBlock : outputStep.content().orElse(Collections.emptyList())) {
if (contentBlock instanceof TextContent textContent) {
System.out.println("Answer:");
System.out.println(textContent.text().orElse(""));
System.out.println();
}
}
}
}
বিশ্রাম
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.8-flash",
"input": "What is the sum of the first 50 prime numbers?",
"generation_config": {
"thinking_summaries": "auto"
}
}'
এইসব ক্ষেত্রে একটি চিন্তা-ব্লক-এ কোনো সারাংশ ছাড়াই শুধুমাত্র একটি স্বাক্ষর থাকতে পারে:
- সাধারণ অনুরোধ, যেখানে মডেলটি একটি সারাংশ তৈরি করার জন্য যথেষ্ট কারণ খুঁজে পায়নি।
-
thinking_summaries: "none", যেখানে সারাংশ স্পষ্টভাবে নিষ্ক্রিয় করা আছে - কিছু নির্দিষ্ট ধরণের বিষয়বস্তু, যেমন ছবি, এর পাঠ্য সারাংশ নাও থাকতে পারে।
আপনার কোডে সবসময় সেইসব থট ব্লক পরিচালনা করা উচিত যেখানে summary খালি বা অনুপস্থিত থাকে।
চিন্তাভাবনার সাথে স্ট্রিমিং
চিন্তা তৈরির সময় ক্রমবর্ধমান চিন্তার সারাংশ পেতে স্ট্রিমিং ব্যবহার করুন। চিন্তার ব্লকগুলি সার্ভার-সেন্ট ইভেন্টস (SSE) ব্যবহার করে দুটি স্বতন্ত্র ডেল্টা টাইপের মাধ্যমে সরবরাহ করা হয়:
| ডেল্টা টাইপ | ধারণ করে | যখন পাঠানো হয় |
|---|---|---|
thought_summary | পাঠ্য বা ছবির সারাংশ বিষয়বস্তু | ক্রমবর্ধমান সারসংক্ষেপ সহ এক বা একাধিক ডেল্টা |
thought_signature | ক্রিপ্টোগ্রাফিক স্বাক্ষর | step.stop এর আগের শেষ ডেল্টা। |
পাইথন
from google import genai
client = genai.Client()
prompt = """
Alice, Bob, and Carol each live in a different house on the same street: red, green, and blue.
Alice does not live in the red house.
Bob does not live in the green house.
Carol does not live in the red or green house.
Which house does each person live in?
"""
thoughts = ""
answer = ""
stream = client.interactions.create(
model="gemini-3.8-flash",
input=prompt,
generation_config={
"thinking_summaries": "auto"
},
stream=True
)
for event