AI এজ ফাংশন কলিং SDK (FC SDK) হল একটি লাইব্রেরি যা ডেভেলপারদের অন-ডিভাইস LLM-এর সাথে ফাংশন কলিং ব্যবহার করতে সক্ষম করে। ফাংশন কলিং আপনাকে মডেলগুলিকে বাহ্যিক সরঞ্জাম এবং API-এর সাথে সংযুক্ত করতে দেয়, মডেলগুলিকে বাস্তব-বিশ্বের ক্রিয়াগুলি চালানোর জন্য প্রয়োজনীয় প্যারামিটার সহ নির্দিষ্ট ফাংশনগুলিকে কল করতে সক্ষম করে৷
শুধু পাঠ্য তৈরি করার পরিবর্তে, FC SDK ব্যবহার করে একটি LLM একটি ফাংশনে একটি কাঠামোগত কল তৈরি করতে পারে যা একটি ক্রিয়া সম্পাদন করে, যেমন আপ-টু-ডেট তথ্য অনুসন্ধান করা, অ্যালার্ম সেট করা বা সংরক্ষণ করা।
AI Edge FC SDK অ্যান্ড্রয়েডের জন্য উপলব্ধ এবং LLM ইনফারেন্স API এর সাথে সম্পূর্ণরূপে অন-ডিভাইস চালানো যেতে পারে। অ্যান্ড্রয়েড গাইড অনুসরণ করে SDK ব্যবহার শুরু করুন, যা আপনাকে ফাংশন কলিং ব্যবহার করে একটি নমুনা অ্যাপ্লিকেশনের মৌলিক বাস্তবায়নের মাধ্যমে নিয়ে যায়।
ফাংশন কলিং পাইপলাইন
ফাংশন কলিং ক্ষমতা সহ একটি অন-ডিভাইস এলএলএম সেট আপ করার জন্য নিম্নলিখিত মূল পদক্ষেপগুলি প্রয়োজন:
ফাংশন ঘোষণা সংজ্ঞায়িত করুন : LLM যে ফাংশনগুলিকে কল করতে পারে তার গঠন এবং পরামিতিগুলি আপনার অ্যাপ্লিকেশন কোডে সংজ্ঞায়িত করা আবশ্যক৷ এর মধ্যে রয়েছে ফাংশনের নাম, পরামিতি এবং প্রকারগুলি উল্লেখ করা।
ফরম্যাট প্রম্পট এবং আউটপুট : ইনপুট এবং আউটপুট পাঠ্যে প্রাকৃতিক ভাষা এবং ফাংশন কল থাকতে পারে। একটি ফরম্যাটার নিয়ন্ত্রণ করে কিভাবে ডেটা স্ট্রাকচারগুলিকে স্ট্রিংগুলিতে এবং থেকে রূপান্তরিত করা হয়, LLM-কে যথাযথভাবে তথ্য ফর্ম্যাট করতে সক্ষম করে৷
পার্স আউটপুট : একটি পার্সার শনাক্ত করে যে উত্পন্ন প্রতিক্রিয়াতে একটি ফাংশন কল রয়েছে এবং এটিকে একটি কাঠামোগত ডেটা টাইপে পার্স করে যাতে অ্যাপ্লিকেশনটি ফাংশন কলটি কার্যকর করতে পারে।
প্রতিক্রিয়া পরীক্ষা করুন : যদি পার্সার একটি ফাংশন কল সনাক্ত করে, অ্যাপ্লিকেশনটি উপযুক্ত পরামিতি এবং কাঠামোগত ডেটা টাইপ সহ ফাংশনটিকে কল করে। অন্যথায়, এটি স্বাভাবিক ভাষার পাঠ্য ফিরিয়ে দেয়।
মূল উপাদান
FC SDK-তে নিম্নলিখিত মূল উপাদানগুলি রয়েছে:
ইনফারেন্স ব্যাকএন্ড : একটি জেনারেটিভ এআই মডেলে অনুমান চালানোর জন্য একটি ইন্টারফেস। FC SDK LiteRT (TFLite) মডেলে অনুমান নির্বাহ করতে LLM ইনফারেন্স API ব্যবহার করে। API InferenceBackend ইন্টারফেস ব্যবহার করে।
প্রম্পট ফরম্যাটার : জেনারেটিভ এআই মডেল থেকে অনুরোধ এবং প্রতিক্রিয়া ফর্ম্যাট করার জন্য একটি ইন্টারফেস। FC SDK একটি ফরম্যাটার প্রদান করে যা LLM-এর জন্য প্রয়োজনীয় মডেল-নির্দিষ্ট ফর্ম্যাটে ফাংশন ঘোষণাকে রূপান্তর করে এবং সেগুলিকে সিস্টেম প্রম্পটে সন্নিবেশ করে। ফর্ম্যাটারটি ব্যবহারকারী এবং মডেল বাঁক নির্দেশ করতে মডেল-নির্দিষ্ট টোকেনগুলি পরিচালনা করে। API ModelFormatter ইন্টারফেস ব্যবহার করে।
আউটপুট পার্সার : FC SDK একটি পার্সার সরবরাহ করে যা সনাক্ত করে যে মডেলের আউটপুট একটি ফাংশন কল প্রতিনিধিত্ব করে এবং অ্যাপ্লিকেশন দ্বারা ব্যবহারের জন্য এটি একটি ডেটা কাঠামোতে পার্স করে। API ModelFormatter ইন্টারফেস ব্যবহার করে।
সীমাবদ্ধ ডিকোডিং : উত্পন্ন আউটপুট নির্দিষ্ট নিয়ম বা শর্ত মেনে চলে তা নিশ্চিত করার জন্য সীমাবদ্ধতা তৈরি এবং পরিচালনা করার জন্য একটি ইন্টারফেস। সমর্থিত মডেলগুলির জন্য, FC SDK সীমাবদ্ধ ডিকোডিং ব্যবহার করার জন্য অনুমান ব্যাকএন্ড কনফিগার করবে, যা নিশ্চিত করে যে মডেলটি শুধুমাত্র বৈধ ফাংশনের নাম এবং পরামিতিগুলি আউটপুট করে। API ConstraintProvider ইন্টারফেস ব্যবহার করে।
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-05-26 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# AI Edge Function Calling guide\n\n| **Attention:** The AI Edge Function Calling SDK is under active development.\n\nThe AI Edge Function Calling SDK (FC SDK) is a library that enables developers\nto use function calling with on-device LLMs. Function calling lets you connect\nmodels to external tools and APIs, enabling models to call specific functions\nwith the necessary parameters to execute real-world actions.\n\nRather than just generating text, an LLM using the FC SDK can generate a\nstructured call to a function that executes an action, such as searching for\nup-to-date information, setting alarms, or making reservations.\n\nThe AI Edge FC SDK is available for Android and can be run completely on-device\nwith the LLM Inference API. Start using the SDK by following the [Android\nguide](./android), which walks you through a basic implementation of a sample\napplication using function calling.\n\nFunction calling pipeline\n-------------------------\n\nSetting up an on-device LLM with function calling capabilities requires the\nfollowing key steps:\n\n1. **Define function declarations**: The structure and parameters of the functions that the LLM can call must be defined in your application code. This includes specifying function names, parameters, and types.\n2. **Format prompts and outputs**: Input and output text can contain natural language and function calls. A formatter controls how data structures are converted to and from strings, enabling the LLM to appropriately format information.\n3. **Parse outputs**: A parser detects if the generated response contains a function call and parses it into a structured data type so that the application can execute the function call.\n4. **Examine responses**: If the parser detects a function call, the application calls the function with the appropriate parameters and structured data type. Otherwise, it returns natural language text.\n\nKey components\n--------------\n\nThe FC SDK contains to following key components:\n\n- **Inference Backend** : An interface for running inference on a generative AI model. The FC SDK uses the LLM Inference API to execute inference on LiteRT (TFLite) models. The API uses the [InferenceBackend](https://github.com/google-ai-edge/ai-edge-apis/blob/main/local_agents/function_calling/java/com/google/ai/edge/localagents/fc/InferenceBackend.java) interface.\n- **Prompt Formatter** : An interface for formatting requests and responses to and from the Generative AI model. The FC SDK provides a formatter that converts function declarations into the model-specific format required by the LLM and inserts them into the system prompt. The formatter also handles model-specific tokens to indicate user and model turns. The API uses the [ModelFormatter](https://github.com/google-ai-edge/ai-edge-apis/blob/main/local_agents/function_calling/java/com/google/ai/edge/localagents/fc/ModelFormatter.java) interface.\n- **Output Parser** : The FC SDK provides a parser that detects if the model's output represents a function call and parses it into a data structure for use by the application. The API uses the [ModelFormatter](https://github.com/google-ai-edge/ai-edge-apis/blob/main/local_agents/function_calling/java/com/google/ai/edge/localagents/fc/ModelFormatter.java) interface.\n- **Constrained Decoding** : An interface for creating and managing constraints to ensure that the generated output adheres to specific rules or conditions. For supported models, the FC SDK will configure the inference backend to use constrained decoding, which ensures that the model only outputs valid function names and parameters. The API uses the [ConstraintProvider](https://github.com/google-ai-edge/ai-edge-apis/blob/main/local_agents/function_calling/java/com/google/ai/edge/localagents/fc/ConstraintProvider.java) interface."]]