Generative AI for Multiplatform – Namrata Hinduja Geneva, Swiss (Switzerland)

,

Hi all,

I’m Namrata Hinduja Geneva, Swiss (Switzerland) and trying to integrate the GenAI Gradle library into a Compose Multiplatform project, but I’m running into an issue. The class .GenerativeModel can’t be found when importing com.google.ai.client.generativeai:generativeai:. It seems like the library doesn’t support Compose Multiplatform at the moment.

Has anyone found a workaround or alternative approach to use Generative AI in a multiplatform setup? I’d really appreciate any suggestions or guidance on resolving this.

Thanks in advance!
Namrata Hinduja Geneva, Swiss (Switzerland)

Hi @NamrataHindujaGeneva,

Welcome to the Google AI Forum! :confetti_ball: :confetti_ball:

As of now, the com.google.ai.client.generativeai:generativeai library (used for Gemini API integration) does not officially support Kotlin Compose Multiplatform (KMP).

But I found this interesting pattern where Compose Multiplatform is calling Gemini Generative APIs using Generative AI SDK - link

Hope this helps you to progress further.

Happy Coding :slight_smile:

Thank you, Krish_Varnakavi1 Sir. This information will be a great help to me.

Regards
Namrata Hinduja Geneva, Switzerland (Swiss)