Gemini.Types.Response.GenerateContentResponse (GeminiEx v0.8.2)

View Source

Response from content generation.

Summary

Functions

Extract text content from the response.

Get the finish reason from the first candidate.

Parse a generate content response from the API payload.

Get token usage information from the response.

Types

t()

@type t() :: %Gemini.Types.Response.GenerateContentResponse{
  candidates: [Gemini.Types.Response.Candidate.t()],
  create_time: DateTime.t() | nil,
  model_version: String.t() | nil,
  prompt_feedback: Gemini.Types.Response.PromptFeedback.t() | nil,
  response_id: String.t() | nil,
  usage_metadata: Gemini.Types.Response.UsageMetadata.t() | nil
}

Functions

extract_text(arg1)

@spec extract_text(t()) :: {:ok, String.t()} | {:error, String.t()}

Extract text content from the response.

finish_reason(arg1)

@spec finish_reason(t()) :: String.t() | nil

Get the finish reason from the first candidate.

from_api(data)

@spec from_api(map() | nil) :: t() | nil

Parse a generate content response from the API payload.

token_usage(arg1)

@spec token_usage(t()) :: map() | nil

Get token usage information from the response.