> 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/ja/org/query-builder.md).

# 「クエリビルダー」を使った構築の開始

## 連絡先クエリメタデータの設定 <a href="#contact-query-metadata-setup" id="contact-query-metadata-setup"></a>

MaiAgent のサービスにある「クエリビルダー」を使用すると、グラフィカルな操作でクエリメタデータを作成できます。ここでは、連絡先のクエリメタデータを作成する例を説明します。

### ステップ 1：MaiAgent 管理画面の連絡先エリアに移動する <a href="#step-1-enter-contact-area" id="step-1-enter-contact-area"></a>

<figure><img src="https://2584873290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTvHx8hgwYGDTLD3A7xoW%2Fuploads%2Fgit-blob-e1193c589be2e94dd3b408588d7ea9a426bb3d2a%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-07%20165727.png?alt=media" alt=""><figcaption><p>連絡先エリアの入口</p></figcaption></figure>

### ステップ 2：対象の連絡先を設定する <a href="#step-2-configure-contact" id="step-2-configure-contact"></a>

1. 設定する連絡先を見つけ、編集をクリックします

<figure><img src="https://2584873290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTvHx8hgwYGDTLD3A7xoW%2Fuploads%2Fgit-blob-3e040c93c8149b98cec909c9f006f59876673de0%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-07%20165859.png?alt=media" alt=""><figcaption><p>連絡先の編集入口</p></figcaption></figure>

2\. クリックすると、次の画面が表示されます

<figure><img src="https://2584873290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTvHx8hgwYGDTLD3A7xoW%2Fuploads%2Fgit-blob-ce1f2353f60000f676e26df8cd028b2729a238e1%2Fquery%20metadata%20maker.png?alt=media" alt=""><figcaption><p>クエリビルダーの入口</p></figcaption></figure>

クエリビルダーをクリックして、グラフィカルな操作画面を開きます。

### ステップ 3：開放する権限を選択する <a href="#step-3-select-permissions" id="step-3-select-permissions"></a>

1. 開放するナレッジベースにチェックを入れます。ナレッジベース内の一部のファイルだけを選択することもできます

<figure><img src="https://2584873290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTvHx8hgwYGDTLD3A7xoW%2Fuploads%2Fgit-blob-3cb875fe8a74fe9532e04d2d816b04dab3c3f3b3%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-07%20170306.png?alt=media" alt=""><figcaption><p>ナレッジベースとファイルの選択</p></figcaption></figure>

2\. 特定のタグに基づいてファイルを開放する場合は、「タグフィルターを表示」をクリックしてタグ設定エリアを開きます

<figure><img src="https://2584873290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTvHx8hgwYGDTLD3A7xoW%2Fuploads%2Fgit-blob-4858e1ff92d8efc4cd28216d2ff05c207215aaca%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-07%20170306-1.png?alt=media" alt=""><figcaption><p>タグフィルターの設定</p></figcaption></figure>

ここでタグを追加し、判定方法を選択できます。同じタググループ内では「<mark style="color:blue;">すべてのタグを含む（AND）</mark>」または「<mark style="color:blue;">いずれかのタグを含む（OR）</mark>」を選択し、複数の条件グループ間では「<mark style="color:blue;">すべてのグループに一致（AND）</mark>」または「<mark style="color:blue;">いずれかのグループに一致（OR）</mark>」を選択します。旧バージョンのスクリーンショットでは AND／OR ボタンとして表示されていますが、意味は同じです。これらが、開放済みのナレッジベース内でファイルを開放する基準になります。ビルダー下部の「影響を受けるファイル」パネルには、検索可能なファイルがリアルタイムで表示されます。

{% hint style="info" %}
すべての対話プラットフォームで、特定の AI アシスタントに同じタグ条件をデフォルトで適用する場合は、アシスタント設定ページで設定できます。詳しくは、[ナレッジベースのタグフィルタリング](/maiagent-user-guide/ja/build/agent/label-filter.md)を参照してください。連絡先のクエリメタデータは、アシスタントのデフォルト条件より優先されます。
{% endhint %}

