نظرة عامة على واجهات برمجة التطبيقات الذكاء الاصطناعي التوليدي في ML Kit
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تستفيد واجهات برمجة التطبيقات المستنِدة إلى الذكاء الاصطناعي التوليدي في ML Kit من إمكانات Gemini Nano لمساعدة تطبيقاتك في تنفيذ المهام. توفّر واجهات برمجة التطبيقات هذه جودة جاهزة للاستخدام لحالات الاستخدام الشائعة
من خلال واجهة عالية المستوى. تم إنشاء واجهات برمجة التطبيقات الخاصة بالذكاء الاصطناعي التوليدي في ML Kit استنادًا إلى
AICore، وهي خدمة تابعة لنظام التشغيل Android تتيح تنفيذ نماذج الذكاء الاصطناعي التوليدي الأساسية على الجهاز لتسهيل ميزات مثل تحسين وظائف التطبيقات
وتعزيز خصوصية المستخدمين من خلال معالجة البيانات على الجهاز.
تتيح واجهات برمجة التطبيقات المستندة إلى الذكاء الاصطناعي التوليدي في ML Kit الميزات التالية:
التلخيص: تلخيص المقالات أو محادثات الدردشة في قائمة نقطية
التدقيق اللغوي: يمكنك تحسين المحتوى القصير من خلال تصحيح الأخطاء النحوية والإملائية.
إعادة الكتابة: يمكنك إعادة كتابة الرسائل القصيرة بأساليب أو نبرات مختلفة.
مزايا واجهات برمجة التطبيقات المستندة إلى الذكاء الاصطناعي التوليدي
على غرار ميزات ML Kit الحالية الأخرى، تعمل واجهات برمجة تطبيقات الذكاء الاصطناعي التوليدي بالكامل على الجهاز، وبالتالي توفّر المزايا التالية:
تتم معالجة بيانات الإدخال والاستنتاج والإخراج على الجهاز
تظل الوظائف كما هي بدون اتصال موثوق بالإنترنت
عدم تحمّل أي تكلفة إضافية للخادم مقابل كل طلب API
بالإضافة إلى ذلك، بما أنّ واجهات برمجة تطبيقات الذكاء الاصطناعي التوليدي تستند إلى AICore وتعمل بواسطة Gemini Nano، يمكن لكل تطبيق استخدام نموذج Gemini Nano المشترك والمثبّت على الجهاز. يؤدي ذلك إلى تجنُّب الحاجة إلى انتظار تنزيل نموذج إذا كان متوفّرًا على الجهاز، وبالتالي الحفاظ على مساحة التخزين. مزيد من المعلومات حول كيفية عزل AICore للطلبات من أجل حماية الخصوصية
مقارنة بين المحتوى المتوفّر للبث والمحتوى غير المتوفّر للبث
توفّر واجهات برمجة التطبيقات المستنِدة إلى الذكاء الاصطناعي التوليدي في ML Kit خيارَي البث وغير البث لتلقّي النتائج. تقدّم واجهة برمجة التطبيقات الخاصة بالبث ردودًا بشكل تدريجي أثناء إنشائها، ما يوفّر تدفقًا مستمرًا للبيانات. في المقابل، ينتظر واجهة برمجة التطبيقات غير المتدفقة إلى أن يكتمل الرد بالكامل قبل إرجاعه ككتلة واحدة.
اختَر واجهة برمجة تطبيقات البث للحصول على ردود طويلة، لأنّها تتيح تلقّي ملاحظات أولية بشكل أسرع. تكون واجهة برمجة التطبيقات غير المخصّصة للبث أكثر ملاءمةً للردود القصيرة أو عند معالجة النتائج على شكل دفعات.
دعم الجهاز
تتوفّر واجهات برمجة التطبيقات المستندة إلى الذكاء الاصطناعي التوليدي في ML Kit على الأجهزة التالية، ونخطّط لتوسيع نطاق التوافق ليشمل أجهزة إضافية:
Google: هواتف Pixel 10 وPixel 10 Pro وPixel 10 Pro XL وPixel 10 Pro Fold وPixel 9 وPixel 9 Pro وPixel 9 Pro XL وPixel 9 Pro Fold
Honor: Honor 400 Pro وMagic 6 Pro وMagic 6 RSR وMagic 7 وMagic 7 Pro وMagic V3
vivo: vivo X200 وvivo X200 Pro وvivo X Fold3 Pro وvivo X Fold5
Xiaomi: Xiaomi 15 Ultra وXiaomi 15
قد يختلف مدى توفّر اللغات حسب إعدادات الجهاز والطُرز التي تم تنزيلها عليه.
الحصة لكل تطبيق
يفرض AICore حصة استنتاج لكل تطبيق، ما يعني أنّ إرسال عدد كبير جدًا من الطلبات إلى GenAI API في فترة قصيرة سيؤدي إلى ظهور الرد ErrorCode.BUSY. عند تلقّي خطأ من هذا النوع، ننصحك باستخدام التراجع الدليلي لإعادة محاولة الطلب.
الاستخدام في الخلفية
يُسمح باستنتاج GenAI API فقط عندما يكون التطبيق هو تطبيق المقدّمة الأعلى. سيؤدي استخدام واجهة برمجة التطبيقات عندما لا يكون التطبيق في المقدّمة، بما في ذلك استخدام خدمة تعمل في المقدّمة، إلى ظهور الردّ ErrorCode.BUSY بسبب عدم توفّر حصة استخدام في الخلفية حاليًا.
تاريخ التعديل الأخير: 2025-08-20 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-08-20 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["| This API is offered in beta, and is not subject to any SLA or deprecation policy. Changes may be made to this API that break backward compatibility.\n\nML Kit's GenAI APIs harness the power of [Gemini Nano](https://developer.android.com/ai/gemini-nano/) to help your apps\nperform tasks. These APIs provide out-of-the-box quality for popular use cases\nthrough a high-level interface. The ML Kit GenAI APIs are built on top of\n[AICore](https://android-developers.googleblog.com/2023/12/a-new-foundation-for-ai-on-android.html), an Android system service that enables on-device execution of GenAI\nfoundation models to facilitate features such as enhanced app functionality and\nimproved user privacy by processing data locally.\n\nThe ML Kit GenAI APIs support the following features:\n\n- [**Summarization**](/ml-kit/genai/summarization/android): Summarize articles or chat conversations as a bulleted list.\n- [**Proofreading**](/ml-kit/genai/proofreading/android): Polish short content by refining grammar and fixing spelling errors.\n- [**Rewriting**](/ml-kit/genai/rewriting/android): Rewrite short messages in different tones or styles.\n- [**Image description**](/ml-kit/genai/image-description/android): Generate a short description of a given image.\n\nBenefits of GenAI APIs\n\nSimilar to other existing ML Kit features, GenAI APIs run entirely on-device and\nthus provide the following benefits:\n\n- Input, inference, and output data is processed locally\n- Functionality remains the same without reliable internet connection\n- No additional server cost incurred for each API call\n\nIn addition, since GenAI APIs are built on top of AICore and powered by Gemini\nNano, every app is able to use the shared Gemini Nano model that is on the\ndevice. This avoids the need to have to wait for a model to be downloaded if it\nalready exists on a device, and in turn conserves storage space. Learn [more\nabout how AICore isolates requests to protect privacy](https://android-developers.googleblog.com/2024/10/introduction-to-privacy-and-safety-gemini-nano.html).\n\nStreaming versus non-streaming\n\nML Kit GenAI APIs offer both streaming and non-streaming options for receiving\nresults. The streaming API delivers responses incrementally as they are\ngenerated, providing a continuous flow of data. In contrast, the non-streaming\nAPI waits until the entire response is complete before returning it as a single\nblock.\n\nChoose the streaming API for lengthy responses, as it allows for quicker initial\nfeedback. The non-streaming API is more suitable for short responses or when\nprocessing results in batches.\n\nDevice support\n\nThe ML Kit GenAI APIs are available on the following devices, with\nplans to expand support to additional devices:\n\n- Google: Pixel 9, Pixel 9 Pro, Pixel 9 Pro XL, Pixel 9 Pro Fold\n- Honor: Magic 7 Pro, Magic 7\n- iQOO: iQOO 13\n- Motorola: Razr 60 Ultra\n- OnePlus: OnePlus 13, OnePlus 13s\n- OPPO: Find N5, Find X8, Find X8 Pro\n- POCO: POCO F7 Ultra\n- realme: realme GT 7 Pro\n- Samsung: Galaxy S25, Galaxy S25+, Galaxy S25 Ultra\n- vivo: vivo X200, vivo X200 Pro\n- Xiaomi: Xiaomi 15 Ultra, Xiaomi 15\n\nAvailability of specific language support may vary depending on the particular\ndevice's configuration and the models that have been downloaded to the device.\n\nQuota per application\n\nAICore enforces an inference quota per app. This means that making too many\nGenAI API requests in a short period will result in an `ErrorCode.BUSY`\nresponse. When receiving such an error, consider using exponential backoff to\nretry the request.\n\nBackground usage\n\nGenAI API inference is permitted only when the app is the top foreground\napplication. Using the API when the app is not in the foreground, including\nusing a foreground service, will result in an `ErrorCode.BUSY` response due to\nthe current lack of background usage quota.\n\nSample code\n\nTo get this code, check out the following samples:\n\n- [ML Kit GenAI Samples](https://github.com/googlesamples/mlkit/tree/master/android/genai)\n- [Android AI Catalog Sample](https://github.com/android/ai-samples/tree/main/ai-catalog)"]]