> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pathors.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 為你的 Agent 外接知識庫

> 學習如何為 Pathors Agent 整合外部知識庫，提升回答準確性

本教學將指導您如何為 Pathors Agent 整合知識庫，讓 Agent 能根據文件內容自動回答問題。

## 教學影片

<iframe width="100%" height="400" src="https://www.youtube.com/embed/egmmcLEyq6w" frameborder="0" allowfullscreen />

## 概述

假設有顧客來電詢問餐廳信息，若僅靠 Prompt 難以維護所有答案，可以將 PDF、TXT 等文件上傳至知識庫，讓 AI 讀取並根據內容回覆。

## 操作步驟

1. **建立知識庫**
   * 進入 Pathors 知識庫頁面。
   * 選擇存儲方式與 Embedding Model（建議 ADA，效果最佳）。
   * 可調整知識塊大小與重疊區域，默認值已適用大多數場景。

2. **上傳文件**
   * 上傳餐廳地址、菜單、常見問答等文件。
   * 上傳後需等待 1-2 分鐘完成解析。

3. **測試搜索**
   * 嘗試搜索"素食"、"菜單"等關鍵詞，確認知識庫能正確返回信息。

4. **連接 Agent**
   * 在 Agent 設置中綁定知識庫。
   * 開啟新對話 Session 以應用最新設置。

5. **實際測試**
   * 詢問"有素食餐點嗎？""平均一人消費多少錢？"等問題，Agent 會根據文件內容回答。

## 相關資源

* [上一個教學：打造複雜對話 Agent](./pathors-tutorial-01-appendix-complex-agent)
* [下一個教學：自訂模型、整合 Google 日曆等 Agent](./pathors-tutorial-03-custom-integrations)
* [知識庫 API 文檔](/api-reference/knowledgebase)
