| এই পৃষ্ঠার উদাহরণগুলো ধরে নেয় যে আপনি "শুরু করুন: অ্যাপলের ফাউন্ডেশন মডেলস ফ্রেমওয়ার্কের মাধ্যমে জেমিনি এপিআই অ্যাক্সেস করুন" সম্পন্ন করেছেন। |
অ্যাপলের ফাউন্ডেশন মডেলস ফ্রেমওয়ার্কের মাধ্যমে জেমিনি এপিআই অ্যাক্সেস করার সময়, মডেলটিকে বাহ্যিক ডেটা উৎসের সাথে সংযুক্ত করতে আপনি জেমিনি মডেলগুলিতে জেমিনির অন্তর্নির্মিত টুলগুলি সরবরাহ করতে পারেন।
এই পৃষ্ঠাটিতে দেখানো হয়েছে কীভাবে জেমিনি মডেলের জন্য নিম্নলিখিত অন্তর্নির্মিত সরঞ্জামগুলি ব্যবহার করতে হয়:
Google Search মাধ্যমে গ্রাউন্ডিং
বিস্তারিত বিবরণ, সর্বোত্তম অনুশীলন এবং ব্যবহারের ক্ষেত্রসমূহের জন্য, ‘গ্রাউন্ডিং উইথ
সমর্থিত মডেল
-
gemini-3.1-pro-preview -
gemini-3.5-flash -
gemini-3.1-flash-lite -
gemini-3-pro-image-preview(ওরফে "ন্যানো ব্যানানা প্রো") -
gemini-3.1-flash-image-preview(ওরফে "ন্যানো বানানা ২")
Google Search টুলটি সক্রিয় করুন
geminiLanguageModel তৈরির অংশ হিসেবে googleSearch টুলটি প্রদান করুন:
import FoundationModels
import FirebaseCore
import FirebaseAILogic
// Initialize the Gemini Developer API backend service.
let ai = FirebaseAI.firebaseAI(backend: .googleAI())
// Initialize a `geminiLanguageModel` with a Gemini model that supports your use case.
let model = ai.geminiLanguageModel(
name: "GEMINI_MODEL_NAME",
// Provide Google Search as a tool that the model can use to generate its response.
serverTools: [GeminiTool.googleSearch()]
)
let session = LanguageModelSession(model: model)
let response = try await session.respond(to: "What is the weather in Toronto today?")
for entry in response.transcriptEntries {
if case let .response(responseEntry) = entry {
if let groundingMetadata = responseEntry
.metadata["groundingMetadata"] as? GroundingMetadata {
for chunk in groundingMetadata.groundingChunks {
let webChunk = chunk.web
// use the webChunk
}
}
}
}
// Make sure to comply with the "Grounding with Google Search" usage requirements,
// which includes how you use and display the grounded result
Google Maps দিয়ে গ্রাউন্ডিং
গ্রাউন্ডিং উইথ
বিস্তারিত বিবরণ, সর্বোত্তম অনুশীলন এবং ব্যবহারের ক্ষেত্রসমূহের জন্য, ‘গ্রাউন্ডিং উইথ
সমর্থিত মডেল
-
gemini-3.1-pro-preview -
gemini-3.5-flash -
gemini-3.1-flash-lite
Google Maps টুলটি সক্রিয় করুন
geminiLanguageModel তৈরি করার অংশ হিসেবে googleMaps টুলটি প্রদান করুন। আপনি চাইলে টুলটির কনফিগারেশনে স্থানাঙ্কও প্রদান করতে পারেন।
import FoundationModels
import FirebaseCore
import FirebaseAILogic
// Initialize the Gemini Developer API backend service.
let ai = FirebaseAI.firebaseAI(backend: .googleAI())
// Initialize a `geminiLanguageModel` with a Gemini model that supports your use case.
let model = ai.geminiLanguageModel(
name: "GEMINI_MODEL_NAME",
// Provide Google Maps as a tool that the model can use to generate its response.
serverTools: [GeminiTool.googleMaps()]
)
let session = LanguageModelSession(model: model)
let response = try await session
respond(to: "Where is a good place to grab a coffee near Alameda, CA?")
for entry in response.transcriptEntries {
if case let .response(responseEntry) = entry {
if let groundingMetadata = responseEntry
.metadata["groundingMetadata"] as? GroundingMetadata {
for chunk in groundingMetadata.groundingChunks {
let mapsChunk = chunk.maps
// use the mapsChunk
}
}
}
}
// Make sure to comply with the "Grounding with Google Maps " usage requirements,
// which includes how you meet service usage requirements
অ্যাপলের ফাউন্ডেশন মডেলস ফ্রেমওয়ার্কের মাধ্যমে জেমিনি এপিআই অ্যাক্সেস করার বিষয়ে মতামত দিন।