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

# AIアシスタント

{% hint style="info" %}
AIエージェント機能を利用できるワークスペースでは、AIアシスタントの代わりに[Codatum Agent](/codatum-ai/ai-agent.md)が表示されます。AIエージェントは、SQL生成に加えてデータ探索、クエリ実行、Notebookの作成・編集などに対応しています。
{% endhint %}

<figure><img src="/files/bXAfp6vPGCZSU00HYJCb" alt=""><figcaption></figcaption></figure>

AIアシスタントは、ユーザーの意図を理解し、必要なSQLを生成する機能です。

自然言語で実行したい分析や生成したいSQLを伝えることで、AIアシスタントはそれに応じてSQLを生成または修正します。

## 利用できる条件

AIアシスタントは、ご利用のプランでAIエージェント機能が提供されていないワークスペースで使用できます。AIエージェント機能を利用できるプランでは、同じ操作箇所にAIエージェントが表示され、AIアシスタントを個別に選択することはできません。

## セットアップ方法

`ワークスペース設定` > `オプション` > `Codatum AI`でAIアシスタントを有効にします。有効にした後、SQLブロックを選択し、右上のAIアイコンから使用できます。

## 主な機能と使用方法

* SQL生成:
  * SQLブロックを作成した後、アシスタントが参照するテーブルを選択し、実行したい分析を指定します。
* SQL修正:
  * 修正したいSQLブロックを選択し、どのように修正するかをアシスタントに指示します。
* SQL自動修正:
  * エラーのあるSQLブロックで`AIで修正`を選択すると、修正が必要なSQL文とエラーメッセージに基づいて、アシスタントが修正を行います。

## データプライバシー

これらのリクエストは、選択したLLMプラットフォームに送信されますが、トレーニング目的では使用されません。

主な機能に含まれるデータは以下の通りです：

* SQLブロック内のSQL文
* 参照テーブルのスキーマとSQL実行結果のスキーマ（以下で指定）:
  * SQLブロック内で参照されるテーブルとSQLブロック
  * GUI上で明示的に参照されるテーブル
* ユーザーが入力したリクエストメッセージ

{% hint style="info" %}
独自のAPIキーでSQLアシスタント機能を使用するには、チャットまたは`support@codatum.com`までお問い合わせください。
{% 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.codatum.jp/codatum-ai/ai-assistant.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.
