Geminix.V1beta.UsageMetadata (geminix v0.2.0)

Metadata on the generation request's token usage.

Fields:

  • :cache_tokens_details (list of Geminix.V1beta.ModalityTokenCount.t/0) - Output only. List of modalities of the cached content in the request input.
  • :cached_content_token_count (integer/0) - Number of tokens in the cached part of the prompt (the cached content)
  • :candidates_token_count (integer/0) - Total number of tokens across all the generated response candidates.
  • :candidates_tokens_details (list of Geminix.V1beta.ModalityTokenCount.t/0) - Output only. List of modalities that were returned in the response.
  • :prompt_token_count (integer/0) - Number of tokens in the prompt. When cached_content is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content.
  • :prompt_tokens_details (list of Geminix.V1beta.ModalityTokenCount.t/0) - Output only. List of modalities that were processed in the request input.
  • :thoughts_token_count (integer/0) - Output only. Number of tokens of thoughts for thinking models.
  • :tool_use_prompt_token_count (integer/0) - Output only. Number of tokens present in tool-use prompt(s).
  • :tool_use_prompt_tokens_details (list of Geminix.V1beta.ModalityTokenCount.t/0) - Output only. List of modalities that were processed for tool-use request inputs.
  • :total_token_count (integer/0) - Total token count for the generation request (prompt + response candidates).

Summary

Types

t()

@type t() :: %Geminix.V1beta.UsageMetadata{
  __meta__: term(),
  cache_tokens_details: [Geminix.V1beta.ModalityTokenCount.t()],
  cached_content_token_count: integer(),
  candidates_token_count: integer(),
  candidates_tokens_details: [Geminix.V1beta.ModalityTokenCount.t()],
  prompt_token_count: integer(),
  prompt_tokens_details: [Geminix.V1beta.ModalityTokenCount.t()],
  thoughts_token_count: integer(),
  tool_use_prompt_token_count: integer(),
  tool_use_prompt_tokens_details: [Geminix.V1beta.ModalityTokenCount.t()],
  total_token_count: integer()
}

Functions

from_map(schema \\ %__MODULE__{}, map)

@spec from_map(t(), map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}

Create a Geminix.V1beta.UsageMetadata.t/0 from a map returned by the Gemini API.

Sometimes, this function should not be applied to the full response body, but instead it should be applied to the correct part of the map in the response body. This depends on the concrete API call.