# AI Assistant

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

AI Assistant is a feature that understands your intent and generates the necessary SQL for you.

By telling the analysis you want to perform or the SQL you want to generate in natural language, AI Assistant generates or modifies SQL accordingly.

## How to Set Up

Navigate to `Workspace settings > Codatum AI` and enable it. After enabling it, you can use SQL Assistant by choosing an SQL Block and clicking the top right corner of it.

## Key Features and How to Use

* SQL Generation:
  * After creating an SQL Block, select the table to be referenced by the Assistant and specify the analysis you want to perform.
* SQL Modification:
  * Select the SQL Block you want to modify and instruct the Assistant on how to modify it.
* SQL Auto Fix:
  * By selecting `Fix with AI` on an SQL Block that has an error, the Assistant will perform corrections based on the SQL statements that need fixing and the error messages.

## Data Privacy

These requests are sent to each LLM platform you choose but are not used for training purposes.

The data included in key features are as follows:

* SQL statement within the SQL block
* The schema of the referenced table and the schema of the result of the SQL execution, as specified in:
  * Tables and SQL Blocks referenced within the SQL block
  * Tables explicitly referenced in the GUI
* Request messages input by the user

{% hint style="info" %}
To use SQL Assistant feature with your own API key, please contact us via chat or `support@codatum.com`
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://docs.codatum.com/ai-assist/ai-assistant.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
