Geminix.V1beta.MessagePrompt (geminix v0.2.0)
All of the structured input text passed to the model as a prompt. A MessagePrompt contains a structured set of fields that provide context for the conversation, examples of user input/model output message pairs that prime the model to respond in different ways, and the conversation history or list of messages representing the alternating turns of the conversation between the user and the model.
Fields:
:context(binary/0) - Optional. Text that should be provided to the model first to ground the response. If not empty, thiscontextwill be given to the model first before theexamplesandmessages. When using acontextbe sure to provide it with every request to maintain continuity. This field can be a description of your prompt to the model to help provide context and guide the responses. Examples: "Translate the phrase from English to French." or "Given a statement, classify the sentiment as happy, sad or neutral." Anything included in this field will take precedence over message history if the total input size exceeds the model'sinput_token_limitand the input request is truncated.:examples(list ofGeminix.V1beta.Example.t/0) - Optional. Examples of what the model should generate. This includes both user input and the response that the model should emulate. Theseexamplesare treated identically to conversation messages except that they take precedence over the history inmessages: If the total input size exceeds the model'sinput_token_limitthe input will be truncated. Items will be dropped frommessagesbeforeexamples.:messages(list ofGeminix.V1beta.Message.t/0) - Required. A snapshot of the recent conversation history sorted chronologically. Turns alternate between two authors. If the total input size exceeds the model'sinput_token_limitthe input will be truncated: The oldest items will be dropped frommessages.
Summary
Functions
Create a Geminix.V1beta.MessagePrompt.t/0 from a map returned
by the Gemini API.
Types
@type t() :: %Geminix.V1beta.MessagePrompt{ __meta__: term(), context: binary(), examples: [Geminix.V1beta.Example.t()], messages: [Geminix.V1beta.Message.t()] }
Functions
@spec from_map(t(), map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
Create a Geminix.V1beta.MessagePrompt.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.