{
 "LLM API 基礎:messages、token 與常用參數#1": {
  "type": "flow",
  "nodes": [
   {
    "label": "訊息與設定",
    "sub": "messages",
    "color": 0
   },
   {
    "label": "HTTPS 請求",
    "sub": "",
    "color": 1
   },
   {
    "label": "模型產生文字",
    "sub": "",
    "color": 2
   },
   {
    "label": "文字與 usage",
    "sub": "用量資訊",
    "kind": "end",
    "color": 3
   }
  ],
  "layout": "row",
  "reveal": [
   0,
   4,
   4
  ]
 },
 "LLM API 基礎:messages、token 與常用參數#2": {
  "type": "cards",
  "cards": [
   {
    "title": "system",
    "points": [
     "設定身分、規則、格式"
    ]
   },
   {
    "title": "user",
    "points": [
     "使用者輸入"
    ]
   },
   {
    "title": "assistant",
    "points": [
     "模型先前回覆",
     "維持多輪對話"
    ]
   },
   {
    "title": "tool",
    "points": [
     "工具執行結果",
     "第五章"
    ]
   }
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   4
  ]
 },
 "LLM API 基礎:messages、token 與常用參數#3": {
  "type": "table",
  "head": [
   "角色",
   "內容"
  ],
  "rows": [
   [
    "system",
    "你是 Linux 維運助理,用繁體中文簡潔回答"
   ],
   [
    "user",
    "什麼是 load average"
   ]
  ],
  "widths": [
   0.25,
   0.75
  ],
  "reveal": [
   0,
   1,
   2
  ]
 },
 "LLM API 基礎:messages、token 與常用參數#5": {
  "type": "table",
  "head": [
   "參數",
   "說明"
  ],
  "rows": [
   [
    "model",
    "模型名稱,放環境變數"
   ],
   [
    "temperature",
    "維運建議約 0 到 0.3"
   ],
   [
    "輸出長度限制",
    "參數名稱依模型而異"
   ],
   [
    "timeout",
    "SDK 層的逾時"
   ],
   [
    "stream",
    "是否串流接收"
   ]
  ],
  "widths": [
   0.3,
   0.7
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ]
 },
 "取得與保管 API 金鑰#2": {
  "type": "cards",
  "cards": [
   {
    "title": "專屬金鑰",
    "points": [
     "為此專案建立一把"
    ]
   },
   {
    "title": "用量上限",
    "points": [
     "後台設定上限或預算提醒"
    ]
   },
   {
    "title": "只顯示一次",
    "points": [
     "拿到後馬上存好"
    ]
   }
  ],
  "reveal": [
   0,
   1,
   2,
   3
  ]
 },
 "取得與保管 API 金鑰#4": {
  "type": "flow",
  "nodes": [
   {
    "label": "建立 .env",
    "sub": "金鑰與模型名稱",
    "color": 0
   },
   {
    "label": "權限",
    "sub": "chmod 600",
    "color": 1
   },
   {
    "label": "確認忽略",
    "sub": "git check-ignore",
    "color": 2
   },
   {
    "label": "載入",
    "sub": "load_dotenv",
    "kind": "end",
    "color": 3
   }
  ],
  "layout": "row",
  "reveal": [
   0,
   3,
   4
  ]
 },
 "取得與保管 API 金鑰#6": {
  "type": "flow",
  "nodes": [
   {
    "label": "撤銷金鑰",
    "sub": "後台重新建立",
    "color": 0
   },
   {
    "label": "檢查用量",
    "sub": "有無異常",
    "color": 1
   },
   {
    "label": "視為外洩",
    "sub": "已進 git 一律作廢",
    "kind": "end",
    "color": 2
   }
  ],
  "layout": "row",
  "reveal": [
   0,
   1,
   2,
   3
  ]
 },
 "以 Python 呼叫 OpenAI API 並封裝 llm.py#4": {
  "type": "cards",
  "cards": [
   {
    "title": "模型來自環境變數",
    "points": [
     "換模型不用改程式"
    ]
   },
   {
    "title": "逾時與重試",
    "points": [
     "SDK 本身支援",
     "暫時性錯誤自動重試"
    ]
   },
   {
    "title": "自訂 LLMReply",
    "points": [
     "換供應商只改一個檔"
    ]
   },
   {
    "title": "保留額外參數",
    "points": [
     "可傳 temperature 等"
    ]
   }
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ]
 },
 "以 Python 呼叫 OpenAI API 並封裝 llm.py#5": {
  "type": "table",
  "head": [
   "欄位",
   "型別",
   "說明"
  ],
  "rows": [
   [
    "text",
    "str",
    "模型回覆的文字"
   ],
   [
    "prompt_tokens",
    "int",
    "輸入 token 數"
   ],
   [
    "completion_tokens",
    "int",
    "輸出 token 數"
   ]
  ],
  "widths": [
   0.35,
   0.15,
   0.5
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   3
  ]
 },
 "錯誤處理、逾時重試與成本控管#1": {
  "type": "table",
  "head": [
   "例外",
   "意義",
   "狀態碼"
  ],
  "rows": [
   [
    "AuthenticationError",
    "金鑰錯誤或失效",
    "401"
   ],
   [
    "RateLimitError",
    "請求太頻繁或額度不足",
    "429"
   ],
   [
    "APITimeoutError",
    "逾時",
    ""
   ],
   [
    "APIConnectionError",
    "網路連不上",
    ""
   ],
   [
    "APIStatusError",
    "其他 HTTP 狀態錯誤",
    "含 5xx"
   ]
  ],
  "widths": [
   0.38,
   0.4,
   0.22
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ]
 },
 "錯誤處理、逾時重試與成本控管#3": {
  "type": "table",
  "head": [
   "例外",
   "處理"
  ],
  "rows": [
   [
    "認證錯誤",
    "記錄錯誤、檢查金鑰,回傳 None"
   ],
   [
    "速率限制",
    "記警告,回傳 None"
   ],
   [
    "逾時或連線",
    "記警告,請稍後再試"
   ],
   [
    "其他狀態錯誤",
    "記下狀態碼"
   ]
  ],
  "widths": [
   0.3,
   0.7
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   4
  ]
 },
 "錯誤處理、逾時重試與成本控管#6": {
  "type": "bar",
  "labels": [
   "第一次",
   "第二次",
   "第三次"
  ],
  "values": [
   1,
   2,
   4
  ],
  "unit": " 秒",
  "reveal": [
   0,
   3,
   3
  ]
 },
 "錯誤處理、逾時重試與成本控管#7": {
  "type": "cards",
  "cards": [
   {
    "title": "精簡系統提示",
    "points": []
   },
   {
    "title": "截斷工具輸出",
    "points": [
     "日誌只送最近幾行"
    ]
   },
   {
    "title": "限制輸出長度",
    "points": []
   },
   {
    "title": "歷史對話設上限",
    "points": []
   },
   {
    "title": "用量寫入審計",
    "points": [
     "每天統計"
    ]
   }
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   4,
   5
  ]
 }
}