> 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/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="/files/PEfJJBA01RkUkLA1TcGc" alt=""><figcaption><p>連絡先エリアの入口</p></figcaption></figure>

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

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

<figure><img src="/files/y0FtE3dSDJKSKPA5UKYV" alt=""><figcaption><p>連絡先の編集入口</p></figcaption></figure>

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

<figure><img src="/files/Ty5Dlp92ziblijW3Lyj6" alt=""><figcaption><p>クエリビルダーの入口</p></figcaption></figure>

クエリビルダーをそのままクリックすると、グラフィカルな操作画面に入ります

### ステップ 3：開放したい権限にチェックを入れる <a href="#step-3-select-permissions" id="step-3-select-permissions"></a>

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

<figure><img src="/files/MpmzrrDXkv0byrHx2EVN" alt=""><figcaption><p>ナレッジベースとファイルの選択</p></figcaption></figure>

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

<figure><img src="/files/8LygoKrx2ScADY4trocE" alt=""><figcaption><p>タグフィルター設定</p></figcaption></figure>

ここでは作成したい判定条件を選択できます。開放済みのナレッジベース内のファイルを開放する基準として、`"OR"`（いずれかの条件に一致）または `"AND"`（すべての条件に一致）を選択できます

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

下図の右側メニューを使って、開放したいナレッジ権限を選択することもできます：

<figure><img src="/files/f7rwqLfcdfYs9TlncTn6" alt=""><figcaption><p>内部対話：利用可能なナレッジ権限を選択</p></figcaption></figure>

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

{% hint style="info" %}
異なるメッセージを送信するたびに、右側の権限を変更してナレッジ管理を行うことができます
{% endhint %}

<figure><img src="/files/DVRNXuZP0Yjulw57jx2y" alt=""><figcaption><p>利用可能なファイル一覧</p></figcaption></figure>

<figure><img src="/files/p9sQCx1bCBomuZf6MrWM" alt=""><figcaption><p>選択済みファイルの状態</p></figcaption></figure>

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

次のメッセージで CV のチェックを外したうえで、再度メッセージを送信します：

<figure><img src="/files/DoexZ67ShhGmkB4dWpHf" alt=""><figcaption><p>ファイルのチェックを外す例</p></figcaption></figure>

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

<figure><img src="/files/SjQOTvSoK1oMGnWakh0r" 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 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/org/query-builder.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.
