Immediate API permits you to create customized prompts and set elective technology parameters with just some strains of code:
Era.getClient().generateContent(
generateContentRequest(
ImagePart(bitmapImage),
TextPart("Categorize this picture as one of many following: automobile, motorbike, bike, scooter, different. Return solely the class because the response."),
) {
// Non-compulsory parameters
temperature = 0.2f
topK = 10
candidateCount = 1
maxOutputTokens = 10
},
)
For extra detailed examples of implementing Immediate API, try the official documentation and pattern on Github.
Gemini Nano, efficiency, and prototyping
Immediate API at the moment performs finest on the Pixel 10 gadget sequence, which runs the most recent model of Gemini Nano (nano-v3). This model of Gemini Nano is constructed on the identical structure as Gemma 3n, the mannequin we first shared with the open mannequin neighborhood at I/O.
The shared basis between Gemma 3n and nano-v3 permits builders to extra simply prototype options. For these with out a Pixel 10 gadget, you can begin experimenting with prompts at the moment by prototyping with Gemma 3n regionally or accessing it on-line by way of Google AI Studio.
For the complete record of gadgets that assist GenAI APIs, check with our gadget assist documentation.
Study extra
Begin implementing Immediate API in your Android apps at the moment with steering from our official documentation and the pattern on Github.
