From 9476b4fd3a9bfb579ae502210521258c5fa013c2 Mon Sep 17 00:00:00 2001 From: Rodrigo Lazo Date: Fri, 19 Apr 2024 11:59:21 -0400 Subject: [PATCH] Make v1beta the default api version (#123) Also, update the README to use gemini-1.5-pro-latest --- README.md | 6 +++--- .../google/ai/client/generativeai/common/RequestOptions.kt | 4 ++-- .../google/ai/client/generativeai/type/RequestOptions.kt | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 622b823a..0d18467f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ For example, with just a few lines of code, you can access Gemini's multimodal c ```kotlin val generativeModel = GenerativeModel( - modelName = "gemini-1.0-pro-vision-latest", + modelName = "gemini-1.5-pro-latest", apiKey = BuildConfig.apiKey ) @@ -30,7 +30,7 @@ print(response.text) 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 you can directly import the project from Android Studio +To try out the sample app you can directly import the project from Android Studio via **File > New > Import Sample** and searching for *Generative AI Sample* or follow these steps below: 1. Check out this repository.\ @@ -38,7 +38,7 @@ via **File > New > Import Sample** and searching for *Generative AI Sample* or f 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. 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. diff --git a/common/src/main/kotlin/com/google/ai/client/generativeai/common/RequestOptions.kt b/common/src/main/kotlin/com/google/ai/client/generativeai/common/RequestOptions.kt index e9ab3a9f..b1da0e49 100644 --- a/common/src/main/kotlin/com/google/ai/client/generativeai/common/RequestOptions.kt +++ b/common/src/main/kotlin/com/google/ai/client/generativeai/common/RequestOptions.kt @@ -30,13 +30,13 @@ import kotlin.time.toDuration */ class RequestOptions( val timeout: Duration, - val apiVersion: String = "v1", + val apiVersion: String = "v1beta", val endpoint: String = "https://generativelanguage.googleapis.com", ) { @JvmOverloads constructor( timeout: Long? = HttpTimeout.INFINITE_TIMEOUT_MS, - apiVersion: String = "v1", + apiVersion: String = "v1beta", endpoint: String = "https://generativelanguage.googleapis.com", ) : this( (timeout ?: HttpTimeout.INFINITE_TIMEOUT_MS).toDuration(DurationUnit.MILLISECONDS), diff --git a/generativeai/src/main/java/com/google/ai/client/generativeai/type/RequestOptions.kt b/generativeai/src/main/java/com/google/ai/client/generativeai/type/RequestOptions.kt index a2470ef2..b12a5cbb 100644 --- a/generativeai/src/main/java/com/google/ai/client/generativeai/type/RequestOptions.kt +++ b/generativeai/src/main/java/com/google/ai/client/generativeai/type/RequestOptions.kt @@ -29,12 +29,12 @@ import kotlin.time.toDuration */ class RequestOptions( val timeout: Duration, - val apiVersion: String = "v1", + val apiVersion: String = "v1beta", ) { @JvmOverloads constructor( timeout: Long? = Long.MAX_VALUE, - apiVersion: String = "v1", + apiVersion: String = "v1beta", ) : this( (timeout ?: Long.MAX_VALUE).toDuration(DurationUnit.MILLISECONDS), apiVersion,