কোড এক্সিকিউশন হল এমন একটি টুল যা মডেলকে পাইথন কোড তৈরি এবং চালাতে সক্ষম করে। মডেলটি চূড়ান্ত আউটপুটে না আসা পর্যন্ত কোড এক্সিকিউশনের ফলাফল থেকে পুনরাবৃত্তিমূলকভাবে শিখতে পারে।
কোড-ভিত্তিক যুক্তি থেকে উপকৃত এবং টেক্সট আউটপুট তৈরি করে এমন বৈশিষ্ট্য তৈরি করতে আপনি কোড এক্সিকিউশন ব্যবহার করতে পারেন। উদাহরণস্বরূপ, আপনি সমীকরণ সমাধান করতে বা টেক্সট প্রক্রিয়া করতে কোড এক্সিকিউশন ব্যবহার করতে পারেন। আরও বিশেষায়িত কাজ সম্পাদনের জন্য আপনি কোড এক্সিকিউশন পরিবেশে অন্তর্ভুক্ত লাইব্রেরিগুলিও ব্যবহার করতে পারেন।
ঠিক যেমনটি আপনি মডেলটিকে যে সমস্ত সরঞ্জাম সরবরাহ করেন, ঠিক সেই মডেলটিই সিদ্ধান্ত নেয় কখন কোড এক্সিকিউশন ব্যবহার করতে হবে।
কোড এক্সিকিউশন বনাম ফাংশন কলিংয়ের তুলনা
কোড এক্সিকিউশন এবং ফাংশন কলিং একই রকম বৈশিষ্ট্য। সাধারণভাবে, যদি মডেলটি আপনার ব্যবহারের ক্ষেত্রে কাজ করতে পারে তবে আপনার কোড এক্সিকিউশন ব্যবহার করা উচিত। কোড এক্সিকিউশন ব্যবহার করাও সহজ কারণ আপনি কেবল এটি সক্ষম করেন।
কোড এক্সিকিউশন এবং ফাংশন কলিংয়ের মধ্যে কিছু অতিরিক্ত পার্থক্য এখানে দেওয়া হল:
| কোড এক্সিকিউশন | ফাংশন কলিং | 
|---|---|
| যদি আপনি চান যে মডেলটি আপনার জন্য পাইথন কোড লিখুক এবং চালাক এবং ফলাফলটি ফেরত পাঠাক, তাহলে কোড এক্সিকিউশন ব্যবহার করুন। | যদি আপনার ইতিমধ্যেই নিজস্ব ফাংশন থাকে যা আপনি স্থানীয়ভাবে চালাতে চান, তাহলে ফাংশন কলিং ব্যবহার করুন। | 
| কোড এক্সিকিউশন মডেলটিকে একটি স্থির, বিচ্ছিন্ন পরিবেশে API ব্যাকএন্ডে কোড চালাতে দেয়। | ফাংশন কলিং আপনাকে মডেলের অনুরোধকৃত ফাংশনগুলি চালাতে দেয়, আপনার পছন্দের যেকোনো পরিবেশে। | 
| কোড এক্সিকিউশন একটি একক অনুরোধেই সমাধান হয়ে যায়। যদিও আপনি ঐচ্ছিকভাবে চ্যাট ক্ষমতার সাথে কোড এক্সিকিউশন ব্যবহার করতে পারেন, তবে কোনও প্রয়োজনীয়তা নেই। | ফাংশন কলিং এর জন্য প্রতিটি ফাংশন কল থেকে আউটপুট ফেরত পাঠানোর জন্য একটি অতিরিক্ত অনুরোধের প্রয়োজন হয়। সুতরাং, আপনাকে চ্যাট ক্ষমতা ব্যবহার করতে হবে। | 
সমর্থিত মডেল
-  
gemini-2.5-pro -  
gemini-2.5-flash -  
gemini-2.5-flash-lite -  
gemini-2.0-flash-001(এবং এর স্বয়ংক্রিয় আপডেট হওয়া উপনামgemini-2.0-flash) -  
gemini-2.0-flash-live-preview-04-09 
কোড এক্সিকিউশন ব্যবহার করুন
আপনি শুধুমাত্র টেক্সট এবং মাল্টিমোডাল ইনপুট উভয়ের মাধ্যমেই কোড এক্সিকিউশন ব্যবহার করতে পারেন, তবে প্রতিক্রিয়া সর্বদা টেক্সট বা কোড হবে।
শুরু করার আগে
এই পৃষ্ঠায় প্রোভাইডার-নির্দিষ্ট কন্টেন্ট এবং কোড দেখতে আপনার জেমিনি API প্রোভাইডারে ক্লিক করুন।  | 
 যদি আপনি ইতিমধ্যেই না করে থাকেন, তাহলে শুরু করার নির্দেশিকাটি সম্পূর্ণ করুন, যেখানে বর্ণনা করা হয়েছে কিভাবে আপনার Firebase প্রকল্প সেট আপ করবেন, আপনার অ্যাপটি Firebase-এর সাথে সংযুক্ত করবেন, SDK যোগ করবেন, আপনার নির্বাচিত Gemini API প্রদানকারীর জন্য ব্যাকএন্ড পরিষেবা শুরু করবেন এবং একটি GenerativeModel ইনস্ট্যান্স তৈরি করবেন।
