
"The new API accepts either text input or a combination of image and text input and produces a text response. According to Google, it enables the use of natural language prompts across a variety of mobile use cases, including short translation, image and text classification, content generation, and more: Prompt API moves beyond pre-built functionality to support custom, app-specific GenAI use cases, allowing you to create unique features with complex data transformation. Prompt API uses Gemini Nano on-device to process data locally, enabling offline capability and improved user privacy."
"The new Prompt API can be seen as a lower-level API compared to the existing GenAI APIs, which target specific features like summarization, proofreading, rewriting, and image description. It requires more integration effort in exchange for greater flexibility. Each feature-specific API includes a built-in prompt optimized for its particular use case, relieving the developer from the burden of prompt engineering but also imposing certain limitations."
"For instance, the summarization API restricts outputs to 1-3 bullet points; the image description API generates brief, generic captions; and the rewriting API supports only a fixed set of styles such as elaborate, shorten, friendly, and others. In contrast, the Prompt API offers more flexibility by allowing developers to supply custom prompts. For example, the following code snippet demonstrates how to provide a fully customized prompt that instructs the on-device model on how to process an image sent with the request: Generation.getClient().generateContent( generateContentRequest( ImagePart(bitmapImage), TextPart("Categorize this "
The ML Kit GenAI Prompt API accepts text or combined image-and-text input and returns text responses using Gemini Nano running on-device. The API supports short translation, image and text classification, content generation, and other mobile use cases. On-device processing enables offline capability and improved user privacy. The Prompt API functions as a lower-level, more flexible interface than existing feature-specific GenAI APIs, requiring more integration but allowing custom prompts. Feature-specific APIs include built-in prompts and enforce constraints such as limited bullet counts, brief captions, or a fixed set of rewriting styles.
Read at InfoQ
Unable to calculate read time
Collection
[
|
...
]