1. 工具
API接口文档
  • 更新日志
  • 介绍
  • 稳定性保障
  • 模型接口
    • 谷歌gemini
      • 聊天
        • 文本生成
        • 文本生成-流式
        • 文本生成-流式-思考
      • 图像
        • 图片生成-文生图
        • 图片生成-图生图-传入base64编码
        • 图片生成-图生图-控制长宽比
        • 图片生成-图生图-控制长宽比和分辨率
        • 图片生成-依托 Google 图片搜索生成图片
        • 图片编辑
        • 图片理解
      • 语音
        • Gemini-音频理解
        • 文字转语音-单人
        • 文字转语音-多人
      • 文档
        • 文档理解
      • 工具
        • 函数调用
          POST
        • 代码执行
          POST
        • Google Search
          POST
        • Google Maps
          POST
        • URL context
          POST
      • 视觉& Veo
        • 视频生成
        • 视频理解
      • 嵌入(Embeddings)
        • Embeddings
    • Claude
      • 聊天
        • 聊天对话
        • 思考
      • 图片
        • 图片理解-本地图片
        • 图片理解-URL图片
      • 文档
        • PDF文档识别-URL文档
        • PDF文档识别 -本地文档
      • 工具
        • 函数调用
    • OpenAI
      • 聊天
        • 聊天对话
      • 图片
        • 图片识别-传入url
        • 图片识别-本地图片
        • gpt-图像编辑
        • gpt-文本生图
      • 视频
        • Sora-视频生成官方格式
      • 语音
        • TTS-文本转语音
      • 使用工具
        • 网络搜索
    • 可灵
      • 图像生成
      • 文生视频
      • 图生视频
      • 查询任务
    • MJ图像
      • 快速教学
      • 切换不同的速度
      • 任务提交
        • 提交Imagine
        • 执行Action任务
        • 提交Describe任务
        • 提交Blend任务
      • 任务查询
        • 查询所有任务
        • 根据ID列表查询任务
        • 指定ID获取任务
        • 获取任务图片的seed
    • xAI
      • 聊天
        • 文本生成
        • 流式输出
        • 思维Reasoning
      • 图片
        • 图片理解
        • 图片生成
      • 视频
        • 视频生成
      • 语音
        • 文字生成语音
      • 工具
        • 函数调用
        • 网络搜索
    • minimax
      • MiniMax概述
    • 模型(Models)
      • 列出模型
    • 小米mimo
      • 模型超参
      • 对话
        • openai格式
        • Anthropic API格式
      • 图片
        • 图片理解
        • 图片传入方式
        • 图片限制
      • 视频
        • 视频理解
  • 常见错误
    • Unexpected role "tool". Allowed roles are "user" or "assistant". For instructions on how to use tools
    • This model is not supported by Responses API.
    • 403 Forbidden {"message":"用户额度不足, 剩余额度: $-1.74
    • The model is overloaded. Please try again later
    • No available channel for model
    • API接口返回HTTP 状态码及其含义
  1. 工具

函数调用

开发中
POST
v1beta/models/gemini-3-flash-preview:generateContent
官方文档:https://ai.google.dev/gemini-api/docs/function-calling?hl=zh-cn&example=meeting#how-it-works
借助函数调用,您可以将模型连接到外部工具和 API。 模型不会生成文本回答,而是会确定何时调用特定函数,并提供执行实际操作所需的参数。 这使得模型能够充当自然语言与现实世界中的行动和数据之间的桥梁。函数调用有 3 个主要应用场景:
扩充知识:访问数据库、API 和知识库等外部来源的信息。
扩展功能:使用外部工具执行计算,并扩展模型的功能限制,例如使用计算器或创建图表。
执行操作:使用 API 与外部系统互动,例如安排预约、创建账单、发送电子邮件或控制智能家居设备。

请求参数

Header 参数

Body 参数application/json必填

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

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'v1beta/models/gemini-3-flash-preview:generateContent' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "contents": [
      {
        "role": "user",
        "parts": [
          {
            "text": "Schedule a meeting with Bob and Alice for 03/27/2025 at 10:00 AM about the Q3 planning."
          }
        ]
      }
    ],
    "tools": [
      {
        "functionDeclarations": [
          {
            "name": "schedule_meeting",
            "description": "Schedules a meeting with specified attendees at a given time and date.",
            "parameters": {
              "type": "object",
              "properties": {
                "attendees": {
                  "type": "array",
                  "items": {"type": "string"},
                  "description": "List of people attending the meeting."
                },
                "date": {
                  "type": "string",
                  "description": "Date of the meeting (e.g., '\''2024-07-29'\'')"
                },
                "time": {
                  "type": "string",
                  "description": "Time of the meeting (e.g., '\''15:00'\'')"
                },
                "topic": {
                  "type": "string",
                  "description": "The subject or topic of the meeting."
                }
              },
              "required": ["attendees", "date", "time", "topic"]
            }
          }
        ]
      }
    ]
  }'

返回响应

🟢200成功
application/json
Body

示例
{}
修改于 2026-03-12 08:08:02
上一页
文档理解
下一页
代码执行
Built with