google-gemini / generative-ai-swift

The official Swift library for the Google Gemini API

Home Page:https://ai.google.dev/gemini-api/docs/get-started/tutorial?lang=swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Access gemini-1.5-pro-latest

mobilinked opened this issue · comments

Description of the feature request:

As the title, to access the gemini-1.5-pro-latest model

What problem are you trying to solve with this feature?

Get fatal error when using model of gemini-1.5-pro-latest


Error raised at top level: GoogleGenerativeAI.GenerateContentError.internalError(underlying: GoogleGenerativeAI.RPCError(httpResponseCode: 404, message: "models/gemini-1.5-pro-latest is not found for API version v1, or is not supported for GenerateContent. Call ListModels to see the list of available models and their supported methods.", status: GoogleGenerativeAI.RPCStatus.notFound, details: []))

Any other information you'd like to share?

No response

Hi @mobilinked, at the moment I'm only seeing gemini-1.5-pro-latest on the v1beta version of the API. Would you mind trying that version instead (see RequestOptions in the snippet below to switch from the default v1)?

let model = GenerativeModel(
  name: "gemini-1.5-pro-latest",
  apiKey: APIKey.default,
  requestOptions: RequestOptions(apiVersion: "v1beta")
)

It works. Thanks much.