|
| 1 | +package com.google.firebase.quickstart.ai |
| 2 | + |
| 3 | +import com.google.firebase.ai.type.ResponseModality |
| 4 | +import com.google.firebase.ai.type.content |
| 5 | +import com.google.firebase.ai.type.generationConfig |
| 6 | +import com.google.firebase.quickstart.ai.ui.navigation.Category |
| 7 | +import com.google.firebase.quickstart.ai.ui.navigation.Sample |
| 8 | + |
| 9 | +val FIREBASE_AI_SAMPLES = listOf( |
| 10 | + Sample( |
| 11 | + title = "Travel tips", |
| 12 | + description = "The user wants the model to help a new traveler" + |
| 13 | + " with travel tips", |
| 14 | + navRoute = "chat", |
| 15 | + categories = listOf(Category.TEXT), |
| 16 | + systemInstructions = content { |
| 17 | + text( |
| 18 | + "You are a Travel assistant. You will answer" + |
| 19 | + " questions the user asks based on the information listed" + |
| 20 | + " in Relevant Information. Do not hallucinate. Do not use" + |
| 21 | + " the internet." |
| 22 | + ) |
| 23 | + }, |
| 24 | + chatHistory = listOf( |
| 25 | + content { |
| 26 | + role = "user" |
| 27 | + text("I have never traveled before. When should I book a flight?") |
| 28 | + }, |
| 29 | + content { |
| 30 | + role = "model" |
| 31 | + text( |
| 32 | + "You should book flights a couple of months ahead of time." + |
| 33 | + " It will be cheaper and more flexible for you." |
| 34 | + ) |
| 35 | + }, |
| 36 | + content { |
| 37 | + role = "user" |
| 38 | + text("Do I need a passport?") |
| 39 | + }, |
| 40 | + content { |
| 41 | + role = "model" |
| 42 | + text( |
| 43 | + "If you are traveling outside your own country, make sure" + |
| 44 | + " your passport is up-to-date and valid for more" + |
| 45 | + " than 6 months during your travel." |
| 46 | + ) |
| 47 | + } |
| 48 | + ), |
| 49 | + initialPrompt = content { text("What else is important when traveling?") } |
| 50 | + ), |
| 51 | + Sample( |
| 52 | + title = "Chatbot recommendations for courses", |
| 53 | + description = "A chatbot suggests courses for a performing arts program.", |
| 54 | + navRoute = "chat", |
| 55 | + categories = listOf(Category.TEXT), |
| 56 | + systemInstructions = content { |
| 57 | + text( |
| 58 | + "You are a chatbot for the county's performing and fine arts" + |
| 59 | + " program. You help students decide what course they will" + |
| 60 | + " take during the summer." |
| 61 | + ) |
| 62 | + }, |
| 63 | + initialPrompt = content { |
| 64 | + text("I am interested in Performing Arts. I have taken Theater 1A.") |
| 65 | + } |
| 66 | + ), |
| 67 | + Sample( |
| 68 | + title = "Audio Summarization", |
| 69 | + description = "Summarize an audio file", |
| 70 | + navRoute = "chat", |
| 71 | + categories = listOf(Category.AUDIO), |
| 72 | + chatHistory = listOf( |
| 73 | + content { text("Can you help me summarize an audio file?") }, |
| 74 | + content("model") { |
| 75 | + text( |
| 76 | + "Of course! Click on the attach button" + |
| 77 | + " below and choose an audio file for me to summarize." |
| 78 | + ) |
| 79 | + } |
| 80 | + ), |
| 81 | + initialPrompt = content { |
| 82 | + text( |
| 83 | + "I have attached the audio file. Please analyze it and summarize the contents" + |
| 84 | + " of the audio as bullet points." |
| 85 | + ) |
| 86 | + } |
| 87 | + ), |
| 88 | + Sample( |
| 89 | + title = "Translation from audio", |
| 90 | + description = "Translate an audio file", |
| 91 | + navRoute = "chat", |
| 92 | + categories = listOf(Category.AUDIO), |
| 93 | + initialPrompt = content { |
| 94 | + fileData( |
| 95 | + "https://storage.googleapis.com/cloud-samples-data/generative-ai/audio/" + |
| 96 | + "How_to_create_a_My_Map_in_Google_Maps.mp3", |
| 97 | + "audio/mpeg" |
| 98 | + ) |
| 99 | + text("Please translate the audio to Mandarin.") |
| 100 | + } |
| 101 | + ), |
| 102 | + Sample( |
| 103 | + title = "Blog post creator", |
| 104 | + description = "Create a blog post from an image file.", |
| 105 | + navRoute = "chat", |
| 106 | + categories = listOf(Category.IMAGE), |
| 107 | + initialPrompt = content { |
| 108 | + fileData( |
| 109 | + "https://storage.googleapis.com/cloud-samples-data/generative-ai/image/meal-prep.jpeg", |
| 110 | + "image/jpeg" |
| 111 | + ) |
| 112 | + text( |
| 113 | + "Write a short, engaging blog post based on this picture." + |
| 114 | + " It should include a description of the meal in the" + |
| 115 | + " photo and talk about my journey meal prepping." |
| 116 | + ) |
| 117 | + } |
| 118 | + ), |
| 119 | + Sample( |
| 120 | + title = "Imagen 3 - image generation", |
| 121 | + description = "Generate images using Imagen 3", |
| 122 | + navRoute = "imagen", |
| 123 | + categories = listOf(Category.IMAGE), |
| 124 | + initialPrompt = content { |
| 125 | + text( |
| 126 | + "A photo of a modern building with water in the background" |
| 127 | + ) |
| 128 | + } |
| 129 | + ), |
| 130 | + Sample( |
| 131 | + title = "Gemini 2.0 Flash - image generation", |
| 132 | + description = "Generate and/or edit images using Gemini 2.0 Flash", |
| 133 | + navRoute = "chat", |
| 134 | + categories = listOf(Category.IMAGE), |
| 135 | + modelName = "gemini-2.0-flash-preview-image-generation", |
| 136 | + initialPrompt = content { |
| 137 | + text( |
| 138 | + "Hi, can you create a 3d rendered image of a pig " + |
| 139 | + "with wings and a top hat flying over a happy " + |
| 140 | + "futuristic scifi city with lots of greenery?" |
| 141 | + ) |
| 142 | + }, |
| 143 | + generationConfig = generationConfig { |
| 144 | + responseModalities = listOf(ResponseModality.TEXT, ResponseModality.IMAGE) |
| 145 | + } |
| 146 | + ), |
| 147 | + Sample( |
| 148 | + title = "Document comparison", |
| 149 | + description = "Compare the contents of 2 documents", |
| 150 | + navRoute = "chat", |
| 151 | + categories = listOf(Category.DOCUMENT), |
| 152 | + initialPrompt = content { |
| 153 | + fileData( |
| 154 | + "https://storage.googleapis.com/cloud-samples-data/generative-ai/pdf/form_1040_2013.pdf", |
| 155 | + "application/pdf" |
| 156 | + ) |
| 157 | + fileData( |
| 158 | + "https://storage.googleapis.com/cloud-samples-data/generative-ai/pdf/form_1040_2023.pdf", |
| 159 | + "application/pdf" |
| 160 | + ) |
| 161 | + text( |
| 162 | + "The first document is from 2013, and the second document is" + |
| 163 | + " from 2023. How did the standard deduction evolve?" |
| 164 | + ) |
| 165 | + } |
| 166 | + ), |
| 167 | + Sample( |
| 168 | + title = "Hashtags for a video", |
| 169 | + description = "Generate hashtags for a video ad", |
| 170 | + navRoute = "chat", |
| 171 | + categories = listOf(Category.VIDEO), |
| 172 | + initialPrompt = content { |
| 173 | + fileData( |
| 174 | + "https://storage.googleapis.com/cloud-samples-data/generative-ai/video/google_home_celebrity_ad.mp4", |
| 175 | + "video/mpeg" |
| 176 | + ) |
| 177 | + text( |
| 178 | + "Generate 5-10 hashtags that relate to the video content." + |
| 179 | + " Try to use more popular and engaging terms," + |
| 180 | + " e.g. #Viral. Do not add content not related to" + |
| 181 | + " the video.\n Start the output with 'Tags:'" |
| 182 | + ) |
| 183 | + } |
| 184 | + ), |
| 185 | + Sample( |
| 186 | + title = "Summarize video", |
| 187 | + description = "Summarize a video and extract important dialogue.", |
| 188 | + navRoute = "chat", |
| 189 | + categories = listOf(Category.VIDEO), |
| 190 | + chatHistory = listOf( |
| 191 | + content { text("Can you help me with the description of a video file?") }, |
| 192 | + content("model") { |
| 193 | + text( |
| 194 | + "Sure! Click on the attach button below and choose a" + |
| 195 | + " video file for me to describe." |
| 196 | + ) |
| 197 | + } |
| 198 | + ), |
| 199 | + initialPrompt = content { |
| 200 | + text( |
| 201 | + "I have attached the video file. Provide a description of" + |
| 202 | + " the video. The description should also contain" + |
| 203 | + " anything important which people say in the video." |
| 204 | + ) |
| 205 | + } |
| 206 | + ) |
| 207 | +) |
0 commit comments