{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://www.anguskit.com/schema/angusmeter/plugins/angus-gemini.json",
  "title": "Google Gemini LLM Plugin Configuration",
  "description": "Google Gemini generateContent 采样配置",
  "type": "object",
  "required": [
    "messages"
  ],
  "additionalProperties": false,
  "properties": {
    "model": {
      "type": "string",
      "description": "模型标识；为空时插件使用各自的默认模型",
      "default": "gemini-2.5-flash"
    },
    "messages": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "additionalProperties": false,
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "user",
              "assistant",
              "tool"
            ],
            "description": "消息角色"
          },
          "content": {
            "type": "string",
            "description": "消息文本内容（支持 ${var} 插值）"
          },
          "name": {
            "type": "string",
            "description": "可选：tool/function 调用场景下的名称"
          },
          "toolCallId": {
            "type": "string",
            "description": "可选：tool 角色回复关联的调用 ID"
          }
        }
      },
      "description": "有序对话消息列表"
    },
    "temperature": {
      "type": "number",
      "minimum": 0,
      "maximum": 2,
      "default": 0.7,
      "description": "采样温度"
    },
    "maxTokens": {
      "type": "integer",
      "minimum": 1,
      "default": 4096,
      "description": "最大生成 token 数"
    },
    "topP": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "default": 1,
      "description": "nucleus 采样概率"
    },
    "frequencyPenalty": {
      "type": "number",
      "minimum": -2,
      "maximum": 2,
      "default": 0,
      "description": "频率惩罚（部分供应商不支持）"
    },
    "presencePenalty": {
      "type": "number",
      "minimum": -2,
      "maximum": 2,
      "default": 0,
      "description": "出现惩罚（部分供应商不支持）"
    },
    "stop": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 10,
      "description": "停止序列列表"
    },
    "responseFormat": {
      "type": "string",
      "enum": [
        "text",
        "json"
      ],
      "default": "text",
      "description": "响应格式；json 要求兼容 JSON mode"
    },
    "timeout": {
      "type": "integer",
      "minimum": 1,
      "default": 60,
      "description": "请求超时（秒）"
    },
    "maxRetries": {
      "type": "integer",
      "minimum": 0,
      "default": 2,
      "description": "最大重试次数"
    },
    "stream": {
      "type": "boolean",
      "default": false,
      "description": "是否启用 SSE 流式输出"
    },
    "baseUrl": {
      "type": "string",
      "format": "uri",
      "description": "API 基地址覆盖",
      "default": "https://generativelanguage.googleapis.com/v1beta"
    },
    "apiKey": {
      "type": "string",
      "writeOnly": true,
      "description": "API 密钥；推荐通过环境变量 GEMINI_API_KEY 注入"
    },
    "extraParams": {
      "type": "object",
      "additionalProperties": true,
      "description": "透传给底层 API 的扩展参数"
    },
    "tools": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      },
      "description": "OpenAI 兼容的 tools 数组（function/tool 描述）"
    },
    "toolChoice": {
      "description": "tool_choice：auto/none/required 或 {\"type\":\"function\",\"function\":{\"name\":\"...\"}}",
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "auto",
            "none",
            "required"
          ]
        },
        {
          "type": "object",
          "additionalProperties": true
        }
      ]
    }
  }
}
