> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/km/km-basic-settings.md).

# 如何建立知識庫：基本設置

## 基本設置 <a href="#basic-settings" id="basic-settings"></a>

### 一般資訊 <a href="#general-info" id="general-info"></a>

您可以在以下頁面自行定義知識庫的名稱，並為其增添描述：

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-54f12e2752ebeaec380a1b6a733f6924f051901b%2Fimage%20(162)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

#### 檢索片段 <a href="#retrieval-chunk" id="retrieval-chunk"></a>

檢索片段數量代表 AI 助理回答時會參考的資料片段數量上限，系統預設為「12」，代表每次回答時 AI 助理將會檢索 12 個最相關的片段進行回答。

因此，您可以增加或減少檢索的片段，調整 AI 助理在回答時參考的資訊數量。

#### 相似度門檻值 <a href="#similarity-cutoff" id="similarity-cutoff"></a>

相似度門檻值用來排除與問題不夠相關的片段。片段的相似度分數低於門檻時，不會被檢索出來。可輸入 `0` 到 `1` 之間的數值，最小調整單位為 `0.01`；留空或設為 `0` 代表不過濾。

{% hint style="warning" %}
門檻設得較高會收窮檢索結果，但也可能排除原本有用的內容。請每次小幅調整，並用同一組問題比較搜尋結果。
{% endhint %}

\*\*使用情境：\*\*客服主管小晴發現「退貨條件」的搜尋測試偶爾帶入不相關的配送說明。她先記下原本的檢索結果，再調高相似度門檻值並儲存，最後使用同一個問題重新測試。如果退貨政策片段仍會出現，而配送說明已被排除，就可保留這個設定。

{% stepper %}
{% step %}
進入 <mark style="color:blue;">知識庫</mark>，在要調整的知識庫右側點選「編輯」。
{% endstep %}

{% step %}
切換至 <mark style="color:blue;">檢索設定</mark>。
{% endstep %}

{% step %}
在「相似度門檻值（0-1）」輸入數值。
{% endstep %}

{% step %}
點選「儲存」，再以[搜尋測試](/km/test-search-result.md)重新測試原本的問題。
{% endstep %}
{% endstepper %}

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-1f92b9392f40154090184d986cdae610b3ad7d56%2Fknowledge-base-similarity-threshold-prod.png?alt=media" alt="知識庫檢索設定中的相似度門檻值欄位"><figcaption><p>在檢索設定調整相似度門檻值</p></figcaption></figure>

### 解析器（Parser）是什麼？ <a href="#what-is-parser" id="what-is-parser"></a>

解析器（Parser）讓系統能夠「理解」上傳文件中的內容，使其可以被搜索、編輯或轉換為其他格式使用。

#### 文件解析器 <a href="#document-parser" id="document-parser"></a>

上傳 PDF、Word 等文件時，可選擇以下四種解析器：

* **MaiAgent Parser（預設）**：成本低、速度快，適合純文字文件，支援 22 種格式
* **MaiAgent Parser（Online）**：使用 LLM，可 OCR 解析圖片中的文字，支援 20 種格式
* **MaiAgent Parser（Offline）**：OCR + AI 理解圖片語意，結構保留最佳，可落地部署，支援 20 種格式
* **Vision Parser**：AI 視覺理解，圖片解析效果最佳，支援 7 種格式

#### 語音轉文字解析器 <a href="#speech-to-text-parser" id="speech-to-text-parser"></a>

上傳音訊檔案時，可選擇以下四種語音轉文字解析器：

* **Azure Speech**：即時轉錄，準確度高
* **Whisper（Groq）**：速度最快、成本低
* **Whisper（OpenAI）**：穩定可靠的雲端方案
* **Whisper（Offline）**：完全本地部署，免費且保障資料隱私

音訊解析完成後，可透過「檢視文件」查看逐字稿，並支援下載 TXT 或 SRT 格式的逐字稿檔案：

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-4469fbd2dab86116ded00a868c6bf6519a116bbb%2Faudio-parser-transcript.png?alt=media" alt=""><figcaption><p>逐字稿檢視畫面</p></figcaption></figure>

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-b982b40158acfa3b364c8728a4c293b96d6d2476%2Faudio-parser-download.png?alt=media" alt=""><figcaption><p>下載逐字稿（支援 TXT 與 SRT 格式）</p></figcaption></figure>

