Geminix.V1beta.GenerateContentResponse (geminix v0.2.0)

Response from the model supporting multiple candidate responses. Safety ratings and content filtering are reported for both prompt in GenerateContentResponse.prompt_feedback and for each candidate in finish_reason and in safety_ratings. The API: - Returns either all requested candidates or none of them - Returns no candidates at all only if there was something wrong with the prompt (check prompt_feedback) - Reports feedback on each candidate in finish_reason and safety_ratings.

Fields:

Summary

Functions

Extract the text from a response.

Extract the text from a response.

Types

t()

@type t() :: %Geminix.V1beta.GenerateContentResponse{
  __meta__: term(),
  candidates: [Geminix.V1beta.Candidate.t()],
  model_status: Geminix.V1beta.ModelStatus.t(),
  model_version: binary(),
  prompt_feedback: Geminix.V1beta.PromptFeedback.t(),
  response_id: binary(),
  usage_metadata: Geminix.V1beta.UsageMetadata.t()
}

Functions

extract_text(response)

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

Extract the text from a response.

extract_text!(response)

@spec extract_text!(t()) :: binary()

Extract the text from a response.

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

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

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