ExLLM.Providers.Gemini.Models (ex_llm v0.8.1)

View Source

Google Gemini Models API implementation.

Provides functionality to list available models and retrieve model metadata including token limits, supported features, and generation parameters.

Summary

Functions

Gets information about a specific model.

Lists available Gemini models.

Types

list_response()

@type list_response() :: %{
  models: [ExLLM.Providers.Gemini.Models.Model.t()],
  next_page_token: String.t() | nil
}

options()

@type options() :: [
  page_size: integer(),
  page_token: String.t(),
  config_provider: pid() | atom()
]

Functions

get_model(model_name, opts \\ [])

@spec get_model(String.t() | nil, Keyword.t()) ::
  {:ok, ExLLM.Providers.Gemini.Models.Model.t()} | {:error, term()}

Gets information about a specific model.

Parameters

  • model_name - The model name (e.g., "gemini-2.0-flash")
  • opts - Options including :config_provider

Examples

{:ok, model} = ExLLM.Providers.Gemini.Models.get_model("gemini-2.0-flash")

list_models(opts \\ [])

@spec list_models(options()) :: {:ok, list_response()} | {:error, term()}

Lists available Gemini models.

Options

  • :page_size - Maximum number of models to return (max 1000)
  • :page_token - Token for retrieving the next page
  • :config_provider - Configuration provider (defaults to Application config)

Examples

# List all models
{:ok, response} = ExLLM.Providers.Gemini.Models.list_models()

# List with pagination
{:ok, response} = ExLLM.Providers.Gemini.Models.list_models(page_size: 10)

# Get next page
{:ok, next_page} = ExLLM.Providers.Gemini.Models.list_models(page_token: response.next_page_token)