> 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/maiagent-user-guide/maiagent-user-guide-ja/agent-builder/knowledge-base.md).

# ナレッジベース

<figure><img src="/files/JPu3NYgAn2f0EkEAus5k" alt="ナレッジベースの概念"><figcaption><p>ナレッジベースの RAG フロー：ファイルのアップロードから Agent による参照・回答まで</p></figcaption></figure>

## これは何ですか？ <a href="#what-is-this" id="what-is-this"></a>

ナレッジベースは、Agent にとっての企業ナレッジ百科事典です。社内のドキュメント、FAQ、Web ページの内容をナレッジベースに登録しておくと、Agent はそれらの情報をもとにユーザーの質問へ回答できるようになります。

ナレッジベースを持たない Agent は、言語モデルが備える一般的な知識でしか回答できません。ナレッジベースがあって初めて、「当社の返品ポリシーは何ですか？」といった企業固有の質問に答えられるようになります。

## ナレッジベースには何を登録できますか？ <a href="#what-can-go-in-knowledge-base" id="what-can-go-in-knowledge-base"></a>

| データの種類           | 説明                    | 適したシーン               |
| ---------------- | --------------------- | -------------------- |
| **ファイルのアップロード**  | PDF、Word、Excel、TXT など | 製品マニュアル、社内規程、契約書のひな形 |
| **FAQ**          | 質問と回答のペア              | よくある質問、定型回答          |
| **クローラーによる取り込み** | Web ページから自動でコンテンツを取得  | 公式サイトの情報、公開資料        |

## データベースとは何が違いますか？ <a href="#knowledge-base-vs-database" id="knowledge-base-vs-database"></a>

これは最もよく寄せられる質問です。

|              | ナレッジベース              | データベース                   |
| ------------ | -------------------- | ------------------------ |
| **データ形式**    | 非構造化（ドキュメント、記事、FAQ）  | 構造化（テーブル、フィールド、数値）       |
| **検索方法**     | 意味検索（「返品ポリシーは何ですか？」） | SQL クエリ（「先月の売上はいくらですか？」） |
| **回答に適した内容** | 知識的な質問、ポリシーや規程、操作説明  | データの照会、統計分析、リアルタイムの状態    |

**かんたんな見分け方**：答えが「ドキュメント」の中にあるならナレッジベースを、答えが「レポート」の中にあるならデータベースを使います。

> **詳細説明**：ナレッジベースは内部で RAG（Retrieval-Augmented Generation）技術を使用しています。アップロードされたドキュメントは段落ごとに分割されてベクトルに変換され、ユーザーが質問すると、システムが最も関連性の高い段落を見つけ出し、Agent の回答の根拠として提供します。

## 私は何をすればよいですか？ <a href="#what-do-i-need-to-do" id="what-do-i-need-to-do"></a>

1. **ナレッジベースを作成する** — 名前を付け、Embedding モデルを選択します
2. **データを取り込む** — ファイルをアップロードする、FAQ を作成する、またはクローラーで取得します
3. **検索テスト** — 想定した質問を使って、ナレッジベースが正しい答えを見つけられるかをテストします
4. **Agent に紐づける** — Agent の設定でこのナレッジベースを連携します

## 関連記事 <a href="#further-reading" id="further-reading"></a>

* [ナレッジベース総覧](/maiagent-user-guide/maiagent-user-guide-ja/km/km.md)
* [ナレッジベースの作り方：基本設定](/maiagent-user-guide/maiagent-user-guide-ja/km/km-basic-settings.md)
* [FAQ（よくある質問）の作り方](/maiagent-user-guide/maiagent-user-guide-ja/km/faq.md)
* [ドキュメント管理：タグとメタデータ](/maiagent-user-guide/maiagent-user-guide-ja/km/tags-and-metadata.md)
* [検索テスト](/maiagent-user-guide/maiagent-user-guide-ja/km/test-search-result.md)


---

# 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/maiagent-user-guide/maiagent-user-guide-ja/agent-builder/knowledge-base.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.
