> For the complete documentation index, see [llms.txt](https://docs.cherry-ai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cherry-ai.com/docs/jp/knowledge-base/data.md).

# ナレッジベースデータ

このページは、ナレッジベースの内部動作メカニズムを知りたいユーザー向けです。ナレッジベースを使うだけなら、直接 [ナレッジベースチュートリアル](/docs/jp/knowledge-base/knowledge-base.md)。

## 基本原理

ナレッジベースに追加された文書は**小さな断片に分割され → 埋め込みモデルによって数値ベクトルに変換され → ローカルデータベースに保存されます**。質問時には、ナレッジベースが質問を同種のベクトルに変換し、最も類似した断片を検索して、それらの断片を会話モデルにコンテキストとして提供します。

<figure><img src="/files/33d66205fe8f0548a2d2bdabab36e50daf228af1" alt=""><figcaption><p>ナレッジベース処理フローチャート</p></figcaption></figure>

## もう少し詳しく

1. **取り込み前の準備**
   * 文書（PDF、Word、Webページなど）はまず [ドキュメント前処理](/docs/jp/knowledge-base/document-preprocessing.md)（OCR など）を経て、プレーンテキストになります
   * プレーンテキストは、検索しやすいように200〜500文字程度の小さな断片（チャンク）に分割されます
2. **埋め込みと保存**
   * 各断片は [埋め込みモデル](/docs/jp/knowledge-base/emb-models-info.md) で処理され、数値の列（ベクトル）が得られます
   * これらの数値 + 元の文書断片はすべて Cherry Studio のローカルデータベース（オープンソースの libSQL ベース）に保存されます
3. **検索**
   * あなたが質問すると、質問文も同様に埋め込みモデルによって数値に変換されます
   * システムは「質問の数値に最も似ている」いくつかの断片を見つけ出します
   * これらの断片は質問と一緒に会話モデルへ送られ、そこで最終回答が生成されます

## データ保存場所

**すべてのデータはローカルに保存されます**、クラウドにはアップロードされません（使用している埋め込みモデル自体がクラウドサービスの場合、テキスト断片は埋め込み処理の過程で一時的にそのサービスを経由します）。

* **macOS**に由来する：`~/Library/Application Support/CherryStudio`
* **Windows**に由来する：`%APPDATA%\CherryStudio`
* **Linux**に由来する：`~/.config/CherryStudio`

## データプライバシーの推奨

資料に機微情報（契約書、医療情報、社内コードなど）が含まれる場合：

* 使用する**ローカル埋め込みモデル**（例えば [Ollama](/docs/jp/pre-basic/providers/ollama.md) または [LM Studio](/docs/jp/pre-basic/providers/lm-studio.md) 実行 `bge-m3`）を使えば、全工程オフライン
* 会話モデルも同様にローカルデプロイを選ぶことを推奨します
* 併せて [保存先を変更](/docs/jp/pre-basic/personalization-settings/storage.md) データを暗号化ディスクに保存できます

## 参考資料

* ベクトルデータベース（libSQL / Turso）：<https://turso.tech/libsql>
* 埋め込みと検索拡張生成："vector embedding"、"RAG"に関する資料を参照できます

***

### 💡 ヘルプの取得とフィードバックの送信

設定や使用の過程で疑問、Bug、機能改善の提案がある場合は、 [フィードバックと提案](/docs/jp/question-contact/suggestions.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.cherry-ai.com/docs/jp/knowledge-base/data.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.
