Geminix.V1beta.CountMessageTokensResponse (geminix v0.2.0)

A response from CountMessageTokens. It returns the model's token_count for the prompt.

Fields:

  • :token_count (integer/0) - The number of tokens that the model tokenizes the prompt into. Always non-negative.

Summary

Types

t()

@type t() :: %Geminix.V1beta.CountMessageTokensResponse{
  __meta__: term(),
  token_count: integer()
}

Functions

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

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

Create a Geminix.V1beta.CountMessageTokensResponse.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.