函数调用

POST /v1beta/models/gemini-2.5-pro:generateContent

MethodPOST
Path/v1beta/models/gemini-2.5-pro:generateContent
Typehttp
Status1
Module2102810
Folder61214320

说明

概览

MethodPOST
Path/v1beta/models/gemini-2.5-pro:generateContent
Typehttp
Status1
Module2102810
Folder61214320

参数

{
  "query": [
    {
      "name": "key",
      "required": true,
      "description": "",
      "id": "fNkAG1L7Ct",
      "type": "string",
      "enable": true,
      "sampleValue": "{{YOUR_API_KEY}}"
    }
  ],
  "header": [
    {
      "name": "Content-Type",
      "required": true,
      "description": "",
      "id": "DxzZ9GHHTb",
      "type": "string",
      "enable": true,
      "sampleValue": "application/json"
    }
  ]
}

请求体

{
  "type": "application/json",
  "parameters": [],
  "jsonSchema": {
    "type": "object",
    "properties": {
      "contents": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "parts": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string"
                  },
                  "inline_data": {
                    "type": "object",
                    "properties": {
                      "mime_type": {
                        "type": "string"
                      },
                      "data": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "mime_type",
                      "data"
                    ]
                  }
                },
                "required": []
              }
            }
          }
        }
      },
      "generationConfig": {
        "type": "object",
        "properties": {
          "responseModalities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "responseModalities"
        ]
      }
    },
    "required": [
      "contents",
      "generationConfig"
    ]
  },
  "required": false,
  "mediaType": "",
  "examples": [
    {
      "mediaType": "application/json",
      "value": "{\n    \"contents\": [\n      {\n        \"role\": \"user\",\n        \"parts\": [\n          {\n            \"text\": \"Schedule a meeting with Bob and Alice for 03/27/2025 at 10:00 AM about the Q3 planning.\"\n          }\n        ]\n      }\n    ],\n    \"tools\": [\n      {\n        \"functionDeclarations\": [\n          {\n            \"name\": \"schedule_meeting\",\n            \"description\": \"Schedules a meeting with specified attendees at a given time and date.\",\n            \"parameters\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"attendees\": {\n                  \"type\": \"array\",\n                  \"items\": {\"type\": \"string\"},\n                  \"description\": \"List of people attending the meeting.\"\n                },\n                \"date\": {\n                  \"type\": \"string\",\n                  \"description\": \"Date of the meeting (e.g., '2024-07-29')\"\n                },\n                \"time\": {\n                  \"type\": \"string\",\n                  \"description\": \"Time of the meeting (e.g., '15:00')\"\n                },\n                \"topic\": {\n                  \"type\": \"string\",\n                  \"description\": \"The subject or topic of the meeting.\"\n                }\n              },\n              \"required\": [\"attendees\", \"date\", \"time\", \"topic\"]\n            }\n          }\n        ]\n      }\n    ]\n  }",
      "name": "示例"
    }
  ],
  "oasExtensions": ""
}

响应

[
  {
    "id": 726067714,
    "name": "成功",
    "code": 200,
    "contentType": "json",
    "jsonSchema": {
      "type": "object",
      "properties": {}
    },
    "itemSchema": {},
    "description": "",
    "mediaType": "",
    "headers": [],
    "oasExtensions": ""
  }
]