কোড এক্সিকিউশন সক্ষম করুন
|  এই নমুনাটি চেষ্টা করার আগে, আপনার প্রকল্প এবং অ্যাপ সেট আপ করতে এই নির্দেশিকার "শুরু করার আগে" বিভাগটি সম্পূর্ণ করুন। সেই বিভাগে, আপনি আপনার নির্বাচিত Gemini API প্রদানকারীর জন্য একটি বোতামে ক্লিক করবেন যাতে আপনি এই পৃষ্ঠায় প্রদানকারী-নির্দিষ্ট সামগ্রী দেখতে পান ।  | 
 যখন আপনি GenerativeModel ইনস্ট্যান্স তৈরি করবেন, তখন CodeExecution একটি টুল হিসেবে প্রদান করুন যা মডেলটি তার প্রতিক্রিয়া তৈরি করতে ব্যবহার করতে পারে। এটি মডেলটিকে Python কোড তৈরি এবং চালানোর অনুমতি দেয়। 
সুইফট
import FirebaseAILogic
// Initialize the Gemini Developer API backend service
let ai = FirebaseAI.firebaseAI(backend: .googleAI())
// Create a `GenerativeModel` instance with a model that supports your use case
let model = ai.generativeModel(
  modelName: "GEMINI_MODEL_NAME",
  // Provide code execution as a tool that the model can use to generate its response.
  tools: [.codeExecution()]
)
let prompt = """
What is the sum of the first 50 prime numbers?
Generate and run code for the calculation, and make sure you get all 50.
"""
let response = try await model.generateContent(prompt)
guard let candidate = response.candidates.first else {
  print("No candidates in response.")
  return
}
for part in candidate.content.parts {
  if let textPart = part as? TextPart {
    print("Text = \(textPart.text)")
  } else if let executableCode = part as? ExecutableCodePart {
    print("Code = \(executableCode.code), Language = \(executableCode.language)")
  } else if let executionResult = part as? CodeExecutionResultPart {
    print("Outcome = \(executionResult.outcome), Result = \(executionResult.output ?? "no output")")
  }
}
Kotlin
// Initialize the Gemini Developer API backend service
// Create a `GenerativeModel` instance with a model that supports your use case
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
    modelName = "GEMINI_MODEL_NAME",
    // Provide code execution as a tool that the model can use to generate its response.
    tools = listOf(Tool.codeExecution())
)
val prompt =  "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50."
val response = model.generateContent(prompt)
response.candidates.first().content.parts.forEach {
    if(it is TextPart) {
        println("Text = ${it.text}")
    }
    if(it is ExecutableCodePart) {
        println("Code = ${it.code}, Language = ${it.language}")
    }
    if(it is CodeExecutionResultPart) {
       println("Outcome = ${it.outcome}, Result = ${it.output}")
    }
}
Java
// Initialize the Gemini Developer API backend service
// Create a `GenerativeModel` instance with a model that supports your use case
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.googleAI())
                .generativeModel("GEMINI_MODEL_NAME",
                        null,
                        null,
                        // Provide code execution as a tool that the model can use to generate its response.
                        List.of(Tool.codeExecution()));
