> 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/tech/ja/quickstart/rag.md).

# RAG ナレッジベース検索システム

RAG（Retrieval-Augmented Generation、検索拡張生成）は、検索（Retrieval）と生成（Generation）の技術を組み合わせた生成 AI の技術アーキテクチャです

外部データベースまたはナレッジベースから情報を検索し、その検索結果を大規模言語モデルと組み合わせることで、より正確で文脈に即した回答を生成します。

RAG 技術の中核は、生成 AI の言語能力とナレッジ検索能力を組み合わせることです。モデルは質問に回答する際、内部の学習データだけに依存せず、外部データベースから最新かつ専門性の高い情報を動的に取得し、その情報を生成する回答に取り込むことができます。

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-0ce05108866ecded0daa5a9fb3cd8b9137ffef26%2F2%20(1).png?alt=media" alt=""><figcaption><p>RAG の処理フロー</p></figcaption></figure>

## 高精度な RAG システム

{% hint style="info" %}
RAG ナレッジベース検索システムは、ベクトル検索（Vector Search）を使用することで基本版を迅速に構築できますが、回答精度をさらに向上させることは容易ではありません。回答精度はユーザー体験にとって極めて重要であり、システムの回答に対するユーザーの信頼度と満足度に直接影響します。回答精度が不十分な場合、ユーザーはシステムの回答に疑問を抱き、利用意欲が低下する可能性があります。
{% endhint %}

2023 年の OpenAI 開発者会議で公開された情報によると、RAG システムは単純なベクトル類似度検索（Vector Search）のみを使用し、適切な埋め込みモデル（Embedding Model）を選択した場合、45% の精度を達成できます。さらに、HyDE Retrieval、FT Embeddings、Chunk/Embedding Experiments を追加すると、回答精度を 65% まで高めることができます。

MaiAgent RAG は、OpenAI 開発者会議で紹介された RAG 技術に加え、さまざまな従来型 NLP アルゴリズムと独自の検索技術を組み合わせています。社内データセットを用いて OpenAI RAG と回答の正確性を比較した結果、どちらも 95% の回答精度を達成しています。

<figure><img src="https://605688223-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYMUz6J7vDZ0QTvb1rbN%2Fuploads%2Fgit-blob-6fd9eacb0dfc5dd2c1245505296717d272468f11%2Fimage%20(19).png?alt=media" alt="" width="561"><figcaption><p>MaiAgent RAG の回答精度</p></figcaption></figure>

MaiAgent プラットフォームでは、MaiAgent RAG と OpenAI RAG の 2 種類の RAG を提供しています。各項目の比較は次のとおりです。

|                    | MaiAgent RAG                                                                     | OpenAI RAG                                                               |
| ------------------ | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| モデル対応              | すべてのモデルに対応 👍                                                                    | OpenAI モデルのみに対応                                                          |
| 環境対応               | クラウドとオンプレミスに対応 👍                                                                | クラウドのみに対応し、データを OpenAI に送信する必要があります                                      |
| 回答精度               | 非常に高い 👍                                                                         | 非常に高い 👍                                                                 |
| 対応ファイル形式           | 一般的なすべての形式に対応 👍 doc, docx, xls, xlsx, csv, ppt, pptx, pdf, txt, json, jsonl, md | <p>xlsx、csv は非対応<br>jsonl は非対応<br>旧形式の Office ファイル（doc、xlsx、ppt）は非対応</p> |
| 文書内の画像             | 対応（現在は実験的な機能）👍                                                                  | 非対応                                                                      |
| 文書内の表              | 対応（現在は実験的な機能）👍                                                                  | 非対応                                                                      |
| 会話への添付ファイルのアップロード  | 対応 👍                                                                            | 対応 👍                                                                    |
| データ分割の透明性          | 可視化 👍                                                                           | ブラックボックス                                                                 |
| デバッグの難易度           | 標準 👍                                                                            | ブラックボックスのためデバッグ不可                                                        |
| Top K の調整          | エンタープライズ版のカスタマイズ機能 👍                                                            | 非対応                                                                      |
| Embedding モデルの切り替え | エンタープライズ版のカスタマイズ機能 👍                                                            | 非対応                                                                      |


---

# 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/tech/ja/quickstart/rag.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.
