Gemini.Types.Response.Model (GeminiEx v0.2.1)

View Source

Model information response structure.

Represents the complete model metadata returned by the Gemini API, including capabilities, token limits, and generation parameters.

Summary

Types

Model capability level based on features and limits

Token capacity classification

t()

Functions

Generate a comprehensive capabilities summary.

Calculate a capability score for model comparison.

Compare two models by capability.

Get the effective base model ID.

Check if model has advanced generation parameters.

Classify model's input token capacity.

Check if this appears to be the latest version of a model.

Extract model family from the base model ID.

Classify model's output token capacity.

Determine if model is suitable for production use.

Check if model supports embeddings.

Check if model supports a specific generation method.

Check if model supports streaming content generation.

Check if model supports token counting.

Types

capability_level()

@type capability_level() :: :basic | :standard | :advanced | :premium

Model capability level based on features and limits

capacity_tier()

@type capacity_tier() :: :small | :medium | :large | :very_large

Token capacity classification

t()

@type t() :: %Gemini.Types.Response.Model{
  base_model_id: String.t(),
  description: String.t(),
  display_name: String.t(),
  input_token_limit: integer(),
  max_temperature: float() | nil,
  name: String.t(),
  output_token_limit: integer(),
  supported_generation_methods: [String.t()],
  temperature: float() | nil,
  top_k: integer() | nil,
  top_p: float() | nil,
  version: String.t()
}

Functions

capabilities_summary(model)

@spec capabilities_summary(t()) :: map()

Generate a comprehensive capabilities summary.

Example Response

%{
  supports_streaming: true,
  supports_token_counting: true,
  supports_embeddings: false,
  has_temperature: true,
  has_top_k: true,
  has_top_p: false,
  method_count: 3,
  input_capacity: :very_large,
  output_capacity: :medium
}

capability_score(model)

@spec capability_score(t()) :: integer()

Calculate a capability score for model comparison.

Higher scores indicate more capable models.

compare_capabilities(model1, model2)

@spec compare_capabilities(t(), t()) :: :lt | :eq | :gt

Compare two models by capability.

Returns :lt, :eq, or :gt based on capability scores.

effective_base_id(model)

@spec effective_base_id(t()) :: String.t()

Get the effective base model ID.

Prefers the base_model_id field, but falls back to extracting from the name if base_model_id is nil.

Examples

iex> Model.effective_base_id(%Model{base_model_id: "gemini-2.0-flash-lite"})
"gemini-2.0-flash-lite"

iex> Model.effective_base_id(%Model{name: "models/gemini-2.5-pro", base_model_id: nil})
"gemini-2.5-pro"

has_advanced_params?(model)

@spec has_advanced_params?(t()) :: boolean()

Check if model has advanced generation parameters.

Returns true if the model supports temperature, top_p, or top_k parameters.

input_capacity_tier(model)

@spec input_capacity_tier(t()) :: capacity_tier()

Classify model's input token capacity.

Examples

iex> Model.input_capacity_tier(%Model{input_token_limit: 2_000_000})
:very_large

iex> Model.input_capacity_tier(%Model{input_token_limit: 30_000})
:medium

latest_version?(model)

@spec latest_version?(t()) :: boolean()

Check if this appears to be the latest version of a model.

Heuristic based on name patterns (no version suffix, "latest" in name).

model_family(model)

@spec model_family(t()) :: String.t()

Extract model family from the base model ID.

Examples

iex> Model.model_family(%Model{base_model_id: "gemini-2.0-flash-lite"})
"gemini"

iex> Model.model_family(%Model{base_model_id: "text-embedding-004"})
"text"

output_capacity_tier(model)

@spec output_capacity_tier(t()) :: capacity_tier()

Classify model's output token capacity.

production_ready?(model)

@spec production_ready?(t()) :: boolean()

Determine if model is suitable for production use.

Based on capability, capacity, and stability indicators.

supports_embeddings?(model)

@spec supports_embeddings?(t()) :: boolean()

Check if model supports embeddings.

supports_method?(model, method)

@spec supports_method?(t(), String.t()) :: boolean()

Check if model supports a specific generation method.

Examples

iex> Model.supports_method?(model, "generateContent")
true

iex> Model.supports_method?(model, "nonexistentMethod")
false

supports_streaming?(model)

@spec supports_streaming?(t()) :: boolean()

Check if model supports streaming content generation.

supports_token_counting?(model)

@spec supports_token_counting?(t()) :: boolean()

Check if model supports token counting.