// Use the GenerativeModelFutures Java compatibility layer which offers
// support for ListenableFuture and Publisher APIs
GenerativeModelFutures model = GenerativeModelFutures.from(ai);
String text = "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50.";
Content prompt = new Content.Builder()
    .addText(text)
    .build();
ListenableFuture response = model.generateContent(prompt); 
Futures.addCallback(response, new FutureCallback() {
   @Override
public void onSuccess(GenerateContentResponse response)   {
    // Access the first candidate's content parts
    List parts = response.getCandidates().get(0).getContent().getParts();
    for (Part part : parts) {
        if (part instanceof TextPart) {
            TextPart textPart = (TextPart) part;
            System.out.println("Text = " + textPart.getText());
        } else if (part instanceof ExecutableCodePart) {
            ExecutableCodePart codePart = (ExecutableCodePart) part;
            System.out.println("Code = " + codePart.getCode() + ", Language = " + codePart.getLanguage());
        } else if (part instanceof CodeExecutionResultPart) {
            CodeExecutionResultPart resultPart = (CodeExecutionResultPart) part;
            System.out.println("Outcome = " + resultPart.getOutcome() + ", Result = " + resultPart.getOutput());
        }
    }
}
    @Override
    public void onFailure(Throwable t) {
        t.printStackTrace();
    }
}, executor);
  Web
import { initializeApp } from "firebase/app";
import { getAI, getGenerativeModel, GoogleAIBackend } from "firebase/ai";
// TODO(developer) Replace the following with your app's Firebase configuration
// See: https://firebase.google.com/docs/web/learn-more#config-object
const firebaseConfig = {
  // ...
};
// Initialize FirebaseApp
const firebaseApp = initializeApp(firebaseConfig);
// Initialize the Gemini Developer API backend service
const ai = getAI(firebaseApp, { backend: new GoogleAIBackend() });
// Create a `GenerativeModel` instance with a model that supports your use case
const model = getGenerativeModel(
  ai,
  {
    model: "GEMINI_MODEL_NAME",
    // Provide code execution as a tool that the model can use to generate its response.
    tools: [{ codeExecution: {} }]
  }
);
const prompt =  "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50."
const result = await model.generateContent(prompt);
const response = await result.response;
const parts = response.candidates?.[0].content.parts;
if (parts) {
  parts.forEach((part) => {
    if (part.text) {
        console.log(`Text: ${part.text}`);
    } else if (part.executableCode) {
      console.log(
        `Code: ${part.executableCode.code}, Language: ${part.executableCode.language}`
      );
    } else if (part.codeExecutionResult) {
      console.log(
        `Outcome: ${part.codeExecutionResult.outcome}, Result: ${part.codeExecutionResult.output}`
      );
    }
  });
}
Dart
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_ai/firebase_ai.dart';
import 'firebase_options.dart';
// Initialize FirebaseApp
await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);
// Initialize the Gemini Developer API backend service
// Create a `GenerativeModel` instance with a model that supports your use case
final model = FirebaseAI.googleAI().generativeModel(
  model: 'GEMINI_MODEL_NAME',
  // Provide code execution as a tool that the model can use to generate its response.
  tools: [
    Tool.codeExecution(),
  ],
);
const prompt = 'What is the sum of the first 50 prime numbers? '
    'Generate and run code for the calculation, and make sure you get all 50.';
final response = await model.generateContent([Content.text(prompt)]);
final buffer = StringBuffer();
    for (final part in response.candidates.first.content.parts) {
      if (part is TextPart) {
        buffer.writeln(part.text);
      } else if (part is ExecutableCodePart) {
        buffer.writeln('Executable Code:');
        buffer.writeln('Language: ${part.language}');
        buffer.writeln('Code:');
        buffer.writeln(part.code);
      } else if (part is CodeExecutionResultPart) {
        buffer.writeln('Code Execution Result:');
        buffer.writeln('Outcome: ${part.outcome}');
        buffer.writeln('Output:');
        buffer.writeln(part.output);
      }
    }
