Geminix.V1beta.Content (geminix v0.2.0)

The base structured datatype containing multi-part content of a message. A Content includes a role field designating the producer of the Content and a parts field containing multi-part data that contains the content of the message turn.

Fields:

  • :parts (list of Geminix.V1beta.Part.t/0) - Ordered Parts that constitute a single message. Parts may have different MIME types.
  • :role (binary/0) - Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.

Summary

Types

t()

@type t() :: %Geminix.V1beta.Content{
  __meta__: term(),
  parts: [Geminix.V1beta.Part.t()],
  role: binary()
}

Functions

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

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

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

from_text(text)