{
 "RAG 架構與向量庫選型#1": {
  "type": "flow",
  "layout": "snake",
  "nodes": [
   {
    "label": "載入",
    "sub": "Markdown"
   },
   {
    "label": "切塊",
    "sub": "chunker.py"
   },
   {
    "label": "嵌入",
    "sub": "embedder.py"
   },
   {
    "label": "檢索",
    "sub": "store.py"
   },
   {
    "label": "生成",
    "sub": "answer.py",
    "kind": "end"
   }
  ],
  "reveal": [
   0,
   0,
   0,
   1,
   2,
   3,
   3
  ]
 },
 "RAG 架構與向量庫選型#2": {
  "type": "flow",
  "layout": "snake",
  "nodes": [
   {
    "label": "載入",
    "sub": "Markdown"
   },
   {
    "label": "切塊",
    "sub": "chunker.py"
   },
   {
    "label": "嵌入",
    "sub": "embedder.py"
   },
   {
    "label": "檢索",
    "sub": "store.py"
   },
   {
    "label": "生成",
    "sub": "answer.py",
    "kind": "end"
   }
  ],
  "reveal": [
   3,
   4,
   5,
   5,
   5,
   5
  ]
 },
 "RAG 架構與向量庫選型#3": {
  "type": "table",
  "head": [
   "方案",
   "優點",
   "缺點"
  ],
  "rows": [
   [
    "A SQLite",
    "單一檔案、零服務",
    "全量掃描、無索引"
   ],
   [
    "B pgvector",
    "有向量型別與索引",
    "要維運 PostgreSQL"
   ],
   [
    "C Chroma/Qdrant",
    "API 方便",
    "多一個服務"
   ]
  ],
  "widths": [
   3,
   4,
   4
  ],
  "reveal": [
   1,
   1,
   2,
   2,
   3
  ]
 },
 "RAG 架構與向量庫選型#4": {
  "type": "table",
  "head": [
   "情境",
   "選擇"
  ],
  "rows": [
   [
    "一台主機、少於數萬塊",
    "SQLite"
   ],
   [
    "多人共用、整合 PostgreSQL",
    "pgvector"
   ]
  ],
  "widths": [
   5,
   3
  ],
  "reveal": [
   0,
   0,
   0,
   2,
   2,
   2
  ]
 },
 "文件切塊與嵌入#1": {
  "type": "cards",
  "cards": [
   {
    "title": "切太大",
    "points": [
     "混多個主題",
     "稀釋相似度"
    ]
   },
   {
    "title": "切太小",
    "points": [
     "語意不完整",
     "例:然後重啟它"
    ]
   },
   {
    "title": "同一嵌入模型",
    "points": [
     "建庫與查詢",
     "必須相同"
    ]
   },
   {
    "title": "維度一致",
    "points": [
     "資料庫欄位",
     "跟著模型維度"
    ]
   },
   {
    "title": "模型與金鑰",
    "points": [
     "放環境變數",
     "不寫死、不進 Git"
    ]
   }
  ],
  "reveal": [
   0,
   2,
   2,
   2,
   3,
   4,
   5
  ]
 },
 "文件切塊與嵌入#2": {
  "type": "cards",
  "cards": [
   {
    "title": "換模型沒重建",
    "points": [
     "檢索結果突然怪"
    ]
   },
   {
    "title": "向量沒正規化",
    "points": [
     "內積受長度影響"
    ]
   },
   {
    "title": "丟掉標題檔名",
    "points": [
     "回答無法引用出處"
    ]
   }
  ],
  "reveal": [
   0,
   0,
   0,
   0,
   1,
   2,
   3
  ]
 },
 "文件切塊與嵌入#5": {
  "type": "bar",
  "labels": [
   "每塊上限",
   "重疊"
  ],
  "values": [
   800,
   100
  ],
  "unit": "字元",
  "reveal": [
   2,
   2,
   2,
   2
  ]
 },
 "文件切塊與嵌入#7": {
  "type": "flow",
  "layout": "snake",
  "nodes": [
   {
    "label": "兩字配對",
    "sub": "相鄰中文字"
   },
   {
    "label": "合併詞",
    "sub": "含英文單字"
   },
   {
    "label": "256 格向量",
    "sub": "全部為零"
   },
   {
    "label": "雜湊加一",
    "sub": "詞落在哪格"
   },
   {
    "label": "正規化",
    "sub": "長度變成一",
    "kind": "end"
   }
  ],
  "reveal": [
   0,
   1,
   2,
   3,
   5
  ]
 },
 "相似度檢索、引用與拒答#1": {
  "type": "flow",
  "layout": "snake",
  "nodes": [
   {
    "label": "問題"
   },
   {
    "label": "檢索 top K",
    "sub": "內積算分"
   },
   {
    "label": "過門檻?",
    "sub": "否則拒答",
    "kind": "decision"
   },
   {
    "label": "呼叫 LLM",
    "sub": "只讀片段"
   },
   {
    "label": "附上出處",
    "sub": "程式輸出清單",
    "kind": "end"
   }
  ],
  "reveal": [
   0,
   2,
   3,
   3,
   5,
   5,
   5
  ]
 },
 "相似度檢索、引用與拒答#2": {
  "type": "cards",
  "cards": [
   {
    "title": "分隔符號",
    "points": [
     "包住檢索內容",
     "聲明只是資料"
    ]
   },
   {
    "title": "不給工具",
    "points": [
     "問答預設無工具",
     "要工具走第十章"
    ]
   },
   {
    "title": "限制寫入權限",
    "points": [
     "只收可信來源"
    ]
   },
   {
    "title": "檢查輸出",
    "points": [
     "不直接交給 shell",
     "最小權限最後防線"
    ]
   }
  ],
  "reveal": [
   1,
   2,
   3,
   4,
   4,
   4
  ]
 },
 "相似度檢索、引用與拒答#6": {
  "type": "flow",
  "layout": "row",
  "nodes": [
   {
    "label": "問題轉向量"
   },
   {
    "label": "留 ≥ 0.35",
    "sub": "否則直接拒答"
   },
   {
    "label": "組 system prompt",
    "sub": "只依文件區塊"
   },
   {
    "label": "交給 LLM"
   }
  ],
  "reveal": [
   0,
   2,
   2,
   3
  ]
 },
 "pgvector 與進階優化#1": {
  "type": "table",
  "head": [
   "步驟",
   "語法"
  ],
  "rows": [
   [
    "啟用擴充",
    "CREATE EXTENSION vector"
   ],
   [
    "建資料表",
    "embedding vector(384)"
   ],
   [
    "查詢",
    "ORDER BY embedding <=> $1 LIMIT 4"
   ],
   [
    "近似索引",
    "USING hnsw (… vector_cosine_ops)"
   ]
  ],
  "widths": [
   2,
   6
  ],
  "reveal": [
   0,
   0,
   1,
   2,
   3,
   4
  ]
 },
 "pgvector 與進階優化#2": {
  "type": "cards",
  "cards": [
   {
    "title": "混合檢索",
    "points": [
     "向量抓語意",
     "關鍵字抓精確字串"
    ]
   },
   {
    "title": "中繼資料過濾",
    "points": [
     "標籤:MySQL、Nginx、Docker",
     "先過濾再檢索"
    ]
   },
   {
    "title": "更新機制",
    "points": [
     "用檔案雜湊判斷",
     "只重建有變動的"
    ]
   },
   {
    "title": "評估集",
    "points": [
     "10~20 題已知答案",
     "調整後看命中率"
    ]
   },
   {
    "title": "拒答測試",
    "points": [
     "庫內沒答案的題目",
     "確認真的會拒答"
    ]
   }
  ],
  "reveal": [
   0,
   0,
   1,
   2,
   3
  ]
 },
 "pgvector 與進階優化#3": {
  "type": "cards",
  "cards": [
   {
    "title": "混合檢索",
    "points": [
     "向量抓語意",
     "關鍵字抓精確字串"
    ]
   },
   {
    "title": "中繼資料過濾",
    "points": [
     "標籤:MySQL、Nginx、Docker",
     "先過濾再檢索"
    ]
   },
   {
    "title": "更新機制",
    "points": [
     "用檔案雜湊判斷",
     "只重建有變動的"
    ]
   },
   {
    "title": "評估集",
    "points": [
     "10~20 題已知答案",
     "調整後看命中率"
    ]
   },
   {
    "title": "拒答測試",
    "points": [
     "庫內沒答案的題目",
     "確認真的會拒答"
    ]
   }
  ],
  "reveal": [
   3,
   4,
   5,
   5,
   5
  ]
 }
}