ঐক্য
using Firebase;
using Firebase.AI;
// Initialize the Gemini Developer API backend service
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI());
// Create a `GenerativeModel` instance with a model that supports your use case
var model = ai.GetGenerativeModel(
  modelName: "GEMINI_MODEL_NAME",
  // Provide code execution as a tool that the model can use to generate its response.
  tools: new Tool[] { new Tool(new CodeExecution()) }
);
var prompt = "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50.";
var response = await model.GenerateContentAsync(prompt);
foreach (var part in response.Candidates.First().Content.Parts) {
  if (part is ModelContent.TextPart tp) {
    UnityEngine.Debug.Log($"Text = {tp.Text}");
  } else if (part is ModelContent.ExecutableCodePart esp) {
    UnityEngine.Debug.Log($"Code = {esp.Code}, Language = {esp.Language}");
  } else if (part is ModelContent.CodeExecutionResultPart cerp) {
    UnityEngine.Debug.Log($"Outcome = {cerp.Outcome}, Output = {cerp.Output}");
  }
}
মডেল কীভাবে নির্বাচন করবেন তা শিখুনআপনার ব্যবহারের ক্ষেত্রে এবং অ্যাপের জন্য উপযুক্ত।
আউটপুটটি দেখতে নিচের মতো হতে পারে, যা পঠনযোগ্যতার জন্য ফর্ম্যাট করা হয়েছে:
Okay, I need to calculate the sum of the first 50 prime numbers. Here's how I'll
approach this:
1.  **Generate Prime Numbers:** I'll use an iterative method to find prime
    numbers. I'll start with 2 and check if each subsequent number is divisible
    by any number between 2 and its square root. If not, it's a prime.
2.  **Store Primes:** I'll store the prime numbers in a list until I have 50 of
    them.
3.  **Calculate the Sum:**  Finally, I'll sum the prime numbers in the list.
Here's the Python code to do this:
def is_prime(n):
  """Efficiently checks if a number is prime."""
  if n <= 1:
    return False
  if n <= 3:
    return True
  if n % 2 == 0 or n % 3 == 0:
    return False
  i = 5
  while i * i <= n:
    if n % i == 0 or n % (i + 2) == 0:
      return False
    i += 6
  return True
primes = []
num = 2
while len(primes) < 50:
  if is_prime(num):
    primes.append(num)
  num += 1
sum_of_primes = sum(primes)
print(f'{primes=}')
print(f'{sum_of_primes=}')
primes=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229]
sum_of_primes=5117
The sum of the first 50 prime numbers is 5117.
এই আউটপুটটি বেশ কয়েকটি কন্টেন্ট অংশকে একত্রিত করে যা কোড এক্সিকিউশন ব্যবহার করার সময় মডেলটি ফেরত দেয়:
-  
text: মডেল দ্বারা তৈরি ইনলাইন টেক্সট -  
executableCode: যে মডেলটি কার্যকর করার জন্য তৈরি করা হয়েছে তার দ্বারা তৈরি কোড -  
codeExecutionResult: কার্যকর করা কোডের ফলাফল 
এই অংশগুলির নামকরণের নিয়মগুলি প্রোগ্রামিং ভাষা অনুসারে পরিবর্তিত হয়।
চ্যাটে কোড এক্সিকিউশন ব্যবহার করুন
আপনি চ্যাটের অংশ হিসেবে কোড এক্সিকিউশনও ব্যবহার করতে পারেন:
সুইফট
import FirebaseAILogic
// Initialize the Gemini Developer API backend service
let ai = FirebaseAI.firebaseAI(backend: .googleAI())
// Create a `GenerativeModel` instance with a model that supports your use case
let model = ai.generativeModel(
  modelName: "GEMINI_MODEL_NAME",
  // Provide code execution as a tool that the model can use to generate its response.
  tools: [.codeExecution()]
)
let prompt = """
What is the sum of the first 50 prime numbers?
Generate and run code for the calculation, and make sure you get all 50.
"""
let chat = model.startChat()
let response = try await chat.sendMessage(prompt)
guard let candidate = response.candidates.first else {
  print("No candidates in response.")
  return
}
for part in candidate.content.parts {
  if let textPart = part as? TextPart {
    print("Text = \(textPart.text)")
  } else if let executableCode = part as? ExecutableCodePart {
    print("Code = \(executableCode.code), Language = \(executableCode.language)")
  } else if let executionResult = part as? CodeExecutionResultPart {
    print("Outcome = \(executionResult.outcome), Result = \(executionResult.output ?? "no output")")
  }
}
Kotlin
// Initialize the Gemini Developer API backend service
// Create a `GenerativeModel` instance with a model that supports your use case
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
    modelName = "GEMINI_MODEL_NAME",
    // Provide code execution as a tool that the model can use to generate its response.
    tools = listOf(Tool.codeExecution())
)
val prompt =  "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50."
val chat = model.startChat()
val response = chat.sendMessage(prompt)
response.candidates.first().content.parts.forEach {
    if(it is TextPart) {
        println("Text = ${it.text}")
    }
    if(it is ExecutableCodePart) {
        println("Code = ${it.code}, Language = ${it.language}")
    }
    if(it is CodeExecutionResultPart) {
       println("Outcome = ${it.outcome}, Result = ${it.output}")
    }
}
Java
// Initialize the Gemini Developer API backend service
// Create a `GenerativeModel` instance with a model that supports your use case
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.googleAI())
                .generativeModel("GEMINI_MODEL_NAME",
                        null,
                        null,
                        // Provide code execution as a tool that the model can use to generate its response.
                        List.of(Tool.codeExecution()));
