関数呼び出しを使用すると、モデルを外部ツールや API に接続できます。テキスト レスポンスを生成する代わりに、モデルは特定の関数を呼び出すタイミングを理解し、現実世界のアクションを実行するために必要なパラメータを指定します。これにより、モデルは自然言語と実際のアクションやデータとの間のブリッジとして機能します。関数呼び出しには主に次の 3 つのユースケースがあります。
- 知識の拡張: データベース、API、ナレッジベースなどの外部ソースから情報にアクセスします。
- 機能を拡張する: 外部ツールを使用して計算を行い、モデルの制限を拡張します(計算機の使用やグラフの作成など)。
- アクションを実行する: 予約のスケジュール設定、請求書の作成、メールの送信、スマートホーム デバイスの操作など、API を使用して外部システムとやり取りする
関数呼び出しの仕組み
関数呼び出しには、アプリケーション、モデル、外部関数間の構造化されたインタラクションが含まれます。プロセスの詳細は次のとおりです。
- 関数の宣言を定義する: アプリケーション コードで関数の宣言を定義します。関数宣言は、関数の名前、パラメータ、目的をモデルに記述します。
- 関数宣言で LLM を呼び出す: 関数宣言とともにユーザー プロンプトをモデルに送信します。リクエストを分析し、関数呼び出しが役立つかどうかを判断します。有効な場合、構造化された JSON オブジェクトで応答します。
- 関数コードを実行する(お客様の責任): モデルは関数自体を実行しません。レスポンスの処理と関数呼び出しの確認は、アプリケーションの責任で行う必要があります。
- はい: 関数の名前と引数を抽出し、アプリで対応する関数を実行します。
- いいえ: モデルはプロンプトに直接テキスト レスポンスを提供しました(このフローはあまり強調されていませんが、可能な結果です)。
- ユーザー フレンドリーなレスポンスを作成する: 関数が実行された場合は、結果をキャプチャし、会話の次のターンでモデルに返します。その結果を使用して、関数呼び出しからの情報を組み込んだ、ユーザー フレンドリーな最終的なレスポンスが生成されます。
このプロセスは複数のターンにわたって繰り返すことができ、複雑なインタラクションとワークフローを可能にします。このモデルは、1 つのターンで複数の関数を呼び出す(並列関数呼び出し)と順番に呼び出す(コンポジション関数呼び出し)こともサポートしています。
ステップ 1: 関数宣言を定義する
ユーザーがライトの値を設定して API リクエストを実行できるように、アプリコード内に関数とその宣言を定義します。この関数は、外部サービスまたは API を呼び出すことができます。
from google.genai import types
# Define a function that the model can call to control smart lights
set_light_values_declaration = {
"name": "set_light_values",
"description": "Sets the brightness and color temperature of a light.",
"parameters": {
"type": "object",
"properties": {
"brightness": {
"type": "integer",
"description": "Light level from 0 to 100. Zero is off and 100 is full brightness",
},
"color_temp": {
"type": "string",
"enum": ["daylight", "cool", "warm"],
"description": "Color temperature of the light fixture, which can be `daylight`, `cool` or `warm`.",
},
},
"required": ["brightness", "color_temp"],
},
}
# This is the actual function that would be called based on the model's suggestion
def set_light_values(brightness: int, color_temp: str) -> dict[str, int | str]:
"""Set the brightness and color temperature of a room light. (mock API).
Args:
brightness: Light level from 0 to 100. Zero is off and 100 is full brightness
color_temp: Color temperature of the light fixture, which can be `daylight`, `cool` or `warm`.
Returns:
A dictionary containing the set brightness and color temperature.
"""
return {"brightness": brightness, "colorTemperature": color_temp}
import { Type } from '@google/genai';
// Define a function that the model can call to control smart lights
const setLightValuesFunctionDeclaration = {
name: 'set_light_values',
description: 'Sets the brightness and color temperature of a light.',
parameters: {
type: Type.OBJECT,
properties: {
brightness: {
type: Type.NUMBER,
description: 'Light level from 0 to 100. Zero is off and 100 is full brightness',
},
color_temp: {
type: Type.STRING,
enum: ['daylight', 'cool', 'warm'],
description: 'Color temperature of the light fixture, which can be `daylight`, `cool` or `warm`.',
},
},
required: ['brightness', 'color_temp'],
},
};
/**
* Set the brightness and color temperature of a room light. (mock API)
* @param {number} brightness - Light level from 0 to 100. Zero is off and 100 is full brightness
* @param {string} color_temp - Color temperature of the light fixture, which can be `daylight`, `cool` or `warm`.
* @return {Object} A dictionary containing the set brightness and color temperature.
*/
function setLightValues(brightness, color_temp) {
return {
brightness: brightness,
colorTemperature: color_temp
};
}
ステップ 2: 関数宣言を使用してモデルを呼び出す
関数宣言を定義したら、その関数を使用するようにモデルにプロンプトを出します。プロンプトと関数宣言を分析し、直接応答するか関数を呼び出すかを決定します。関数が呼び出されると、レスポンス オブジェクトに関数呼び出しの候補が含まれます。
from google import genai
# Generation Config with Function Declaration
tools = types.Tool(function_declarations=[set_light_values_declaration])
config = types.GenerateContentConfig(tools=[tools])
# Configure the client
client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
# Define user prompt
contents = [
types.Content(
role="user", parts=[types.Part(text="Turn the lights down to a romantic level")]
)
]
# Send request with function declarations
response = client.models.generate_content(
model="gemini-2.0-flash", config=config, contents=contents
)
print(response.candidates[0].content.parts[0].function_call)
import { GoogleGenAI } from '@google/genai';
// Generation Config with Function Declaration
const config = {
tools: [{
functionDeclarations: [setLightValuesFunctionDeclaration]
}]
};
// Configure the client
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
// Define user prompt
const contents = [
{
role: 'user',
parts: [{ text: 'Turn the lights down to a romantic level' }]
}
];
// Send request with function declarations
const response = await ai.models.generateContent({
model: 'gemini-2.0-flash',
contents: contents,
config: config
});
console.log(response.functionCalls[0]);
モデルは、ユーザーの質問に回答するために宣言された関数を 1 つ以上呼び出す方法を指定する OpenAPI 互換スキーマで functionCall
オブジェクトを返します。
id=None args={'color_temp': 'warm', 'brightness': 25} name='set_light_values'
{
name: 'set_light_values',
args: { brightness: 25, color_temp: 'warm' }
}
ステップ 3: set_light_values 関数コードを実行する
モデルのレスポンスから関数呼び出しの詳細を抽出し、引数を解析して、コードで set_light_values
関数を実行します。
# Extract tool call details
tool_call = response.candidates[0].content.parts[0].function_call
if tool_call.name == "set_light_values":
result = set_light_values(**tool_call.args)
print(f"Function execution result: {result}")
// Extract tool call details
const tool_call = response.functionCalls[0]
let result;
if (tool_call.name === 'set_light_values') {
result = setLightValues(tool_call.args.brightness, tool_call.args.color_temp);
console.log(`Function execution result: ${JSON.stringify(result)}`);
}
ステップ 4: 関数の結果を使用してユーザー フレンドリーなレスポンスを作成し、モデルを再度呼び出す
最後に、関数実行の結果をモデルに送り返して、この情報をユーザーへの最終的なレスポンスに組み込むようにします。
# Create a function response part
function_response_part = types.Part.from_function_response(
name=tool_call.name,
response={"result": result},
)
# Append function call and result of the function execution to contents
contents.append(types.Content(role="model", parts=[types.Part(function_call=tool_call)])) # Append the model's function call message
contents.append(types.Content(role="user", parts=[function_response_part])) # Append the function response
final_response = client.models.generate_content(
model="gemini-2.0-flash",
config=config,
contents=contents,
)
print(final_response.text)
// Create a function response part
const function_response_part = {
name: tool_call.name,
response: { result }
}
// Append function call and result of the function execution to contents
contents.push({ role: 'model', parts: [{ functionCall: tool_call }] });
contents.push({ role: 'user', parts: [{ functionResponse: function_response_part }] });
// Get the final response from the model
const final_response = await ai.models.generateContent({
model: 'gemini-2.0-flash',
contents: contents,
config: config
});
console.log(final_response.text);
これで、関数呼び出しフローが完了します。モデルは set_light_values
関数を正常に使用して、ユーザーのリクエスト アクションを実行しました。
関数宣言
プロンプトで関数呼び出しを実装する場合は、1 つ以上の function declarations
を含む tools
オブジェクトを作成します。関数は JSON を使用して定義します。具体的には、OpenAPI スキーマ形式のサブセットを選択します。1 つの関数宣言に含めることができるパラメータは、次のとおりです。
name
(文字列): 関数の一意の名前(get_weather_forecast
、send_email
)。スペースや特殊文字を含まないわかりやすい名前を使用します(アンダースコアまたはキャメルケースを使用)。description
(文字列): 関数の目的と機能について、わかりやすく詳細に説明します。これは、モデルが関数を使用するタイミングを理解するために重要です。具体的に説明し、必要に応じて例を挙げます(「現在映画館で上映されている映画のタイトルを指定することもできます。映画館はユーザーの位置情報に基づいて検索されます」)。parameters
(オブジェクト): 関数が想定する入力パラメータを定義します。type
(文字列): 全体的なデータ型(object
など)を指定します。properties
(オブジェクト): 個々のパラメータを一覧表示します。各パラメータには次の情報が含まれます。type
(文字列): パラメータのデータ型(string
、integer
、boolean, array
など)。description
(文字列): パラメータの目的と形式の説明。例と制約を指定します(「市と州(例: 「San Francisco, CA」または郵便番号(例: 95616' です。」)。enum
(配列、省略可): パラメータ値が固定されたセットから取得される場合は、説明に記述するのではなく、「enum」を使用して許可される値を一覧表示します。これにより精度が向上します(「enum": ["daylight", "cool", "warm"])。
required
(配列): 関数の動作に必須のパラメータ名を列挙した文字列の配列。
並列関数呼び出し
1 ターンの関数呼び出しに加えて、複数の関数を一度に呼び出すこともできます。並列関数呼び出しを使用すると、複数の関数を一度に実行できます。これは、関数が相互に依存していない場合に使用されます。これは、異なるデータベースから顧客の詳細を取得する、さまざまな倉庫の在庫レベルを確認する、アパートをディスコに変換するなど、複数の独立したソースからデータを収集するようなシナリオで役立ちます。
power_disco_ball = {
"name": "power_disco_ball",
"description": "Powers the spinning disco ball.",
"parameters": {
"type": "object",
"properties": {
"power": {
"type": "boolean",
"description": "Whether to turn the disco ball on or off.",
}
},
"required": ["power"],
},
}
start_music = {
"name": "start_music",
"description": "Play some music matching the specified parameters.",
"parameters": {
"type": "object",
"properties": {
"energetic": {
"type": "boolean",
"description": "Whether the music is energetic or not.",
},
"loud": {
"type": "boolean",
"description": "Whether the music is loud or not.",
},
},
"required": ["energetic", "loud"],
},
}
dim_lights = {
"name": "dim_lights",
"description": "Dim the lights.",
"parameters": {
"type": "object",
"properties": {
"brightness": {
"type": "number",
"description": "The brightness of the lights, 0.0 is off, 1.0 is full.",
}
},
"required": ["brightness"],
},
}
import { Type } from '@google/genai';
const powerDiscoBall = {
name: 'power_disco_ball',
description: 'Powers the spinning disco ball.',
parameters: {
type: Type.OBJECT,
properties: {
power: {
type: Type.BOOLEAN,
description: 'Whether to turn the disco ball on or off.'
}
},
required: ['power']
}
};
const startMusic = {
name: 'start_music',
description: 'Play some music matching the specified parameters.',
parameters: {
type: Type.OBJECT,
properties: {
energetic: {
type: Type.BOOLEAN,
description: 'Whether the music is energetic or not.'
},
loud: {
type: Type.BOOLEAN,
description: 'Whether the music is loud or not.'
}
},
required: ['energetic', 'loud']
}
};
const dimLights = {
name: 'dim_lights',
description: 'Dim the lights.',
parameters: {
type: Type.OBJECT,
properties: {
brightness: {
type: Type.NUMBER,
description: 'The brightness of the lights, 0.0 is off, 1.0 is full.'
}
},
required: ['brightness']
}
};
指定されたすべてのツールを使用できる指示を使用してモデルを呼び出します。この例では tool_config
を使用しています。詳細については、関数呼び出しの構成をご覧ください。
from google import genai
from google.genai import types
# Set up function declarations
house_tools = [
types.Tool(function_declarations=[power_disco_ball, start_music, dim_lights])
]
config = {
"tools": house_tools,
"automatic_function_calling": {"disable": True},
# Force the model to call 'any' function, instead of chatting.
"tool_config": {"function_calling_config": {"mode": "any"}},
}
# Configure the client
client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
chat = client.chats.create(model="gemini-2.0-flash", config=config)
response = chat.send_message("Turn this place into a party!")
# Print out each of the function calls requested from this single call
print("Example 1: Forced function calling")
for fn in response.function_calls:
args = ", ".join(f"{key}={val}" for key, val in fn.args.items())
print(f"{fn.name}({args})")
import { GoogleGenAI } from '@google/genai';
// Set up function declarations
const houseFns = [powerDiscoBall, startMusic, dimLights];
const config = {
tools: [{
functionDeclarations: houseFns
}],
// Force the model to call 'any' function, instead of chatting.
toolConfig: {
functionCallingConfig: {
mode: 'any'
}
}
};
// Configure the client
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
// Create a chat session
const chat = ai.chats.create({
model: 'gemini-2.0-flash',
config: config
});
const response = await chat.sendMessage({message: 'Turn this place into a party!'});
// Print out each of the function calls requested from this single call
console.log("Example 1: Forced function calling");
for (const fn of response.functionCalls) {
const args = Object.entries(fn.args)
.map(([key, val]) => `${key}=${val}`)
.join(', ');
console.log(`${fn.name}(${args})`);
}
出力される結果のそれぞれは、モデルがリクエストした単一の関数呼び出しを表します。結果を返すには、リクエストされた順序でレスポンスを含めます。
Python SDK は、自動関数呼び出しと呼ばれる機能をサポートしています。この機能は、Python 関数を宣言に変換し、関数呼び出しの実行とレスポンス サイクルを処理します。ディスコのユースケースの例を次に示します。
from google import genai
from google.genai import types
# Actual implementation functions
def power_disco_ball_impl(power: bool) -> dict:
"""Powers the spinning disco ball.
Args:
power: Whether to turn the disco ball on or off.
Returns:
A status dictionary indicating the current state.
"""
return {"status": f"Disco ball powered {'on' if power else 'off'}"}
def start_music_impl(energetic: bool, loud: bool) -> dict:
"""Play some music matching the specified parameters.
Args:
energetic: Whether the music is energetic or not.
loud: Whether the music is loud or not.
Returns:
A dictionary containing the music settings.
"""
music_type = "energetic" if energetic else "chill"
volume = "loud" if loud else "quiet"
return {"music_type": music_type, "volume": volume}
def dim_lights_impl(brightness: float) -> dict:
"""Dim the lights.
Args:
brightness: The brightness of the lights, 0.0 is off, 1.0 is full.
Returns:
A dictionary containing the new brightness setting.
"""
return {"brightness": brightness}
config = {
"tools": [power_disco_ball_impl, start_music_impl, dim_lights_impl],
}
chat = client.chats.create(model="gemini-2.0-flash", config=config)
response = chat.send_message("Do everything you need to this place into party!")
print("\nExample 2: Automatic function calling")
print(response.text)
# I've turned on the disco ball, started playing loud and energetic music, and dimmed the lights to 50% brightness. Let's get this party started!
コンポジション関数呼び出し
Gemini 2.0 はコンポーズ可能な関数呼び出しをサポートしています。つまり、モデルは複数の関数呼び出しを連結できます。たとえば、「現在の位置の温度を取得」という質問に回答するために、Gemini API は get_current_location()
関数と、位置情報をパラメータとして受け取る get_weather()
関数の両方を呼び出す場合があります。
# Light control schemas
turn_on_the_lights_schema = {'name': 'turn_on_the_lights'}
turn_off_the_lights_schema = {'name': 'turn_off_the_lights'}
prompt = """
Hey, can you write run some python code to turn on the lights, wait 10s and then turn off the lights?
"""
tools = [
{'code_execution': {}},
{'function_declarations': [turn_on_the_lights_schema, turn_off_the_lights_schema]}
]
await run(prompt, tools=tools, modality="AUDIO")
// Light control schemas
const turnOnTheLightsSchema = { name: 'turn_on_the_lights' };
const turnOffTheLightsSchema = { name: 'turn_off_the_lights' };
const prompt = `
Hey, can you write run some python code to turn on the lights, wait 10s and then turn off the lights?
`;
const tools = [
{ codeExecution: {} },
{ functionDeclarations: [turnOnTheLightsSchema, turnOffTheLightsSchema] }
];
await run(prompt, tools=tools, modality="AUDIO")
関数呼び出しモード
Gemini API を使用すると、モデルが提供されたツール(関数宣言)を使用する方法を制御できます。具体的には、function_calling_config
内でモードを設定できます。
AUTO (Default)
: モデルは、プロンプトとコンテキストに基づいて、自然言語によるレスポンスを生成するか、関数呼び出しを提案するかを決定します。これは最も柔軟なモードであり、ほとんどのシナリオにおすすめです。ANY
: モデルは常に関数呼び出しを予測し、関数スキーマへの準拠を保証するように制約されています。allowed_function_names
が指定されていない場合、モデルは指定された関数宣言のいずれかを選択できます。allowed_function_names
がリストとして指定されている場合、モデルはリスト内の関数からのみ選択できます。このモードは、すべてのプロンプトに対して関数呼び出しが必要な場合に使用します(該当する場合)。NONE
: モデルは関数呼び出しを禁止されています。これは、関数宣言なしでリクエストを送信する場合と同じです。ツール定義を削除せずに、関数呼び出しを一時的に無効にするには、このコマンドを使用します。
from google.genai import types
# Configure function calling mode
tool_config = types.ToolConfig(
function_calling_config=types.FunctionCallingConfig(
mode="ANY", allowed_function_names=["get_current_temperature"]
)
)
# Create the generation config
config = types.GenerateContentConfig(
temperature=0,
tools=[tools], # not defined here.
tool_config=tool_config,
)
import { FunctionCallingConfigMode } from '@google/genai';
// Configure function calling mode
const toolConfig = {
functionCallingConfig: {
mode: FunctionCallingConfigMode.ANY,
allowedFunctionNames: ['get_current_temperature']
}
};
// Create the generation config
const config = {
temperature: 0,
tools: tools, // not defined here.
toolConfig: toolConfig,
};
関数の自動呼び出し(Python のみ)
Python SDK を使用する場合は、Python 関数をツールとして直接指定できます。SDK は、Python 関数を宣言に変換し、関数呼び出しの実行とレスポンス サイクルを自動的に処理します。Python SDK は次のことを自動的に実行します。
- モデルからの関数呼び出しレスポンスを検出します。
- コードで対応する Python 関数を呼び出します。
- 関数レスポンスをモデルに返します。
- モデルの最終的なテキスト レスポンスを返します。
これを使用するには、型ヒントとドキュメント コメントを使用して関数を定義し、関数自体(JSON 宣言ではない)をツールとして渡します。
from google import genai
from google.genai import types
# Define the function with type hints and docstring
def get_current_temperature(location: str) -> dict:
"""Gets the current temperature for a given location.
Args:
location: The city and state, e.g. San Francisco, CA
Returns:
A dictionary containing the temperature and unit.
"""
# ... (implementation) ...
return {"temperature": 25, "unit": "Celsius"}
# Configure the client and model
client = genai.Client(api_key=os.getenv("GEMINI_API_KEY")) # Replace with your actual API key setup
config = types.GenerateContentConfig(
tools=[get_current_temperature]
) # Pass the function itself
# Make the request
response = client.models.generate_content(
model="gemini-2.0-flash",
contents="What's the temperature in London?",
config=config,
)
print(response.text) # The SDK handles the function call and returns the final text
関数の自動呼び出しを無効にするには、次を使用します。
# To disable automatic function calling:
config = types.GenerateContentConfig(
tools=[get_current_temperature],
automatic_function_calling=types.AutomaticFunctionCallingConfig(disable=True)
)
自動関数スキーマ宣言
Python 関数からスキーマを自動的に抽出できない場合があります。たとえば、ネストされたディクショナリ オブジェクトのフィールドを記述する場合は処理されません。この API は、次のいずれかのタイプを記述できます。
AllowedType = (int | float | bool | str | list['AllowedType'] | dict[str, AllowedType])
推定されたスキーマを確認するには、from_callable
を使用して変換します。
def multiply(a: float, b: float):
"""Returns a * b."""
return a * b
fn_decl = types.FunctionDeclaration.from_callable(callable=multiply, client=client)
# to_json_dict() provides a clean JSON representation.
print(fn_decl.to_json_dict())
複数のツールの使用: ネイティブ ツールと関数呼び出しを組み合わせる
Gemini 2.0 では、ネイティブ ツールと関数呼び出しを組み合わせた複数のツールを同時に有効にできます。Live API を使用してリクエストで 2 つのツール(Google 検索によるグラウンディングとコード実行)を有効にする例を次に示します。
# Multiple tasks example - combining lights, code execution, and search
prompt = """
Hey, I need you to do three things for me.
1. Turn on the lights.
2. Then compute the largest prime palindrome under 100000.
3. Then use Google Search to look up information about the largest earthquake in California the week of Dec 5 2024.
Thanks!
"""
tools = [
{'google_search': {}},
{'code_execution': {}},
{'function_declarations': [turn_on_the_lights_schema, turn_off_the_lights_schema]} # not defined here.
]
# Execute the prompt with specified tools in audio modality
await run(prompt, tools=tools, modality="AUDIO")
// Multiple tasks example - combining lights, code execution, and search
const prompt = `
Hey, I need you to do three things for me.
1. Turn on the lights.
2. Then compute the largest prime palindrome under 100000.
3. Then use Google Search to look up information about the largest earthquake in California the week of Dec 5 2024.
Thanks!
`;
const tools = [
{ googleSearch: {} },
{ codeExecution: {} },
{ functionDeclarations: [turnOnTheLightsSchema, turnOffTheLightsSchema] } // not defined here.
];
// Execute the prompt with specified tools in audio modality
await run(prompt, {tools: tools, modality: "AUDIO"});
Python デベロッパーは、Live API Tool Use ノートブックでこれを試すことができます。
サポートされているモデル
試験運用版モデルは含まれません。これらの機能は、モデルの概要ページで確認できます。
モデル | 関数呼び出し | 並列関数呼び出し | コンポジション関数呼び出し (Live API のみ) |
---|---|---|---|
Gemini 2.0 Flash | ✔️ | ✔️ | ✔️ |
Gemini 2.0 Flash-Lite | X | X | X |
Gemini 1.5 Flash | ✔️ | ✔️ | ✔️ |
Gemini 1.5 Pro | ✔️ | ✔️ | ✔️ |
ベスト プラクティス
- 関数とパラメータの説明: 説明は非常に明確かつ具体的にします。モデルは、これらの情報に基づいて適切な関数を選択し、適切な引数を指定します。
- 命名: わかりやすい関数名を使用します(スペース、ピリオド、ダッシュは使用しないでください)。
- 厳密な型指定: パラメータに特定の型(整数、文字列、列挙型)を使用して、エラーを減らします。パラメータの有効な値が限定されている場合は、列挙型を使用します。
- プロンプト エンジニアリング:
- コンテキストを提供する: モデルにその役割(「あなたは役に立つ天気アシスタントです」)。
- 手順を指定します。関数の使用方法と使用のタイミングを指定します(「日付を推測しないでください。予測には常に将来の日付を使用してください」)。
- 明確化を促す: 必要に応じて明確な質問をするようモデルに指示します。
- 温度: 低い温度(0)に設定すると、より確定的で信頼性の高い関数呼び出しが可能になります。
- 検証: 関数呼び出しが重大な結果をもたらす場合(注文の確定など)は、実行する前にユーザーにその関数呼び出しの妥当性を確認してください。
- エラー処理: 関数に堅牢なエラー処理を実装して、予期しない入力や API の障害を適切に処理します。モデルがユーザーに役立つ回答を生成するために使用できる、有益なエラー メッセージを返します。
- セキュリティ: 外部 API を呼び出す場合は、セキュリティに注意してください。適切な認証と認可のメカニズムを使用します。関数呼び出しで機密データを公開しない。
- トークンの上限: 関数の説明とパラメータは、入力トークンの上限にカウントされます。トークンの上限に達している場合は、関数の数や説明の長さを制限し、複雑なタスクをより小さく、より焦点を絞った関数セットに分割することを検討してください。
注意事項と制限事項
- サポートされているのは、OpenAPI スキーマのサブセットのみです。
- Python でサポートされているパラメータの型は限られています。
- 関数の自動呼び出しは Python SDK の機能のみです。