## 対話設定（Message） <a href="#message-settings" id="message-settings"></a>

下図の右側メニューから、開放するナレッジ権限を選択することもできます。

<figure><img src="https://2584873290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTvHx8hgwYGDTLD3A7xoW%2Fuploads%2Fgit-blob-c197581d7292296d9555671138c8d7ed62ce5a70%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-08%20095028.png?alt=media" alt=""><figcaption><p>内部対話：利用可能なナレッジ権限を選択</p></figcaption></figure>

同様に、「タグフィルターを表示」を使用してタグフィルターの条件を設定できます

{% hint style="info" %}
各メッセージを送信する前に、右側の権限を変更してナレッジを管理できます
{% endhint %}

<figure><img src="https://2584873290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTvHx8hgwYGDTLD3A7xoW%2Fuploads%2Fgit-blob-1fd810ec8e5c4b185673a93858d73a36bca5d085%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-08%20124143.png?alt=media" alt=""><figcaption><p>利用可能なファイル一覧</p></figcaption></figure>

<figure><img src="https://2584873290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTvHx8hgwYGDTLD3A7xoW%2Fuploads%2Fgit-blob-e6b0091dcec82fe35f8d8f6f859ed8fd886249a0%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-08%20124344.png?alt=media" alt=""><figcaption><p>選択済みファイルの状態</p></figcaption></figure>

現在は、CV、SOP、アンケート調査の 3 つのファイルを参照できます。

次のメッセージを送信する前に CV のチェックを外します。

<figure><img src="https://2584873290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTvHx8hgwYGDTLD3A7xoW%2Fuploads%2Fgit-blob-9805fef0555d8b09f66eebd0114738a62852f580%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-08%20124830.png?alt=media" alt=""><figcaption><p>ファイルのチェックを外す例</p></figcaption></figure>

すると、Agent は CV ファイルを使用できなくなり、引用ライブラリにも CV の引用が表示されなくなります。

<figure><img src="https://2584873290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTvHx8hgwYGDTLD3A7xoW%2Fuploads%2Fgit-blob-18ee67d0a77a1ce864386d755225372b9f15fd63%2F%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-08%20124958.png?alt=media" alt=""><figcaption><p>CV を除外した後の引用ライブラリ</p></figcaption></figure>

メッセージを送信する前に毎回権限を調整でき、そのターンの回答で引用できる内容に反映されます。

## Web Chat 読み込み時の事前設定 <a href="#webchat-preload-settings" id="webchat-preload-settings"></a>

MaiAgent では、Web Chat が正式に初期化される前にクエリメタデータを事前設定できます。連絡先が特定される前に対話内容を制限する場合（未登録の連絡先アカウントを持つお客様に Web Chat サービスを提供する場合など）は、埋め込み時にクエリメタデータを指定できます。これにより、メッセージレベルのナレッジベースファイルフィルタリング機能がデフォルトで有効になります。

Web Chat の設定については、[技術者マニュアル：構築を始める—JSON 形式を使う](https://docs.maiagent.ai/tech/authorization-integration/zhi-shi-guan-li-quan-xian-query-metadata-cha-xun-yuan-zi-liao-zong-lan/json-interfaces#webchat-chu-shi-hua-she-ding)を参照してください。

{% hint style="info" %}
JSON 形式でクエリメタデータを構築することもできます。[技術者マニュアル：構築を始める](https://docs.maiagent.ai/tech/authorization-integration/zhi-shi-guan-li-quan-xian-query-metadata-cha-xun-yuan-zi-liao-zong-lan/json-interfaces)[—](https://docs.maiagent.ai/tech/authorization-integration/zhi-shi-guan-li-quan-xian-query-metadata-cha-xun-yuan-zi-liao-zong-lan/json-interfaces)[JSON 形式を使う](https://docs.maiagent.ai/tech/authorization-integration/zhi-shi-guan-li-quan-xian-query-metadata-cha-xun-yuan-zi-liao-zong-lan/json-interfaces)を参照してください。
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/maiagent-user-guide/ja/org/query-builder.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
