From 36eac4f4eb87b33c2d829ab5a4c4f1e0ccd6d151 Mon Sep 17 00:00:00 2001 From: Ryan Wilson Date: Wed, 13 Dec 2023 09:52:02 -0500 Subject: [PATCH] Update README.md (#8) --- README.md | 64 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index ea401a43..d3b1b5d4 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,62 @@ # Google AI SDK for Android -> [!IMPORTANT] -> Thanks for your interest in the Google AI SDKs! **You can start using this SDK and its samples on -> December 13, 2023.** Until then, check out our -> [blog post](https://blog.google/technology/ai/google-gemini-ai/) to learn more about Google's -> Gemini multimodal model. +The Google AI client SDK for Android enables developers to use Google's state-of-the-art generative AI models (like Gemini) to build AI-powered features and applications. This SDK supports use cases like: +- Generate text from text-only input +- Generate text from text-and-images input (multimodal) +- Build multi-turn conversations (chat) -The Google AI SDK for Android enables developers to use Google's state-of-the-art generative AI -models (like Gemini) to build AI-powered features and applications. +For example, with just a few lines of code, you can access Gemini's multimodal capabilities to generate text from text-and-image input: -*More details and information coming soon!* +``` +val generativeModel = GenerativeModel( + modelName = "gemini-pro-vision", + apiKey = BuildConfig.apiKey +) + +val cookieImage: Bitmap = // ... +val inputContent = content() { + image(cookieImage) + text("Does this look store-bought or homemade?") +} + +val response = generativeModel.generateContent(inputContent) +print(response.text) +``` > [!NOTE] -> If you want to access Gemini on-device (Gemini Nano), check out the -> [Google AI Edge SDK for Android](https://android-developers.googleblog.com/2023/12/a-new-foundation-for-ai-on-android.html), -> which is enabled via Android AICore. +> If you want to access Gemini on-device (Gemini Nano), check out the [Google AI Edge SDK for Android](https://ai.google.dev/tutorials/android_aicore), which is enabled via Android AICore. + +## Try out the sample Android app + +This repository contains a sample app demonstrating how the SDK can access and utilize the Gemini model for various use cases. + +To try out the sample app, follow these steps: + +1. Check out this repository.\ +`git clone https://github.com/google/generative-ai-android` + +1. [Obtain an API key](https://makersuite.google.com/app/apikey) to use with the Google AI SDKs. + +1. Open and build the sample app in the `generativeai-android-sample` folder of this repo. + +1. Paste your API key into the `apiKey` property in the `local.properties` file. + +1. Run the app. + +## Installation and usage + +Add the dependency `implementation("com.google.ai.client.generativeai:generativeai:"`) to your Android project. + +For detailed instructions, you can find a [quickstart](https://ai.google.dev/tutorials/android_quickstart) for the Google AI client SDK for Android in the Google documentation. + +This quickstart describes how to add your API key and the SDK's dependency to your app, initialize the model, and then call the API to access the model. It also describes some additional use cases and features, like streaming, counting tokens, and controlling responses. +## Documentation + +Find complete documentation for the Google AI SDKs and the Gemini model in the Google documentation:\ +https://ai.google.dev/docs +## Contributing + +See [Contributing](https://github.com/google/generative-ai-android/blob/main/CONTRIBUTING.md) for more information on contributing to the Google AI client SDK for Android. ## License