google-gemini / generative-ai-android

The official Android library for the Google Gemini API
https://ai.google.dev/gemini-api/docs/get-started/tutorial?lang=android
Apache License 2.0
634 stars 139 forks source link

Error in accessing TunedGenerativeModel in Android #111

Open kushalbusiness12 opened 2 months ago

kushalbusiness12 commented 2 months ago

Im developing an Android chat app using a custom-tuned model from Gemini AI. However, I'm stuck with an error (see screenshot below) Error : models/tuned-test-model-g8tvOuyp9i6i is not found for API version v1 . when trying to integrate the model into my code. Any insights on resolving this issue would be greatly appreciated! Android code for reference val generativeModel = GenerativeModel( modelName = "tuned-test-model-g8tv0uyp9i6i", apiKey = BuildConfig.apiKey, generationConfig = config )

Screen Shot 2024-04-04 at 3 04 35 PM Screen Shot 2024-04-04 at 3 08 32 PM
rlazo commented 2 months ago

Hi @kushalbusiness12 could you try using "tunedModels/tuned-test-model-g8tv0uyp9i6i" as the name of the model? Let me know if that's the issue. I'll be looking at whether this is correctly documented on our end. Thanks!

kushalbusiness12 commented 2 months ago

@rlazo I tried using "tunedModels/tuned-test-model-g8tv0uyp9i6i" But I am facing permission issue : You do not have permission to access tuned model tunedModels/ tuned-test-model-g8tvOuyp9ibi

Screen Shot 2024-04-05 at 11 24 30 AM
rlazo commented 2 months ago

Could you try setting the permissions for "EVERYONE" to "READER" for the model https://ai.google.dev/api/rest/v1beta/corpora.permissions#role ?

kushalbusiness12 commented 2 months ago

@rlazo I am currently using Google Ai Studio Tuned Model. I don't see any option to edit permissions in Google AI studio Console. Can you help with this?

yujratnesh commented 1 month ago

Hello Team,

I am also facing the same issue. Please let me know if you find any issue.

jewel22-ace commented 1 month ago

I am also facing same issue.

manishindiainc commented 1 month ago

Hi Team, facing the same issue. Please help.

Ayush783 commented 5 days ago

Hi, I solved the same issue in my Flutter application. Sharing for your reference, hope you can draw out similarities and incorporate the same in Android natively. https://medium.com/@Ayush_b58/accessing-tuned-gemini-model-in-flutter-30d07843d2e2