// Use the GenerativeModelFutures Java compatibility layer which offers
// support for ListenableFuture and Publisher APIs
GenerativeModelFutures model = GenerativeModelFutures.from(ai);
String text = "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50.";
Content prompt = new Content.Builder()
    .addText(text)
    .build();
ChatFutures chat = model.startChat();
ListenableFuture response = chat.sendMessage(prompt); 
Futures.addCallback(response, new FutureCallback() {
   @Override
public void onSuccess(GenerateContentResponse response)   {
    // Access the first candidate's content parts
    List parts = response.getCandidates().get(0).getContent().getParts();
    for (Part part : parts) {
        if (part instanceof TextPart) {
            TextPart textPart = (TextPart) part;
            System.out.println("Text = " + textPart.getText());
        } else if (part instanceof ExecutableCodePart) {
            ExecutableCodePart codePart = (ExecutableCodePart) part;
            System.out.println("Code = " + codePart.getCode() + ", Language = " + codePart.getLanguage());
        } else if (part instanceof CodeExecutionResultPart) {
            CodeExecutionResultPart resultPart = (CodeExecutionResultPart) part;
            System.out.println("Outcome = " + resultPart.getOutcome() + ", Result = " + resultPart.getOutput());
        }
    }
}
    @Override
    public void onFailure(Throwable t) {
        t.printStackTrace();
    }
}, executor);
  Web
import { initializeApp } from "firebase/app";
import { getAI, getGenerativeModel, GoogleAIBackend } from "firebase/ai";
// TODO(developer) Replace the following with your app's Firebase configuration
// See: https://firebase.google.com/docs/web/learn-more#config-object
const firebaseConfig = {
  // ...
};
// Initialize FirebaseApp
const firebaseApp = initializeApp(firebaseConfig);
// Initialize the Gemini Developer API backend service
const ai = getAI(firebaseApp, { backend: new GoogleAIBackend() });
// Create a `GenerativeModel` instance with a model that supports your use case
const model = getGenerativeModel(
  ai,
  {
    model: "GEMINI_MODEL_NAME",
    // Provide code execution as a tool that the model can use to generate its response.
    tools: [{ codeExecution: {} }]
  }
);
const prompt =  "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50."
const chat = model.startChat()
const result = await chat.sendMessage(prompt);
const parts = result.response.candidates?.[0].content.parts;
if (parts) {
  parts.forEach((part) => {
    if (part.text) {
        console.log(`Text: ${part.text}`);
    } else if (part.executableCode) {
      console.log(
        `Code: ${part.executableCode.code}, Language: ${part.executableCode.language}`
      );
    } else if (part.codeExecutionResult) {
      console.log(
        `Outcome: ${part.codeExecutionResult.outcome}, Result: ${part.codeExecutionResult.output}`
      );
    }
  });
}
Dart
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_ai/firebase_ai.dart';
import 'firebase_options.dart';
// Initialize FirebaseApp
await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);
// Initialize the Gemini Developer API backend service
// Create a `GenerativeModel` instance with a model that supports your use case
final model = FirebaseAI.googleAI().generativeModel(
  model: 'GEMINI_MODEL_NAME',
  // Provide code execution as a tool that the model can use to generate its response.
  tools: [
    Tool.codeExecution(),
  ],
);
final codeExecutionChat = await model.startChat();
const prompt = 'What is the sum of the first 50 prime numbers? '
    'Generate and run code for the calculation, and make sure you get all 50.';
