Documentation Index
Fetch the complete documentation index at: https://docs.apigo.ai/llms.txt
Use this file to discover all available pages before exploring further.
권장 엔드포인트
최소한의 요청
{
"model": "gemini-2.5-flash",
"contents": [
{
"role": "user",
"parts": [{ "text": "Get today's Shanghai weather." }]
}
],
"tools": [
{
"functionDeclarations": [
{
"name": "get_weather",
"description": "Fetch weather",
"parameters": {
"type": "object",
"properties": {
"city": { "type": "string" }
},
"required": ["city"]
}
}
]
}
]
}
cURL 예
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"role": "user",
"parts": [{ "text": "Get today'\''s Shanghai weather." }]
}
],
"tools": [
{
"functionDeclarations": [
{
"name": "get_weather",
"description": "Fetch weather",
"parameters": {
"type": "object",
"properties": {
"city": { "type": "string" }
},
"required": ["city"]
}
}
]
}
]
}'
파이썬 예제
import requests
response = requests.post(
"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent",
headers={
"x-goog-api-key": "<GEMINI_API_KEY>",
"Content-Type": "application/json",
},
json={
"contents": [
{
"role": "user",
"parts": [{"text": "Get today's Shanghai weather."}],
}
],
"tools": [
{
"functionDeclarations": [
{
"name": "get_weather",
"description": "Fetch weather",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string"},
},
"required": ["city"],
},
}
]
}
],
},
)
print(response.json())
Node.js 예
const response = await fetch(
"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent",
{
method: "POST",
headers: {
"x-goog-api-key": process.env.GEMINI_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
contents: [
{
role: "user",
parts: [{ text: "Get today's Shanghai weather." }]
}
],
tools: [
{
functionDeclarations: [
{
name: "get_weather",
description: "Fetch weather",
parameters: {
type: "object",
properties: {
city: { type: "string" }
},
required: ["city"]
}
}
]
}
]
}),
}
);
console.log(await response.json());
모범 사례
- Gemini 함수 선언에는 자체 매핑 레이어가 필요합니다.
- 여러 도구 호출을 활성화하는 경우 실행기는 일괄 또는 체인 실행을 지원해야 합니다.
- 짧은 함수 이름보다 자세한 설명이 더 중요합니다.
