Firebase AI Logic এবং এর ক্লায়েন্ট SDK-গুলো পূর্বে " Vertex AI in Firebase " নামে পরিচিত ছিল। আমাদের সম্প্রসারিত পরিষেবা এবং বৈশিষ্ট্যগুলোকে আরও ভালোভাবে তুলে ধরার জন্য (উদাহরণস্বরূপ, আমরা এখন Gemini Developer API সমর্থন করি!), আমরা আমাদের পরিষেবাগুলোর নাম পরিবর্তন করে Firebase AI Logic নামে নতুন করে প্যাকেজ করেছি ।
আপনার মোবাইল বা ওয়েব অ্যাপ থেকে সরাসরি এবং নিরাপদে গুগলের জেনারেটিভ এআই মডেলগুলো অ্যাক্সেস করার জন্য, আপনি এখন একটি ' জেমিনি এপিআই ' প্রোভাইডার বেছে নিতে পারেন — হয় বহু পুরোনো ভার্টেক্স এআই জেমিনি এপিআই অথবা নতুন জেমিনি ডেভেলপার এপিআই । এর মানে হলো, এখন আপনার কাছে জেমিনি ডেভেলপার এপিআই ব্যবহার করার সুযোগ রয়েছে, যা যুক্তিসঙ্গত রেট লিমিট এবং কোটা সহ একটি বিনামূল্যের স্তর প্রদান করে।
Overview of steps to migrate to the Firebase AI Logic SDKs
Step 1 : Choose the best " Gemini API " provider for your app and use cases.
Step 2 : Set up your Firebase project so that you can use the Gemini Developer API .
Only applicable if you're swapping to use the Gemini Developer API instead of the Vertex AI Gemini API .Step 3 : Update the library used in your app.
Step 4 : Update the initialization in your app.
Step 5 : Update your code depending on the features that you use.
ধাপ ১ : আপনার অ্যাপের জন্য সেরা 'জেমিনি এপিআই' প্রদানকারী বেছে নিন।
With this migration, you have a choice in " Gemini API " provider:
পুরানো " Vertex AI in Firebase " SDK-গুলো শুধুমাত্র Vertex AI Gemini API ব্যবহার করতে পারত।
নতুন Firebase AI Logic SDK-গুলো আপনাকে আপনার মোবাইল বা ওয়েব অ্যাপ থেকে সরাসরি কোন " Gemini API " প্রোভাইডারকে কল করতে চান তা বেছে নেওয়ার সুযোগ দেয় – হয় Gemini Developer API অথবা Vertex AI Gemini API ।
দুটি জেমিনি এপিআই প্রোভাইডার ব্যবহারের মধ্যেকার পার্থক্যগুলো পর্যালোচনা করুন, বিশেষ করে সমর্থিত ফিচার, মূল্য এবং রেট লিমিটের দিক থেকে। উদাহরণস্বরূপ, জেমিনি ডেভেলপার এপিআই Cloud Storage ইউআরএল ব্যবহার করে ফাইল সরবরাহ করা সমর্থন করে না, কিন্তু আপনি যদি এর বিনামূল্যের স্তর এবং যুক্তিসঙ্গত কোটার সুবিধা নিতে চান, তবে এটি একটি ভালো বিকল্প হতে পারে।
If you want to keep using the Vertex AI Gemini API :
Skip the next step and jump straight to updating the library in your app , and then the rest of this guide.If you want to swap to the Gemini Developer API :
Continue to the next step to set up your Firebase project to use that API , and then the rest of this guide.
Step 2 : Set up your Firebase project so that you can use the Gemini Developer API
এই ধাপটি শুধুমাত্র তখনই প্রয়োজন হবে যদি আপনি Firebase AI Logic ক্লায়েন্ট SDK-গুলোর সাথে Gemini Developer API ব্যবহার শুরু করতে চান। তবে, আপনি যদি Vertex AI Gemini API-ই ব্যবহার করতে চান, তাহলে পরবর্তী ধাপে চলে যান।
মনে রাখবেন যে, আপনার প্রোজেক্টে একই সময়ে উভয় 'Gemini API' প্রোভাইডার সক্রিয় রাখলে কোনো সমস্যা নেই।
In the Firebase console, go to AI Services > AI Logic .
Go to the Settings tab, and select Gemini Developer API .
Enable the Gemini Developer API .
The console will make sure the required APIs are enabled and generate a Gemini API key in your Firebase project.
Do not add this Gemini API key into your app's codebase. Learn more.Continue in this migration guide to update the library and initialization in your app.
Step 3 : Update the library used in your app
Update your app's codebase to use the Firebase AI Logic library.
সুইফট
Xcode-এ, আপনার অ্যাপ প্রজেক্টটি খোলা রেখে, নিম্নলিখিত বিকল্পগুলির মধ্যে যেকোনো একটি ব্যবহার করে আপনার Firebase প্যাকেজটি v11.13.0 বা তার পরবর্তী সংস্করণে আপডেট করুন:
Option 1 : Update all packages: Navigate to File > Packages > Update to Latest Package Versions .
বিকল্প ২ : পৃথকভাবে ফায়ারবেস আপডেট করুন: 'প্যাকেজ ডিপেন্ডেন্সি' নামক বিভাগে ফায়ারবেস প্যাকেজটিতে যান। ফায়ারবেস প্যাকেজটির উপর রাইট-ক্লিক করুন এবং তারপর 'আপডেট প্যাকেজ' নির্বাচন করুন।
Make sure that the Firebase package now shows v11.13.0 or later. If it doesn't, verify that your specified Package Requirements allow updating to v11.13.0 or later.
Select your app's target in the Project Editor, and then navigate to the Frameworks, Libraries, and Embedded Content section.
Add the new library: Select the + button, and then add FirebaseAI from the Firebase package.
After you've finished migrating your app (see the remaining sections in this guide), make sure to remove the old library:
Select FirebaseVertexAI , and then press the — button.
Kotlin
আপনার মডিউল (অ্যাপ-লেভেল) গ্রেডল ফাইলে (সাধারণত
<project>/<app-module>/build.gradle.ktsঅথবা<project>/<app-module>/build.gradle), পুরোনো ডিপেন্ডেন্সিগুলো (প্রযোজ্য ক্ষেত্রে) নিম্নলিখিতগুলো দিয়ে প্রতিস্থাপন করুন।Note that it might be easier to migrate your app's codebase (see the remaining sections in this guide) before deleting the old dependency.
// BEFORE dependencies { implementation(platform("com.google.firebase:firebase-bom:33.x.y"))
implementation("com.google.firebase:firebase-vertexai")// OR if not using the BoMimplementation("com.google.firebase:firebase-vertexai:16.x.y")} // AFTER dependencies { // Import the BoM for the Firebase platform implementation(platform("com.google.firebase:firebase-bom:34.15.0")) // Add the dependency for the Firebase AI Logic library // When using the BoM, you don't specify versions in Firebase library dependencies implementation("com.google.firebase:firebase-ai") }Sync your Android project with Gradle files.
Note that if you choose to not use the Firebase Android BoM , then just add the dependency for the firebase-ai library and accept the latest version that's suggested by Android Studio.
Java
আপনার মডিউল (অ্যাপ-লেভেল) গ্রেডল ফাইলে (সাধারণত
<project>/<app-module>/build.gradle.ktsঅথবা<project>/<app-module>/build.gradle), পুরোনো ডিপেন্ডেন্সিগুলো (প্রযোজ্য ক্ষেত্রে) নিম্নলিখিতগুলো দিয়ে প্রতিস্থাপন করুন।Note that it might be easier to migrate your app's codebase (see the remaining sections in this guide) before deleting the old dependency.
// BEFORE dependencies { implementation(platform("com.google.firebase:firebase-bom:33.x.y"))
implementation("com.google.firebase:firebase-vertexai")// OR if not using the BoMimplementation("com.google.firebase:firebase-vertexai:16.x.y")} // AFTER dependencies { // Import the BoM for the Firebase platform implementation(platform("com.google.firebase:firebase-bom:34.15.0")) // Add the dependency for the Firebase AI Logic library // When using the BoM, you don't specify versions in Firebase library dependencies implementation("com.google.firebase:firebase-ai") }Sync your Android project with Gradle files.
মনে রাখবেন, যদি আপনি Firebase Android BoM ব্যবহার না করার সিদ্ধান্ত নেন, তাহলে শুধু firebase-ai লাইব্রেরির ডিপেন্ডেন্সিটি যোগ করুন এবং Android Studio দ্বারা প্রস্তাবিত সর্বশেষ সংস্করণটি গ্রহণ করুন।
Web
Get the latest version of the Firebase JS SDK for Web using npm:
npm i firebase@latest
অথবা
yarn add firebase@latest
আপনি যেখানেই লাইব্রেরিটি ইম্পোর্ট করেছেন, সেখানে
firebase/aiব্যবহার করার জন্য আপনার ইম্পোর্ট স্টেটমেন্টগুলো আপডেট করুন।Note that it might be easier to migrate your app's codebase (see the remaining sections in this guide) before deleting the old imports.
// BEFORE import { initializeApp } from "firebase/app";
import { getVertexAI, getGenerativeModel } from "firebase/vertexai";// AFTER import { initializeApp } from "firebase/app"; import { getAI, getGenerativeModel } from "firebase/ai";
Dart
আপনার ফ্লাটার প্রজেক্ট ডিরেক্টরি থেকে নিম্নলিখিত কমান্ডটি চালিয়ে আপনার
pubspec.yamlফাইলেfirebase_aiপ্যাকেজটি ব্যবহার করার জন্য ফাইলটি আপডেট করুন:flutter pub add firebase_ai
Rebuild your Flutter project:
flutter run
আপনার অ্যাপ মাইগ্রেট করা শেষ হলে (এই গাইডের বাকি অংশগুলো দেখুন), পুরোনো প্যাকেজটি ডিলিট করে দিতে ভুলবেন না:
flutter pub remove firebase_vertexai
ঐক্য
" ফায়ারবেসে ভার্টেক্স এআই " থেকে ইউনিটির জন্য সমর্থন পাওয়া যাচ্ছিল না।
ইউনিটির জন্য ফায়ারবেস এআই লজিক এসডিকে (Firebase AI Logic SDK for Unity) দিয়ে কীভাবে কাজ শুরু করবেন তা জেনে নিন।
Step 4 : Update the initialization in your app
এই পৃষ্ঠায় প্রদানকারী-নির্দিষ্ট বিষয়বস্তু এবং কোড দেখতে আপনার জেমিনি এপিআই প্রদানকারীর উপর ক্লিক করুন। |
আপনার নির্বাচিত এপিআই প্রোভাইডারের জন্য সার্ভিসটি ইনিশিয়ালাইজ করার পদ্ধতি আপডেট করুন এবং একটি GenerativeModel ইনস্ট্যান্স তৈরি করুন।
সুইফট
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-3.5-flash")
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("gemini-3.5-flash")
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-3.5-flash");
// Use the GenerativeModelFutures Java compatibility layer which offers
// support for ListenableFuture and Publisher APIs
GenerativeModelFutures model = GenerativeModelFutures.from(ai);
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-3.5-flash" });
Dart
import 'package:firebase_ai/firebase_ai.dart';
import 'package:firebase_core/firebase_core.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-3.5-flash');
ঐক্য
" ফায়ারবেসে ভার্টেক্স এআই " থেকে ইউনিটির জন্য সমর্থন পাওয়া যাচ্ছিল না।
ইউনিটির জন্য ফায়ারবেস এআই লজিক এসডিকে (Firebase AI Logic SDK for Unity) দিয়ে কীভাবে কাজ শুরু করবেন তা জেনে নিন।
মনে রাখবেন যে , আপনি কোন সক্ষমতা ব্যবহার করছেন তার উপর নির্ভর করে, আপনাকে সবসময় একটি GenerativeModel ইনস্ট্যান্স তৈরি করতে নাও হতে পারে । Gemini Live API ব্যবহার করে ইনপুট এবং আউটপুট স্ট্রিম করতে , একটি LiveModel ইনস্ট্যান্স তৈরি করুন।
ধাপ ৫ : আপনার ব্যবহৃত ফিচারগুলোর ওপর নির্ভর করে কোড আপডেট করুন।
এই ধাপে আপনার ব্যবহৃত ফিচারগুলোর ওপর নির্ভর করে প্রয়োজনীয় পরিবর্তনগুলো বর্ণনা করা হয়েছে।
আপনি যদি Cloud Storage ইউআরএল ব্যবহার করে থাকেন এবং এই মাইগ্রেশনে জেমিনি ডেভেলপার এপিআই ব্যবহার শুরু করে থাকেন, তাহলে ফাইলগুলিকে ইনলাইন ডেটা হিসেবে অন্তর্ভুক্ত করার জন্য আপনাকে আপনার মাল্টিমোডাল রিকোয়েস্টগুলি আপডেট করতে হবে (অথবা ভিডিওর জন্য ইউটিউব ইউআরএল ব্যবহার করতে হবে)।
Firebase AI Logic SDK ব্যবহারের জন্য আপনার কোডে কোনো পরিবর্তন আনার প্রয়োজন হতে পারে কিনা, তা জানতে নিচের তালিকাগুলো পর্যালোচনা করুন।
সুইফট
No additional changes.
Kotlin
Live API
-
ResponseModalityenum ক্লাসের জন্যUNSPECIFIEDভ্যালুটি সরিয়ে ফেলা হয়েছে। এর পরিবর্তেnullব্যবহার করুন।
-
Java
Live API
-
ResponseModalityenum ক্লাসের জন্যUNSPECIFIEDভ্যালুটি সরিয়ে ফেলা হয়েছে। এর পরিবর্তেnullব্যবহার করুন।
-
বিভিন্ন জাভা বিল্ডার মেথড পরিবর্তন করা হয়েছে, যাতে এখন থেকে এগুলো void-এর পরিবর্তে সঠিকভাবে তাদের ক্লাসের ইনস্ট্যান্স রিটার্ন করে।
Web
শুধুমাত্র তখনই পরিবর্তন প্রয়োজন হবে, যদি আপনি Vertex AI Gemini API- এর পরিবর্তে Gemini Developer API ব্যবহার শুরু করেন :
Safety settings
- অসমর্থিত
SafetySetting.methodএর ব্যবহারগুলো সরিয়ে ফেলা হয়েছে।
- অসমর্থিত
Inline data
- অসমর্থিত
InlineDataPart.videoMetadataএর ব্যবহারগুলো সরিয়ে ফেলা হয়েছে।
- অসমর্থিত
Dart
No additional changes.
ঐক্য
" ফায়ারবেসে ভার্টেক্স এআই " থেকে ইউনিটির জন্য সমর্থন পাওয়া যাচ্ছিল না।
ইউনিটির জন্য ফায়ারবেস এআই লজিক এসডিকে (Firebase AI Logic SDK for Unity) দিয়ে কীভাবে কাজ শুরু করবেন তা জেনে নিন।
Firebase AI Logic ব্যবহারের অভিজ্ঞতা সম্পর্কে মতামত দিন।