{% hint style="info" %}
欲了解各解析器的詳細比較，請參考：[技術人員手冊 - Parser 解析工具](https://docs.maiagent.ai/tech/quickstart/parser)
{% endhint %}

如果在解析資料出現問題，您也可以點擊 \[重新解析] 圖示，讓解析器重新整理資料。

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-b1c70f5112f57c1c727a73031f12536b2942a475%2F%E6%88%AA%E5%9C%96%202025-04-25%20%E4%B8%8A%E5%8D%8810.58.20.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 複雜版面文件的調整方式 <a href="#complex-layout-documents" id="complex-layout-documents"></a>

產品型錄、規格書等文件若同時包含雙欄排版、跨頁表格和圖片，解析正確不代表每次問答都會取得完整內容。建議依照「解析結果 → 檢索結果 → 回答結果」的順序逐步檢查：

1. **先選擇適合內容的解析器**：純文字文件可使用預設解析器；需要保留欄位、表格結構時，優先比較 MaiAgent Parser（Offline）的結果；問題若集中在圖片中的標示、零件外觀或圖文關係，則比較 Vision Parser 的結果。
2. **檢查解析後的 Markdown**：在文件頁面開啟「<mark style="color:blue;">檢視文件</mark>」，確認左右欄閱讀順序、表格標題、欄名、列資料及圖片說明是否仍位於同一段落。若內容已在此處交錯或缺漏，請更換解析器後重新解析；必要時將來源文件改為單欄，或把重要表格另存為 `.xlsx`、`.csv` 或 Markdown 後上傳。
3. **用代表性問題做搜尋測試**：分別測試產品名稱、表格中的精確欄位，以及需要跨列比較的問題，確認所需資料是否出現在檢索片段中。若正確片段排在檢索範圍之外，可逐步增加「檢索片段」數量並比較結果；增加片段也會帶入更多不相關內容，因此不建議一次調到最大值。
4. **讓每個片段可獨立理解**：表格若被切開，請在各段補上產品名稱、規格類別、欄位名稱與單位。對回答完整度要求高的資料，可另外建立 FAQ，將常問的比較題整理成一組完整問答。
5. **確認圖片的用途**：Parser 可辨識圖片文字或圖像語意，但不保證回答會自動顯示原圖。若使用者必須看到圖片，請確認解析後的 Markdown 中保留圖片，且包含圖片的片段有被檢索到；同時以實際使用的對話管道測試顯示結果。若只需要圖片中的規格資訊，建議把關鍵文字、圖號與圖片說明一併寫入文件。

{% hint style="info" %}
一次只調整一項設定，並用同一組問題重新執行[搜尋測試](/km/test-search-result.md)，才能判斷改善來自解析器、文件內容或檢索設定。
{% endhint %}

### 檢索模型設定 <a href="#retrieval-model-settings" id="retrieval-model-settings"></a>

在知識庫設置中，可以自行選擇希望使用的 Embedding 模型及 Reranker 模型。

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-f2edcb10e65032ef8a72460780cddb6098e9ef98%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-18%20162323.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Embedding 模型 <a href="#embedding-model" id="embedding-model"></a>

Embedding 就像是將人類語言翻譯成 AI 能理解的「數字語言」，讓電腦能夠理解文字的真正含義，這個過程我們稱之為「向量化」。而不同的 Embedding 模型擁有不同的特性，如擅長處理的語言、支援的部署環境等，知識庫內不同的模型設定可以用於調整知識庫文件再上傳時向量化處理的效果，您可以針對不同的情境選擇最適合的 Embedding 模型。

您可以自由選擇多種 Embedding 的模型：

{% hint style="info" %}
欲了解 Embedding 模型差異，請參考：[技術人員手冊—Embedding 模型](https://docs.maiagent.ai/tech/quickstart/embedding#maiagent-zhi-yuan-de-embedding-mo-xing)
{% endhint %}

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-b09e35c2979ba0975859ec2f9aad856413671c21%2Fimage%20(184).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Reranker 模型 <a href="#reranker-model" id="reranker-model"></a>

Reranker 就像是一位專業評審，在初步搜尋結果中，重新評估哪些資料最能回答客戶問題。使用 Reranker 與否的效果有哪些差別呢？

當客戶問到：「新手適合什麼帳篷？預算 8000 元以下」

**沒有 Reranker：**

```
AI 可能回答：
「我們有各種價位的帳篷，8000元的產品包括...」
（可能提到進階款式，不夠針對新手需求）
```

**有 Reranker：**

```
AI 回答：
「為新手特別推薦這幾款 8000 元以下的帳篷...」
（精準針對新手+預算+產品推薦）
```

當啟用搜尋結果重排序 (Reranking) 時，AI 助理就會重新將搜尋到的知識庫內容片段排序，依照最相關文件做出回應。

{% hint style="info" %}
欲了解 Reranker 模型，請參考：[技術人員手冊—Reranker 模型](https://docs.maiagent.ai/tech/quickstart/reranker#maiagent-ti-gong-de-reranker-mo-xing)
{% endhint %}

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-f2edcb10e65032ef8a72460780cddb6098e9ef98%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-18%20162323.png?alt=media" alt=""><figcaption></figcaption></figure>

綜合上述，使用 Embedding 結合 Reranker 就能夠讓 AI 助理理解您提供的知識，並且在檢索片段後再次檢視內容重要性，使用和問題最相關的知識回應。

***

### 關聯 AI 助理 <a href="#link-ai-agent" id="link-ai-agent"></a>

#### 多個 AI 助理共用知識庫 <a href="#multiple-agents-share-knowledge-base" id="multiple-agents-share-knowledge-base"></a>

關聯 AI 助理即是您希望將此知識庫授權給哪些 AI 助理使用。若您有兩個 AI 助理：

* **產品客服 AI**
* **訂單客服 AI**

兩者都需要回答和退貨相關的問題時，您可以在「<mark style="color:blue;">退貨政策</mark>」的知識庫設定下，一次關聯以上兩個 AI 助理：

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-050bc6e9b49de8ecd69ccc5d0719df2d8c5326fa%2Fplayma%20(2).png?alt=media" alt=""><figcaption><p>關聯多個 AI 助理示意圖</p></figcaption></figure>

1. 選擇要關聯的 AI 助理

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-6d98094fcf1ad0c07772079cd71f5fe7af41e558%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-18%20170201.png?alt=media" alt=""><figcaption></figcaption></figure>

2. 點按新增 AI 助理

新增後會出現在已選 AI 助理區域，點按右下角「保存」後即關聯成功。

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-fd3512cefd3322b580b117c929ffaad7d3dd5ded%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-19%20102309%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

當關聯後，兩個 AI 助理就能夠共用「<mark style="color:blue;">退貨政策</mark>」的知識庫，根據同樣的內容進行回答，後續維護只需要**更新一個知識庫**就能保證 AI 助理使用最新資料。

#### 一個 AI 助理使用多個知識庫 <a href="#one-agent-multiple-knowledge-bases" id="one-agent-multiple-knowledge-bases"></a>

除了共用知識庫外，一個 AI 助理也能使用多個知識庫。

1. 進入 AI 助理頁面，選擇想設定的 AI 助理，點選設置

<div><figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-6b214953a8896226337054ea6d5afe4a5e4e7ebf%2Fimage%20(197).png?alt=media" alt=""><figcaption></figcaption></figure> <figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-88c68e4bc4d8d3d06b484412c99830e620e59695%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-19%20105727%20(1).png?alt=media" alt="" width="563"><figcaption></figcaption></figure></div>

2. 進入模型設置，點擊「選擇知識庫」

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-493bafadb0a2a44fcf1eddbdccd7318ab181719d%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-19%20105930.png?alt=media" alt=""><figcaption></figcaption></figure>

3. 選擇要使用的知識庫並按下確認，已選擇的知識庫就會出現在列表中

<div><figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-0f01116b66369c0080fc66acad7da442565bc6c0%2Fimage%20(200).png?alt=media" alt=""><figcaption></figcaption></figure> <figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-4a63d4c894ab6f05bf8e923f527278338450dd1f%2Fimage%20(201).png?alt=media" alt=""><figcaption></figcaption></figure></div>

4. 最後按下「儲存」，AI 助理就能使用多個知識庫了


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.maiagent.ai/km/km-basic-settings.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
