必須チェック
- 厳格なスキーマ
- ユーザー認可
- 未知ツールの拒否
- 冪等性
- 支払い・削除の承認
対応モデルのみ使用
公開カタログでツール対応が明示されたモデルだけを使ってください。
function-calling.tstypescript
const response = await client.chat.completions.create({
model: "qwen3.7-plus",
messages: [{ role: "user", content: "What is the order status?" }],
tools: [{
type: "function",
function: {
name: "get_order_status",
description: "Return the current order status",
parameters: {
type: "object",
properties: { order_id: { type: "string" } },
required: ["order_id"]
}
}
}]
});よくある質問
APIが関数を実行しますか?
いいえ。提案を返し、実行するかはアプリケーションが決めます。
引数を信用できますか?
できません。外部入力として厳格に検証してください。