Dart 7+ years in Mobile Application Development Core Member of Flutter Karachi Pakistan Women in Tech Speaker for Google Developers Space, Singapore Mentor in various Google programs
- Choose location for your hunt e.g. House, office, school - Generate 5 items to find, through AI - Take a photo of the item - Validate if the photo contains the item
applications - Single code-base -> same application for multiple platforms! - Platforms supported: Android, iOS, Web, Windows, Mac, Linux & Fuchsia - Programming Language: Dart - Open-source - Developed & owned by Google - Age: ~7 years (May 2017)
models for: - Image recognition - Text analysis, translations - Speech to text, Text to speech - API for Developers - For production use cases Firebase Vertex Ai - Brief Introduction
a firebase project, connect it to your game 3. Click on Build with Gemini in the Firebase console 4. Enable billing in your Firebase project 5. Enable the following APIs: a. Vertex AI API b. Vertex AI in Firebase API Firebase Vertex Ai - Getting Started
AI service and the generative model Firebase Vertex Ai - Getting Started class ScavengerHuntClient { ScavengerHuntClient() : _model = FirebaseVertexAI.instance.generativeModel( model: 'gemini-1.5-pro', ); final GenerativeModel _model; }
AI service and the generative model 8. Call the Vertex AI Gemini API to generate item list Firebase Vertex Ai - Getting Started Future<String?> generateScavengerHuntItems (String location) async { final prompt = 'You are a scavenger hunt game where objects are found by taking a photo of them.' 'Generate a list of 5 items that could be found in the following location: $location.' 'The difficulty to find the items should be easy.' 'Keep the item name concise. All letters should be uppercase.' 'Provide your response as a JSON object with the following schema: {"items": ["", "", ...]}.' 'Do not return your result as Markdown.' ; final response = await _model.generateContent([Content. text(prompt)]); return response.text; }
AI service and the generative model 8. Call the Vertex AI Gemini API to generate item list 9. Validate if the provided image is THE item or not Firebase Vertex Ai - Getting Started Future<String?> validateImage (String item , Uint8List image) async { final promptText = 'You are a scavenger hunt game where items are found by taking a photo of them.' 'You have been given the item " $item" and a photo of the item.' 'Determine if the photo is a valid photo of the item.' 'Provide your response as a JSON object with the following schema: {"isItemValid": true/false}.' 'Do not return your result as Markdown.' ; final response = await _model.generateContent([ Content. multi([TextPart(promptText) , DataPart('image/jpeg' , image)]), ]); return response.text; }
JSON 3. State the schema of JSON 4. Test your prompts in Google AI Studio Prompt Engineering Future<String?> generateScavengerHuntItems (String location) async { final prompt = 'You are a scavenger hunt game where objects are found by taking a photo of them.' 'Generate a list of 5 items that could be found in the following location: $location.' 'The difficulty to find the items should be easy.' 'Keep the item name concise. All letters should be uppercase.' 'Provide your response as a JSON object with the following schema: {"items": ["", "", ...]}.' 'Do not return your result as Markdown.' ; final response = await _model.generateContent([Content. text(prompt)]); return response.text; }