Function Calling
Official Documentation: https://ai.google.dev/gemini-api/docs/function-calling?hl=zh-cn&example=meeting
Endpoint
POST http://v98store.com/v1beta/models/gemini-2.5-pro:generateContent cURL Command
curl -X POST 'http://v98store.com/v1beta/models/gemini-2.5-pro:generateContent' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -d '{ "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" ] } } ] } ] }' Parameters
| Name | In | Description | Required |
|---|---|---|---|
| key | query | Yes | |
| Content-Type | header | Yes |
Request Body
Example
{
"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"
]
}
}
]
}
]
} Responses
200 -
Example
undefined