関数呼び出し(ツール使用)ガイド
関数呼び出しにより、モデルは自由形式のテキストではなく構造化されたツール呼び出し引数を発行します。 Starsg (GPT、Claude、Qwen、Mistral) のすべてのツール使用対応モデルは、OpenAI 標準形式を使用します。
tools = [{
"type": "function",
"function": {
"name": "create_order",
"description": "Create an order",
"parameters": {
"type": "object",
"properties": {
"sku": {"type": "string"},
"qty": {"type": "integer"}
},
"required": ["sku", "qty"]
}
}
}]
resp = client.chat.completions.create(
model="qwen/qwen3-72b",
messages=[...],
tools=tools,
)以下も参照してください。API ドキュメント › 関数呼び出し