OpenAI Function Calling 让你给 language model 一份 tool 列表,由它决定使用哪个及传入什么 data。你用短名称、功能说明及 JSON-like schema 描述每个 tool 的 input shape,然后将 user message 与 tool 列表传给 model。model 可返回 naming tool 并填入所需 argument 的 JSON block,而非 normal text。你的程序读取 block、运行真实 function,并将结果发回进行下一步。此 pattern 使 agent action 清晰、易 parse 且难 abuse,因 model 不能自行 run code,所有 call 都经你的 check。它也减少 prompt hack 与错误 format,使 agent 更快、更安全地工作。
用自己的话写下这一站的结论。