diff --git a/README.md b/README.md index 9aade05..e00b000 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,12 @@ Welcome to **FriendlyMeals**, an app that demonstrates how to integrate Firebase - Go to the [**App Check**](https://console.firebase.google.com/project/_/appcheck/?useAutoProject=true) section of the console, enable this service, and register your Android app using the Play Integrity provider (you'll need to provide the SHA-256 fingerprint of your app's signing certificate). - Go to the [**Remote Config**](https://console.firebase.google.com/project/_/config/?useAutoProject=true) section of the console and enable this service. - Go to the [**Firebase Storage**](https://console.firebase.google.com/project/_/storage/?useAutoProject=true) section of the console and enable this service (you'll need to set up a billing account since this service is only available on the Blaze plan). + +1. **Create Firebase AI Logic Prompt Templates** + - If you're not familiar with Prompt templates, take a look at the [documentation](https://firebase.google.com/docs/ai-logic/server-prompt-templates/get-started) to learn more about it. + - Go to the [AI services > AI Logic > Prompt templates tab](https://console.firebase.google.com/project/_/ailogic/templates/?useAutoProject=true). + - Create one prompt template for each one of the four templates in the [prompts folder](https://github.com/FirebaseExtended/FriendlyMeals-Android/tree/main/prompts). Please note that the model names below might not be the most up to date ones. [Refer to the documentation](https://firebase.google.com/docs/ai-logic/models) to check the latest available models. + - Don't forget to test each one of your templates in the Firebase console before you use them in your apps. [Read the docs](https://firebase.google.com/docs/ai-logic/server-prompt-templates/get-started?api=dev#test-template) to learn how to test your templates properly. 1. **Run the app** - Build and run in Android Studio on an Android emulator or physical device. diff --git a/prompts/find-stores-template-v1-0-0.prompt b/prompts/find-stores-template-v1-0-0.prompt new file mode 100644 index 0000000..43f72c8 --- /dev/null +++ b/prompts/find-stores-template-v1-0-0.prompt @@ -0,0 +1,18 @@ +--- +model: "gemini-3.5-flash-lite" +tools: + - googleMaps +input: + schema: + ingredients: "string, the ingredients in the shopping list" + dayOfWeek: "string, current day of the week" + currentTime: "string, current time of the day" +--- + +What are the nearest grocery stores or markets near me that stock these ingredients: {{ingredients}}? +For each place, tell me their business hours, if it's open right now on {{dayOfWeek}} at {{currentTime}}, and if it's closing in less than 30 minutes. +Tell me what the parking situation is like at each place: is there a dedicated lot or should I look for street parking? +Tell the Map URL so I can open it in Google Maps. +Format your response strictly as a JSON object with a "stores" array containing store objects. +Each store object must have these EXACT keys: "name": string, "address": string, "distance": string, "openNow": boolean, "closingSoon": boolean, "hasParking": boolean, "parkingDetails": string, "mapUrl": string. +Do NOT include markdown code block formatting (like ```json). Output only the raw JSON string. diff --git a/prompts/generate-recipe-photo-gemini-template-v1-0-0.prompt b/prompts/generate-recipe-photo-gemini-template-v1-0-0.prompt new file mode 100644 index 0000000..b2c81ed --- /dev/null +++ b/prompts/generate-recipe-photo-gemini-template-v1-0-0.prompt @@ -0,0 +1,9 @@ +--- +model: "gemini-3.1-flash-image" +input: + schema: + recipeTitle: "string" +--- + +A professional food photography shot of this recipe: {{recipeTitle}}. +Style: High-end food photography, restaurant-quality plating, soft natural lighting, on a clean background, showing the complete plated dish. diff --git a/prompts/generate-recipe-template-v1-0-0.prompt b/prompts/generate-recipe-template-v1-0-0.prompt new file mode 100644 index 0000000..91e6ad5 --- /dev/null +++ b/prompts/generate-recipe-template-v1-0-0.prompt @@ -0,0 +1,30 @@ +--- +model: "gemini-3.5-flash-lite" +input: + schema: + ingredients: "string, the ingredients list" + notes?: "string, cuisine and dietary notes" +output: + format: json + schema: + title: string + instructions: string + ingredients(array, ingredients for recipe): string + prepTime: string + cookTime: string + servings: string + tags(array, relevant tags for recipe): string +--- + +{{role "user"}} +Create a detailed recipe based on these ingredients: {{ingredients}}. + +Format requirements: + - 'instructions': Provide the cooking steps as a clear list of instructions separated by newlines. Use bold formatting on the step numbers. Use Markdown. + - 'ingredients': List all necessary items, including quantities. + - 'prepTime', 'cookTime', 'servings': Short strings (e.g., "15 mins"). + - 'tags': Generate a list of 3-5 relevant category tags (e.g., "Healthy", "Vegan", "Gluten-Free", "Dessert", "Quick"). + +{{#if notes}} +IMPORTANT CUISINE AND DIETARY NOTES: {{notes}} +{{/if}} diff --git a/prompts/scan-meal-template-v1-0-0.prompt b/prompts/scan-meal-template-v1-0-0.prompt new file mode 100644 index 0000000..97bb625 --- /dev/null +++ b/prompts/scan-meal-template-v1-0-0.prompt @@ -0,0 +1,16 @@ +--- +model: "gemini-3.5-flash-lite" +output: + format: json + schema: + protein: string + fat: string + carbs: string + sugar: string + ingredients(array, ingredients in the meal): string +--- + +Analyze this image of a meal: {{media type="mimeType" data="imageData"}}, and estimate the nutritional content. +Return the result in JSON format matching the schema: +- protein, fat, carbs, sugar (strings with units, e.g., '20g') +- ingredients (list of strings)