Geminix.V1beta.FunctionResponse (geminix v0.2.0)

The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of aFunctionCall made based on model prediction.

Fields:

  • :id (binary/0) - Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call id.
  • :name (binary/0) - Required. The name of the function to call. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
  • :parts (list of Geminix.V1beta.FunctionResponsePart.t/0) - Optional. Ordered Parts that constitute a function response. Parts may have different IANA MIME types.
  • :response (map/0) - Required. The function response in JSON object format. Callers can use any keys of their choice that fit the function's syntax to return the function output, e.g. "output", "result", etc. In particular, if the function call failed to execute, the response can have an "error" key to return error details to the model.
  • :scheduling (binary/0) - Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE.
  • :will_continue (boolean/0) - Optional. Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. It is allowed to return empty response with will_continue=False to signal that the function call is finished. This may still trigger the model generation. To avoid triggering the generation and finish the function call, additionally set scheduling to SILENT.

Summary

Types

t()

@type t() :: %Geminix.V1beta.FunctionResponse{
  __meta__: term(),
  id: binary(),
  name: binary(),
  parts: [Geminix.V1beta.FunctionResponsePart.t()],
  response: map(),
  scheduling: binary(),
  will_continue: boolean()
}

Functions

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

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

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