跳到內容

技術

工具使用 / 函式呼叫 (Tool use / Function calling)

Tool use / function calling

LLM 自行決定呼叫外部函式(搜尋、程式碼、API),並用結果產生最終回答的能力。

登入以收藏
Tool use(或叫 function calling)是 LLM 自己決定要用外部工具的能力——它會發出一個結構化請求要呼叫某個工具,拿到工具回傳的結果後,再把結果整合進最終回答。你事先告訴模型有哪些工具(名稱、說明、參數 JSON schema),模型自己挑要呼叫哪個、帶什麼參數。 它重要的原因是:純 LLM 沒辦法拿最新資料、執行程式碼、跟外部系統互動。Tool use 把聊天模型變成能搜尋網路、查資料庫、跑 Python、寄 email、呼叫任何 API endpoint 的東西。它是所有實用 agent 的基本元件。 舉個例子:問 Claude「現在台北天氣如何?」開啟 tool use 並註冊 `get_weather(city)` 工具後,Claude 會回一個 tool call:`{"name": "get_weather", "input": {"city": "Taipei"}}`。你的程式執行函式,把結果回傳給 Claude,它再用自然語言寫出答案。 OpenAI、Anthropic、Gemini、多數 open-source 模型都把這個當一級 API 功能。Tool use 就是 Cursor 能改你 code、Perplexity 能引用來源、ChatGPT 能呼叫 DALL-E 的原理。延伸閱讀:ReAct、function calling、agent、MCP(Model Context Protocol)。

最後更新: 2026-04-29

We use cookies

Anonymous analytics help us improve the site. You can opt out anytime. Learn more

工具使用 / 函式呼叫 (Tool use / Function calling) · BuilderWorld