Geminix.V1beta.GenerateContentRequest (geminix v0.2.0)

Request to generate a completion from the model.

Fields:

  • :cached_content (binary/0) - Optional. The name of the content cached to use as context to serve the prediction. Format: cachedContents/{cachedContent}
  • :contents (list of Geminix.V1beta.Content.t/0) - Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries like chat, this is a repeated field that contains the conversation history and the latest request.
  • :generation_config (Geminix.V1beta.GenerationConfig.t/0) - Optional. Configuration options for model generation and outputs.
  • :model (binary/0) - Required. The name of the Model to use for generating the completion. Format: models/{model}.
  • :safety_settings (list of Geminix.V1beta.SafetySetting.t/0) - Optional. A list of unique SafetySetting instances for blocking unsafe content. This will be enforced on the GenerateContentRequest.contents and GenerateContentResponse.candidates. There should not be more than one setting for each SafetyCategory type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each SafetyCategory specified in the safety_settings. If there is no SafetySetting for a given SafetyCategory provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT, HARM_CATEGORY_CIVIC_INTEGRITY are supported. Refer to the guide for detailed information on available safety settings. Also refer to the Safety guidance to learn how to incorporate safety considerations in your AI applications.
  • :system_instruction (Geminix.V1beta.Content.t/0) - Optional. Developer set system instruction(s). Currently, text only.
  • :tool_config (Geminix.V1beta.ToolConfig.t/0) - Optional. Tool configuration for any Tool specified in the request. Refer to the Function calling guide for a usage example.
  • :tools (list of Geminix.V1beta.Tool.t/0) - Optional. A list of Tools the Model may use to generate the next response. A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the Model. Supported Tools are Function and code_execution. Refer to the Function calling and the Code execution guides to learn more.

Summary

Types

t()

@type t() :: %Geminix.V1beta.GenerateContentRequest{
  __meta__: term(),
  cached_content: binary(),
  contents: [Geminix.V1beta.Content.t()],
  generation_config: Geminix.V1beta.GenerationConfig.t(),
  model: binary(),
  safety_settings: [Geminix.V1beta.SafetySetting.t()],
  system_instruction: Geminix.V1beta.Content.t(),
  tool_config: Geminix.V1beta.ToolConfig.t(),
  tools: [Geminix.V1beta.Tool.t()]
}

Functions

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

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

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