final response = await codeExecutionChat.sendMessage(Content.text(prompt));
final buffer = StringBuffer();
    for (final part in response.candidates.first.content.parts) {
      if (part is TextPart) {
        buffer.writeln(part.text);
      } else if (part is ExecutableCodePart) {
        buffer.writeln('Executable Code:');
        buffer.writeln('Language: ${part.language}');
        buffer.writeln('Code:');
        buffer.writeln(part.code);
      } else if (part is CodeExecutionResultPart) {
        buffer.writeln('Code Execution Result:');
        buffer.writeln('Outcome: ${part.outcome}');
        buffer.writeln('Output:');
        buffer.writeln(part.output);
      }
    }
ঐক্য
using Firebase;
using Firebase.AI;
// Initialize the Gemini Developer API backend service
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI());
// Create a `GenerativeModel` instance with a model that supports your use case
var model = ai.GetGenerativeModel(
  modelName: "GEMINI_MODEL_NAME",
  // Provide code execution as a tool that the model can use to generate its response.
  tools: new Tool[] { new Tool(new CodeExecution()) }
);
var prompt = "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50.";
var chat = model.StartChat();
var response = await chat.SendMessageAsync(prompt);
foreach (var part in response.Candidates.First().Content.Parts) {
  if (part is ModelContent.TextPart tp) {
    UnityEngine.Debug.Log($"Text = {tp.Text}");
  } else if (part is ModelContent.ExecutableCodePart esp) {
    UnityEngine.Debug.Log($"Code = {esp.Code}, Language = {esp.Language}");
  } else if (part is ModelContent.CodeExecutionResultPart cerp) {
    UnityEngine.Debug.Log($"Outcome = {cerp.Outcome}, Output = {cerp.Output}");
  }
}
মডেল কীভাবে নির্বাচন করবেন তা শিখুনআপনার ব্যবহারের ক্ষেত্রে এবং অ্যাপের জন্য উপযুক্ত।
মূল্য নির্ধারণ
কোড এক্সিকিউশন সক্ষম করার জন্য এবং মডেলের জন্য এটি একটি টুল হিসেবে প্রদান করার জন্য কোনও অতিরিক্ত চার্জ নেই। যদি মডেলটি কোড এক্সিকিউশন ব্যবহার করার সিদ্ধান্ত নেয়, তাহলে আপনার ব্যবহৃত জেমিনি মডেলের উপর ভিত্তি করে ইনপুট এবং আউটপুট টোকেনের বর্তমান হারে আপনাকে বিল করা হবে।
নিম্নলিখিত চিত্রটি কোড কার্যকর করার জন্য বিলিং মডেলটি দেখায়:

