Geminix.V1beta.FunctionDeclaration (geminix v0.2.0)

Structured representation of a function declaration as defined by the OpenAPI 3.03 specification. Included in this declaration are the function name and parameters. This FunctionDeclaration is a representation of a block of code that can be used as a Tool by the model and executed by the client.

Fields:

  • :behavior (binary/0) - Optional. Specifies the function Behavior. Currently only supported by the BidiGenerateContent method.
  • :description (binary/0) - Required. A brief description of the function.
  • :name (binary/0) - Required. The name of the function. Must be a-z, A-Z, 0-9, or contain underscores, colons, dots, and dashes, with a maximum length of 64.
  • :parameters (Geminix.V1beta.Schema.t/0) - Optional. Describes the parameters to this function. Reflects the Open API 3.03 Parameter Object string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter.
  • :parameters_json_schema (any/0) - Optional. Describes the parameters to the function in JSON Schema format. The schema must describe an object where the properties are the parameters to the function. For example: { "type": "object", "properties": { "name": { "type": "string" }, "age": { "type": "integer" } }, "additionalProperties": false, "required": ["name", "age"], "propertyOrdering": ["name", "age"] } This field is mutually exclusive with parameters.
  • :response (Geminix.V1beta.Schema.t/0) - Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function.
  • :response_json_schema (any/0) - Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function. This field is mutually exclusive with response.

Summary

Types

t()

@type t() :: %Geminix.V1beta.FunctionDeclaration{
  __meta__: term(),
  behavior: binary(),
  description: binary(),
  name: binary(),
  parameters: Geminix.V1beta.Schema.t(),
  parameters_json_schema: any(),
  response: Geminix.V1beta.Schema.t(),
  response_json_schema: any()
}

Functions

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

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

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