Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Supercharge your Android Apps with Gemini API

Supercharge your Android Apps with Gemini API

Sohel Shaikh

June 29, 2024
Tweet

More Decks by Sohel Shaikh

Other Decks in Technology

Transcript

  1. Supercharge your Android Apps Building with Gemini API Sohel Shaikh

    Lead Android Engineer Skylark Drones @thesohelshaikh
  2. - 4+ YOE with Android - Lead Android Engineer @

    Skylark Drones - I 💜 Kotlin! - @thesohelshaikh on Socials Hey, I am Sohel
  3. GDG Ahmedabad Ways of integration • Google AI Client SDK

    • Firebase Vertex SDK • Google AI Edge SDK for Gemini Nano
  4. GDG Ahmedabad Google AI Client SDK • Coroutines as First

    Class Citizen • Written in Kotlin • Easy to use • Available on GitHub
  5. GDG Ahmedabad val model = GenerativeModel( model = "gemini-1.5-flash-001" ,

    apiKey = BuildConfig.apikey, generationConfig = generationConfig { temperature = 0.15f topK = 32 topP = 1f maxOutputTokens = 4096 }, safetySettings = listOf( SafetySetting(HarmCategory.HARASSMENT, BlockThreshold.MEDIUM_AND_ABOVE), SafetySetting(HarmCategory.HATE_SPEECH, BlockThreshold.MEDIUM_AND_ABOVE), ) )
  6. GDG Ahmedabad val model = GenerativeModel( model = "gemini-1.5-flash-001" ,

    apiKey = BuildConfig.apikey, generationConfig = generationConfig { temperature = 0.15f topK = 32 topP = 1f maxOutputTokens = 4096 }, safetySettings = listOf( SafetySetting(HarmCategory.HARASSMENT, BlockThreshold.MEDIUM_AND_ABOVE), SafetySetting(HarmCategory.HATE_SPEECH, BlockThreshold.MEDIUM_AND_ABOVE), ) )
  7. GDG Ahmedabad val model = GenerativeModel( model = "gemini-1.5-flash-001" ,

    apiKey = BuildConfig.apikey, generationConfig = generationConfig { temperature = 0.15f topK = 32 topP = 1f maxOutputTokens = 4096 }, safetySettings = listOf( SafetySetting(HarmCategory.HARASSMENT, BlockThreshold.MEDIUM_AND_ABOVE), SafetySetting(HarmCategory.HATE_SPEECH, BlockThreshold.MEDIUM_AND_ABOVE), ) )
  8. GDG Ahmedabad val model = GenerativeModel( model = "gemini-1.5-flash-001" ,

    apiKey = BuildConfig.apikey, generationConfig = generationConfig { temperature = 0.15f topK = 32 topP = 1f maxOutputTokens = 4096 }, safetySettings = listOf( SafetySetting(HarmCategory.HARASSMENT, BlockThreshold.MEDIUM_AND_ABOVE), SafetySetting(HarmCategory.HATE_SPEECH, BlockThreshold.MEDIUM_AND_ABOVE), ) )
  9. GDG Ahmedabad scope.launch { val response = model.generateContent( content {

    image(bitmap) text("What is the object in this picture?") } ) }
  10. GDG Ahmedabad Low Rank Adaption (LoRA) • Fine tuning technique

    • Faster to train • Smaller on device footprint • Unique sets for specialized applications
  11. Prompt Engineering • Be specific • Few shot prompting •

    Avoid negative prompting • Image first, text second
  12. GDG Ahmedabad Ways of integration** • Google AI Client SDK

    - Public Preview • Firebase Vertex SDK - Public Preview • Google AI Edge SDK for Gemini Nano - Private Preview