ツール統合

関数呼び出しは実行許可ではなく提案

モデルはツールと引数を提案します。検証、認可、実行判断はサーバー側の責任です。

予定している入金方法:Alipay、USDT。決済機能はまだ有効ではありません。

必須チェック

  • 厳格なスキーマ
  • ユーザー認可
  • 未知ツールの拒否
  • 冪等性
  • 支払い・削除の承認

対応モデルのみ使用

公開カタログでツール対応が明示されたモデルだけを使ってください。

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が関数を実行しますか?

いいえ。提案を返し、実行するかはアプリケーションが決めます。

引数を信用できますか?

できません。外部入力として厳格に検証してください。

関連情報