GPT WORLD / INDEPENDENT CODEX FIELD MANUAL 來源檢視 · 2026-07-31

回顧期號 / TOOLS

替每個 function tool 設定窄合約

Tool definition 只表達可呼叫意圖;validation、execution、idempotency 與 result 必須由已驗證的 server code 負責。

01 / DECIDE

架構決策

當 model 需要即時私有資料或受限應用動作,而不只是文字回答時使用。

Tool definition 只表達可呼叫意圖;validation、execution、idempotency 與 result 必須由已驗證的 server code 負責。 先把 input、output、state 與 side effect 畫成一條可觀察路徑,再決定 替每個 function tool 設定窄合約 要放在哪一層。

02 / BUILD

三步實作

  1. 01

    框定合約

    先寫下 caller、資料分類、成功條件、timeout、取消與 ownership。當 model 需要即時私有資料或受限應用動作,而不只是文字回答時使用。

  2. 02

    建立單一路徑

    只實作一條 end-to-end path,保留 request correlation、typed state 與可逆 failure handling。Tool definition 只表達可呼叫意圖;validation、execution、idempotency 與 result 必須由已驗證的 server code 負責。

  3. 03

    證明結果

    把驗收寫成可重跑的 fixture、contract test 或 browser test。Replay test 證明重複呼叫安全,且 success、denial、validation error 與 transient failure 都有明確型別。

03 / BOUND

Production 邊界

不可把 credential 放進 tool argument;對外溝通或不可逆寫入必須明確核准。

04 / PROVE

驗收證據

Replay test 證明重複呼叫安全,且 success、denial、validation error 與 transient failure 都有明確型別。

SOURCE / HTTP

可重現來源探針

curl -fsSI 'https://developers.openai.com/api/docs/guides/function-calling' | sed -n '1,5p'