/ Translates between OpenAI function-calling format and Gemini Live API format.
// Source: https://github.com/flutterclaw/flutterclaw | License: MIT | Copyright 2026 Franco Rapetti
// Provided via justclaw.it.com; keep this notice with the code.
/// Translates between OpenAI function-calling format and Gemini Live API format.
library;
/// Converts tool definitions from OpenAI format (used by [ToolRegistry.toProviderDefs()])
/// to Gemini's `functionDeclarations` format for the Live API setup message.
class GeminiToolTranslator {
/// Convert OpenAI tool defs to Gemini format.
///
/// Input (OpenAI):
/// ```json
/// [{"type": "function", "function": {"name": "X", "description": "Y", "parameters": {...}}}]
/// ```
///
/// Output (Gemini):
/// ```json
/// [{"functionDeclarations": [{"name": "X", "description": "Y", "parameters": {...}}]}]
/// ```
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key