কোনও মডেল কোড এক্সিকিউশন ব্যবহার করলে টোকেনগুলি কীভাবে বিল করা হয় তার একটি সারসংক্ষেপ এখানে দেওয়া হল:
মূল প্রম্পটটি একবার বিল করা হয়। এর টোকেনগুলিকে ইন্টারমিডিয়েট টোকেন হিসাবে লেবেল করা হয়, যা ইনপুট টোকেন হিসাবে বিল করা হয়।
জেনারেট করা কোড এবং এক্সিকিউট করা কোডের ফলাফলের বিল এইভাবে করা হয়:
কোড এক্সিকিউশনের সময় যখন এগুলি ব্যবহার করা হয় - তখন এগুলিকে মধ্যবর্তী টোকেন হিসাবে লেবেল করা হয় যা ইনপুট টোকেন হিসাবে বিল করা হয়।
যখন এগুলিকে চূড়ান্ত প্রতিক্রিয়ার অংশ হিসেবে অন্তর্ভুক্ত করা হয় - তখন তাদের আউটপুট টোকেন হিসেবে বিল করা হয়।
চূড়ান্ত প্রতিক্রিয়ার চূড়ান্ত সারাংশ আউটপুট টোকেন হিসাবে বিল করা হয়।
জেমিনি এপিআইতে এপিআই রেসপন্সে একটি মধ্যবর্তী টোকেন গণনা অন্তর্ভুক্ত থাকে, যাতে আপনি জানেন কেন আপনার প্রাথমিক প্রম্পটের বাইরে ইনপুট টোকেনের জন্য চার্জ করা হচ্ছে।
মনে রাখবেন যে জেনারেট করা কোডে টেক্সট এবং মাল্টিমোডাল আউটপুট উভয়ই অন্তর্ভুক্ত থাকতে পারে, যেমন ছবি।
সীমাবদ্ধতা এবং সর্বোত্তম অনুশীলন
মডেলটি কেবল পাইথন কোড তৈরি এবং কার্যকর করতে পারে। এটি মিডিয়া ফাইলের মতো অন্যান্য আর্টিফ্যাক্ট ফেরত দিতে পারে না।
কোড এক্সিকিউশন টাইমিং আউট হওয়ার আগে সর্বোচ্চ 30 সেকেন্ড চলতে পারে।
কিছু ক্ষেত্রে, কোড এক্সিকিউশন সক্ষম করলে মডেল আউটপুটের অন্যান্য ক্ষেত্রে (উদাহরণস্বরূপ, একটি গল্প লেখা) রিগ্রেশন হতে পারে।
কোড এক্সিকিউশন টুল ইনপুট/আউটপুট হিসেবে ফাইল URI সমর্থন করে না। তবে, কোড এক্সিকিউশন টুল ইনলাইনড বাইট হিসেবে ফাইল ইনপুট এবং গ্রাফ আউটপুট সমর্থন করে। এই ইনপুট এবং আউটপুট ক্ষমতা ব্যবহার করে, আপনি CSV এবং টেক্সট ফাইল আপলোড করতে পারেন, ফাইল সম্পর্কে প্রশ্ন জিজ্ঞাসা করতে পারেন এবং কোড এক্সিকিউশন ফলাফলের অংশ হিসেবে Matplotlib গ্রাফ তৈরি করতে পারেন। ইনলাইনড বাইটগুলির জন্য সমর্থিত মাইম প্রকারগুলি হল
.cpp,.csv,.java,.jpeg,.js,.png,.py,.ts, এবং.xml.
সমর্থিত লাইব্রেরি
কোড এক্সিকিউশন এনভায়রনমেন্টে নিম্নলিখিত লাইব্রেরিগুলি অন্তর্ভুক্ত থাকে। আপনি নিজের লাইব্রেরি ইনস্টল করতে পারবেন না।
- অ্যাটর্স
 - দাবা
 - রূপরেখা
 - এফপিডিএফ
 - জিওপ্যান্ডাস
 - ইমেজিও
 - জিনজা২
 - জবলিব
 - জসনস্কিমা
 - jsonschema-স্পেসিফিকেশন
 - এলএক্সএমএল
 - ম্যাটপ্লটলিব
 - এমপিম্যাথ
 - নম্পি
 - opencv-পাইথন
 - ওপেনপিএক্সএল
 - প্যাকেজিং
 - পান্ডা
 - বালিশ
 - প্রোটোবাফ
 - পাইলেটেক্স
 - পাইপার্সিং
 - PyPDF2 সম্পর্কে
 - পাইথন-ডেটইউটিল
 - পাইথন-ডকএক্স
 - পাইথন-pptx
 - রিপোর্টল্যাব
 - বিজ্ঞান-শিখুন
 - স্কিপী
 - সমুদ্র-প্রেমী
 - ছয়
 - স্ট্রিপর্টফ
 - সিম্পি
 - সারণীবদ্ধ করা
 - টেনসরফ্লো
 - টুলজ
 - এক্সএলআরডি
 
- আলটেয়ার
 - দাবা
 - সিভি২
 - ম্যাটপ্লটলিব
 - এমপম্যাথ
 - NumPy সম্পর্কে
 - পান্ডা
 - পিডিএফমাইনার
 - রিপোর্টল্যাব
 - সিবর্ন
 - স্ক্লার্ন
 - পরিসংখ্যান মডেল
 - স্ট্রিপ্ট্ফ
 - SymPy সম্পর্কে
 - সারণীবদ্ধকরণ
 
Firebase AI Logic এর সাথে আপনার অভিজ্ঞতা সম্পর্কে মতামত দিন।