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

# AI Assistant

{% hint style="info" %}
In workspaces where the AI Agent feature is available, [Codatum Agent](/ai-assist/ai-agent.md) is displayed instead of AI Assistant. In addition to SQL generation, Codatum Agent supports data exploration, query execution, and Notebook creation and editing.
{% endhint %}

<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.

## Availability

AI Assistant is available in workspaces whose plan does not include the AI Agent feature. On plans that include AI Agent, AI Agent is displayed in the same locations and AI Assistant cannot be selected separately.

## How to Set Up

Go to `Workspace Settings` > `Options` > `Codatum AI` and enable AI Assistant. After enabling it, select an SQL Block and use the AI icon in its upper-right corner.

## 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
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.com/ai-assist/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.
