Geminix.V1beta.CountTokensRequest (geminix v0.2.0)
Counts the number of tokens in the prompt sent to a model. Models may tokenize text differently, so each model may return a different token_count.
Fields:
:contents(list ofGeminix.V1beta.Content.t/0) - Optional. The input given to the model as a prompt. This field is ignored whengenerate_content_requestis set.:generate_content_request(Geminix.V1beta.GenerateContentRequest.t/0) - Optional. The overall input given to theModel. This includes the prompt as well as other model steering information like system instructions, and/or function declarations for function calling.Models/Contents andgenerate_content_requests are mutually exclusive. You can either sendModel+Contents or agenerate_content_request, but never both.
Summary
Functions
Create a Geminix.V1beta.CountTokensRequest.t/0 from a map returned
by the Gemini API.
Types
@type t() :: %Geminix.V1beta.CountTokensRequest{ __meta__: term(), contents: [Geminix.V1beta.Content.t()], generate_content_request: Geminix.V1beta.GenerateContentRequest.t() }
Functions
@spec from_map(t(), map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
Create a Geminix.V1beta.CountTokensRequest.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.