|
2 | 2 |
|
3 | 3 | This Android sample app demonstrates how to use state-of-the-art |
4 | 4 | generative AI models (like Gemini) to build AI-powered features and applications. |
| 5 | + |
5 | 6 | For more information about Firebase AI Logic, visit the [documentation](http://firebase.google.com/docs/ai-logic). |
6 | 7 |
|
| 8 | +## Setup & Configuration |
| 9 | + |
| 10 | +### Prerequisites |
| 11 | +* **Google AI (Gemini) API Key**: Most samples work out of the box with the Google AI SDK. |
| 12 | +* **Vertex AI**: Samples marked with *(Vertex AI)* require you to enable the Vertex AI API in your Google Cloud project and have your files in Cloud Storage. |
| 13 | +* **Server Prompt Templates**: These samples require you to set up templates in the [Firebase Console](https://console.firebase.google.com/project/_/ai-logic). |
| 14 | + |
7 | 15 | ## Getting Started |
8 | 16 |
|
9 | 17 | To try out this sample app, you need to use latest stable version of Android Studio. |
10 | | -However, if you want to latest lint checks and AI productivity features in Android |
11 | | -Studio use the latest preview version of [Android Studio](https://developer.android.com/studio/preview). |
| 18 | + |
| 19 | +* [Set up your Android app for Firebase][setup-android] |
| 20 | + * Use the package name `com.google.firebase.quickstart.ai` |
| 21 | +* [Set up Firebase AI Logic][setup-ai-logic] |
| 22 | +* Run the app on an Android device or emulator. |
12 | 23 |
|
13 | 24 | ## Features |
14 | 25 |
|
15 | | -There are 2 main files that demonstrate the use of Firebase AI Logic: |
16 | | - |
17 | | -- [ChatViewModel.kt](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/ChatViewModel.kt) |
18 | | - which can do things such as: |
19 | | - - [Generate Text](https://firebase.google.com/docs/ai-logic/generate-text) |
20 | | - - [Generate structured output (JSON)](https://firebase.google.com/docs/ai-logic/generate-structured-output) |
21 | | - - [Analyze images](https://firebase.google.com/docs/ai-logic/analyze-images) |
22 | | - - [Analyze video](https://firebase.google.com/docs/ai-logic/analyze-video) |
23 | | - - [Analyze audio](https://firebase.google.com/docs/ai-logic/analyze-audio) |
24 | | - - [Analyze documents (PDFs)](https://firebase.google.com/docs/ai-logic/analyze-documents) |
25 | | - - [Generate images using Gemini 2.0](https://firebase.google.com/docs/ai-logic/generate-images-imagen) |
26 | | - - [Function calling](https://firebase.google.com/docs/ai-logic/function-calling) |
27 | | -- [ImagenViewModel](app/src/main/java/com/google/firebase/quickstart/ai/feature/media/imagen/ImagenViewModel.kt) |
28 | | - which shows how to [Generate images using Imagen models](https://firebase.google.com/docs/ai-logic/generate-images-imagen) |
| 26 | +You can find the implementation for each feature by clicking on the links below: |
| 27 | + |
| 28 | +### Text / Chat |
| 29 | +- [Travel tips](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/TravelTipsViewModel.kt): The user wants the model to help a new traveler with travel tips |
| 30 | +- [Chatbot recommendations for courses](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/CourseRecommendationsViewModel.kt): A chatbot suggests courses for a performing arts program. |
| 31 | +- [Weather Chat](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/WeatherChatViewModel.kt): Use function calling to get the weather conditions for a specific US city on a specific date. |
| 32 | +- [Grounding with Google Search](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/GoogleSearchGroundingViewModel.kt): Use Grounding with Google Search to get responses based on up-to-date information from the web. |
| 33 | +- [Thinking](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/ThinkingChatViewModel.kt): Gemini 2.5 Flash with dynamic thinking |
| 34 | +- [Server Prompt Templates - Gemini](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/ServerPromptTemplateViewModel.kt): Generate an invoice using server prompt templates. |
| 35 | + |
| 36 | +### Image analysis / generation |
| 37 | +- [Imagen 4 - image generation](app/src/main/java/com/google/firebase/quickstart/ai/feature/media/imagen/ImagenGenerationViewModel.kt): Generate images using Imagen 4 |
| 38 | +- [Imagen 3 - Inpainting (Vertex AI)](app/src/main/java/com/google/firebase/quickstart/ai/feature/media/imagen/ImagenInpaintingViewModel.kt): Replace part of an image using Imagen 3 |
| 39 | +- [Imagen 3 - Outpainting (Vertex AI)](app/src/main/java/com/google/firebase/quickstart/ai/feature/media/imagen/ImagenOutpaintingViewModel.kt): Expand an image by drawing in more background |
| 40 | +- [Imagen 3 - Subject Reference (Vertex AI)](app/src/main/java/com/google/firebase/quickstart/ai/feature/media/imagen/ImagenSubjectReferenceViewModel.kt): Generate an image using a referenced subject (must be an animal) |
| 41 | +- [Imagen 3 - Style Transfer (Vertex AI)](app/src/main/java/com/google/firebase/quickstart/ai/feature/media/imagen/ImagenStyleTransferViewModel.kt): Change the art style of a cat picture using a reference |
| 42 | +- [Gemini 2.5 Flash Image (aka nanobanana)](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/ImageGenerationViewModel.kt): Generate and/or edit images using Gemini 2.5 Flash Image aka nanobanana |
| 43 | +- [Server Prompt Template - Imagen](app/src/main/java/com/google/firebase/quickstart/ai/feature/media/imagen/ImagenTemplateViewModel.kt): Generate an image using a server prompt template. |
| 44 | +- [SVG Generator](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/SvgViewModel.kt): Use Gemini 3 Flash preview to create SVG illustrations |
| 45 | +- [Blog post creator (Vertex AI)](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/ImageBlogCreatorViewModel.kt): Create a blog post from an image file stored in Cloud Storage. |
| 46 | + |
| 47 | +### Audio analysis |
| 48 | +- [Audio Summarization](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/AudioSummarizationViewModel.kt): Summarize an audio file |
| 49 | +- [Translation from audio (Vertex AI)](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/AudioTranslationViewModel.kt): Translate an audio file stored in Cloud Storage |
| 50 | + |
| 51 | +### Video analysis |
| 52 | +- [Hashtags for a video (Vertex AI)](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/VideoHashtagGeneratorViewModel.kt): Generate hashtags for a video ad stored in Cloud Storage |
| 53 | +- [Summarize video](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/VideoSummarizationViewModel.kt): Summarize a video and extract important dialogue. |
| 54 | + |
| 55 | +### Live API (Real-time bidrectional streaming) |
| 56 | +- [ForecastTalk](app/src/main/java/com/google/firebase/quickstart/ai/feature/live/StreamAudioViewModel.kt): Use bidirectional streaming to get information about weather conditions |
| 57 | +- [Gemini Live (Video input)](app/src/main/java/com/google/firebase/quickstart/ai/feature/live/StreamVideoViewModel.kt): Use bidirectional streaming to chat with Gemini using your phone's camera |
| 58 | + |
| 59 | +### Document (PDFs) analysis |
| 60 | +- [Document comparison (Vertex AI)](app/src/main/java/com/google/firebase/quickstart/ai/feature/text/DocumentComparisonViewModel.kt): Compare the contents of 2 documents in Cloud Storage. |
| 61 | + |
29 | 62 |
|
30 | 63 | ## All samples |
31 | 64 |
|
32 | 65 | The full list of available samples can be found in the |
33 | | -[FirebaseAISamples.kt file](app/src/main/java/com/google/firebase/quickstart/ai/FirebaseAISamples.kt). |
| 66 | +[FirebaseAISamples.kt file](app/src/main/java/com/google/firebase/quickstart/ai/ui/navigation/FirebaseAISamples.kt). |
| 67 | + |
| 68 | +[setup-android]: https://firebase.google.com/docs/android/setup |
| 69 | +[setup-ai-logic]: https://firebase.google.com/docs/ai-logic/get-started?api=dev#set-up-firebase |
0 commit comments