Gemini.Types.ToolSerialization (GeminiEx v0.7.2)
View SourcePure data transformation utilities to serialize ALTAR ADM tool structures into the exact JSON maps expected by the Gemini API.
- Converts snake_case atom keys to camelCase string keys
- Shapes
FunctionDeclarationinto the correctToollist payload - Shapes
ToolConfiginto%{functionCallingConfig: %{...}}
Summary
Functions
Convert ADM ToolConfig into Gemini API toolConfig map.
Convert a list of ADM FunctionDeclaration structs into a Gemini API tools list.
Types
Functions
@spec to_api_tool_config(Altar.ADM.ToolConfig.t()) :: api_tool_config()
Convert ADM ToolConfig into Gemini API toolConfig map.
Input: %ToolConfig{mode: :auto | :any | :none, function_names: ["..."]}
Output: %{ functionCallingConfig: %{
mode: "AUTO" | "ANY" | "NONE",
allowedFunctionNames: ["..."] # present only when non-empty} }
@spec to_api_tool_list([Altar.ADM.FunctionDeclaration.t()]) :: api_tool_list()
Convert a list of ADM FunctionDeclaration structs into a Gemini API tools list.
Output shape (each entry): %{ "functionDeclarations" => [
%{
"name" => String.t(),
"description" => String.t(),
"parameters" => map() # OpenAPI-like schema map, passed through as-is
}] }