Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions website/docs/build-apps/how-to-guides/use-ask-ai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
description: Learn how to use Ask AI in Appsmith to generate and improve SQL queries and JavaScript code with natural-language prompts.
toc_min_heading_level: 2
toc_max_heading_level: 4
---

# Use Ask AI

Ask AI is an in-editor assistant that helps you write and refine code using natural-language prompts. You can use it in **SQL queries** and **JavaScript modules** (including JSObjects) to speed up development, explore your data model, and improve existing logic.

Ask AI has context about your connected datasources and database schema, so you can ask how to write queries, how to improve a query, or how to accomplish a task in JavaScript without leaving the editor.

## Prerequisites

Before you use Ask AI, ensure the following:

- Your Appsmith instance is on **v2.0 or later**. See [AI Assistant configuration](/getting-started/setup/instance-configuration/ai-assistant) for version details.
- An organization administrator has **enabled AI Assistant** and configured a provider in **Admin Settings** → **Organisation** → **AI Assistant**.
- For query-related prompts, you have a **datasource connected** to your app so Ask AI can use schema and table context.

## Open Ask AI

When AI Assistant is enabled for your organization, you can open Ask AI in either of these ways:

1. **Ask AI button** — Click the **Ask AI** button in the bottom-right corner of the query or JavaScript editor.

Check failure on line 25 in website/docs/build-apps/how-to-guides/use-ask-ai.md

View workflow job for this annotation

GitHub Actions / run_vale

[vale] reported by reviewdog 🐶 [Google.EmDash] Don't put a space before or after a dash. Raw Output: {"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "website/docs/build-apps/how-to-guides/use-ask-ai.md", "range": {"start": {"line": 25, "column": 21}}}, "severity": "ERROR"}
2. **Slash command** — In the editor, type `/ask AI` to open the Ask AI prompt.

Check failure on line 26 in website/docs/build-apps/how-to-guides/use-ask-ai.md

View workflow job for this annotation

GitHub Actions / run_vale

[vale] reported by reviewdog 🐶 [Google.EmDash] Don't put a space before or after a dash. Raw Output: {"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "website/docs/build-apps/how-to-guides/use-ask-ai.md", "range": {"start": {"line": 26, "column": 21}}}, "severity": "ERROR"}

The assistant opens in the context of the editor you are using (query or JavaScript module).

## What you can ask

Ask AI is designed for development tasks in the editor. For example, you can:

- **SQL queries** — Write a new `SELECT`, `JOIN`, or filter; add pagination; fix syntax; or optimize a slow query.

Check failure on line 34 in website/docs/build-apps/how-to-guides/use-ask-ai.md

View workflow job for this annotation

GitHub Actions / run_vale

[vale] reported by reviewdog 🐶 [Google.EmDash] Don't put a space before or after a dash. Raw Output: {"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "website/docs/build-apps/how-to-guides/use-ask-ai.md", "range": {"start": {"line": 34, "column": 18}}}, "severity": "ERROR"}
- **JavaScript** — Generate functions in a JSObject, transform API or query results, or implement UI logic.

Check failure on line 35 in website/docs/build-apps/how-to-guides/use-ask-ai.md

View workflow job for this annotation

GitHub Actions / run_vale

[vale] reported by reviewdog 🐶 [Google.EmDash] Don't put a space before or after a dash. Raw Output: {"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "website/docs/build-apps/how-to-guides/use-ask-ai.md", "range": {"start": {"line": 35, "column": 17}}}, "severity": "ERROR"}
- **Improve existing code** — Paste or select code and ask Ask AI to refactor, explain, or fix errors.

Check failure on line 36 in website/docs/build-apps/how-to-guides/use-ask-ai.md

View workflow job for this annotation

GitHub Actions / run_vale

[vale] reported by reviewdog 🐶 [Google.EmDash] Don't put a space before or after a dash. Raw Output: {"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "website/docs/build-apps/how-to-guides/use-ask-ai.md", "range": {"start": {"line": 36, "column": 28}}}, "severity": "ERROR"}

Because Ask AI is aware of your **database schema and datasource context**, prompts like “show all orders from the last 30 days” or “join customers to orders on customer id” are more accurate when your datasource is configured in the app.

## Use Ask AI in a query

1. Open or create a **query** for your datasource (for example, PostgreSQL or MySQL).
2. Open Ask AI using the **Ask AI** button or the `/ask AI` command.
3. Describe what you want in plain language—for example, “List active users created this month” or “Improve this query to use an index-friendly filter.”
4. Review the suggested SQL, then insert or edit it in your query before you run it.

<ZoomImage
src="/img/AskAIQuery.png"
alt="Ask AI open in a SQL query editor with a natural-language prompt"
caption=""
/>

<ZoomImage
src="/img/AskAIExplain.png"
alt="Ask AI helping with JavaScript in the editor"
caption=""
/>
:::tip
Connect the datasource and, where possible, select the relevant tables or run a schema discovery step in your environment so Ask AI has up-to-date context for table and column names.
:::

## Use Ask AI in JavaScript

1. Open a **JavaScript module** or **JSObject** in your app.
2. Open Ask AI from the bottom-right **Ask AI** button or type `/ask AI`.
3. Ask for help with logic—for example, “Map query results to chart labels,” “Validate email before submit,” or “Explain what this function does.”
4. Apply the suggested code to your module and test it in the app.

<ZoomImage
src="/img/AskAIJS.png"
alt="Ask AI helping with JavaScript in the editor"
caption="Using AI in JS"
/>

## Example prompts

| Goal | Example prompt |
|------|----------------|
| New SQL query | “Select name and email from users where status is active” |
| Improve SQL | “Make this query more efficient and add a limit of 100” |
| Debug SQL | “Why might this join return duplicate rows?” |
| New JavaScript | “Return an array of product names from Query1.data” |
| Explain code | “Explain this function step by step” |
| Refactor | “Rewrite this to use async/await” |

## Related documentation

- [AI Assistant configuration](/getting-started/setup/instance-configuration/ai-assistant) — Enable Ask AI and configure your AI provider (administrators).

Check failure on line 88 in website/docs/build-apps/how-to-guides/use-ask-ai.md

View workflow job for this annotation

GitHub Actions / run_vale

[vale] reported by reviewdog 🐶 [Google.EmDash] Don't put a space before or after a dash. Raw Output: {"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "website/docs/build-apps/how-to-guides/use-ask-ai.md", "range": {"start": {"line": 88, "column": 91}}}, "severity": "ERROR"}
- [Write Code in Appsmith](/write-code/how-to-guides/write-code-in-appsmith) — JavaScript, mustache bindings, and JSObjects.

Check failure on line 89 in website/docs/build-apps/how-to-guides/use-ask-ai.md

View workflow job for this annotation

GitHub Actions / run_vale

[vale] reported by reviewdog 🐶 [Google.EmDash] Don't put a space before or after a dash. Raw Output: {"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "website/docs/build-apps/how-to-guides/use-ask-ai.md", "range": {"start": {"line": 89, "column": 77}}}, "severity": "ERROR"}
- [Connect Data](/connect-data/overview) — Connect datasources so queries and Ask AI have schema context.

Check failure on line 90 in website/docs/build-apps/how-to-guides/use-ask-ai.md

View workflow job for this annotation

GitHub Actions / run_vale

[vale] reported by reviewdog 🐶 [Google.EmDash] Don't put a space before or after a dash. Raw Output: {"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "website/docs/build-apps/how-to-guides/use-ask-ai.md", "range": {"start": {"line": 90, "column": 41}}}, "severity": "ERROR"}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ You can configure your instance across the following categories:
<h3>Instance Settings</h3>
<p>Configure session policies, custom domains, SMTP, external services, Git, and other deployment-level settings.</p>
</a>

<a className="admin-card" href="/getting-started/setup/instance-configuration/ai-assistant">
<img src="/img/ai-assistant.svg" alt="AI Assistant" />
<h3>AI Assistant</h3>
<p>Enable and configure Ask AI to help users generate JavaScript and SQL queries directly from the editor.</p>
</a>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# AI Assistant

The AI Assistant section lets organization administrators configure Ask AI for the entire organization. Ask AI is the in-editor assistant that helps users generate JavaScript and SQL from natural-language prompts in JavaScript modules and queries.

API keys are encrypted and stored securely. Only organization administrators can view or change these settings.

:::note Version compatibility
AI Assistant configuration is available in Appsmith v2.0 and later (***Not Available*** *on the free hosted version using app.appsmith.com domain*). If your instance is on an earlier version, this page does not appear in Admin Settings and Ask AI is not available.
:::

<ZoomImage
src="/img/ai-assistant-settings.png"
alt="AI Assistant Configuration settings in Admin Settings"
caption=""
/>

## AI Assistant Configuration

#### Enable AI Assistant



Turn Ask AI on or off for your organization. When enabled, all users in your organization can use AI assistance in JavaScript modules and queries.

When disabled, Ask AI entry points are hidden and users cannot generate code with the assistant.



#### AI Provider



Select the AI provider that powers Ask AI for your organization. The provider you choose determines which API key and model fields appear on this page. At this time, the following models are supported:
- Claude (Anthropic)
- OpenAI (ChatGPT)
- Azure Open AI
- Local hosted Ollama


For example, **Claude (Anthropic)** uses your Anthropic API key and Claude model settings.



#### Claude API Key



Enter your Anthropic API key so Appsmith can call Claude on behalf of your organization. The key is encrypted and stored securely.

- Leave the field blank when saving other settings if you want to keep the existing key.
- Get an API key from the [Anthropic Console](https://console.anthropic.com/).



#### Model



Specify the Claude model Appsmith should use for Ask AI responses.

**Default:** `claude-sonnet-4-6`

**Examples:** `claude-sonnet-4-6`, `claude-haiku-4-5-20251001`



#### Base URL



Set the API base URL for Anthropic requests.

**Default:** `https://api.anthropic.com`

Change this value only if you use a proxy or a custom API endpoint.



## Save and validate configuration

#### Test Key



Click **Test Key** to verify that your API key, model, and base URL are valid before saving. Use this to confirm connectivity without applying changes to your organization.

After you click **Test Key**, Appsmith shows the results of the connection check, including API key format, connection, and authentication status. The example below shows a failed test with troubleshooting suggestions:

<ZoomImage
src="/img/AskAI-TestKey.png"
alt="API key test results showing authentication failure"
caption=""
/>

#### Save Configuration



Click **Save Configuration** to apply your AI Assistant settings. Changes take effect for all users in the organization after the save completes.

For instructions on using Ask AI in the editor, see [Use Ask AI](/build-apps/how-to-guides/use-ask-ai).

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ Follow these steps to update Appsmith to latest version on your self-hosted inst
These instructions are applicable to platforms using Docker, including Docker standalone, AWS AMI, and similar platforms:

:::caution Important
If your current version is older than v1.9.2. Refer to the [Upgrade to Checkpoint Version (v1.9.2)](/getting-started/setup/instance-management/upgrade-to-checkpoint-version) guide before updating Appsmith to the latest release.
We have two checkpoints:
- If your current version is newer than v1.9.2, but less than v1.96-v1.99 then you must upgrade to any version between v1.96 to v1.99 prior to upgrading to version 2.0+.
- If your current version is older than v1.9.2. Refer to the [Upgrade to Checkpoint Version (v1.9.2)](/getting-started/setup/instance-management/upgrade-to-checkpoint-version) guide before updating Appsmith to the latest release.
:::

1. Locate your Appsmith installation directory by running:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ toc_max_heading_level: 2
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Upgrade to Checkpoint Version (v1.96-v1.99)
It is very important if you have Appsmith installed and are on a version greater than v1.9.2 but less than v1.96 through v1.99 - that you upgrade
first to one of the version (v1.96-v1.99) prior to upgrading to Appsmith 2.0 or newer. If you attempt to upgrade, you will see in the logs failures
and will have to roll back and then upgrade to version v1.99 (recommneded). Only then can you upgrade to v2.0 or newer.

# Upgrade to Checkpoint Version (v1.9.2)

Checkpoint versions are milestone releases that ensure your Appsmith instance applies necessary database schema updates, optimizations, and compatibility fixes. If your current Appsmith version is older than `v1.9.2`, upgrading to this checkpoint version is mandatory before moving to later releases. This page provides step-by-step instructions to upgrade your self-hosted Appsmith instance to checkpoint version `v1.9.2`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Canceling your subscription or downgrading your plan will result in the loss of
* **Branding** - Custom branding will no longer be available, and your application will use the default Appsmith branding.
* **Audit logs** - Access to audit logs will no longer be available, and Appsmith will not generate new audit logs.
* **Embed apps** - You won't be able to embed private apps within your parent application after downgrading if the Single Sign-On (SSO) method is not available in the downgraded plan.
* **Ask AI** - Access to Ask AI for generating SQL queries and JavaScript code within the editor will no longer be available.
* **Ask AI** - Access to [Ask AI](/getting-started/setup/instance-configuration/ai-assistant) for generating SQL queries and JavaScript code within the editor will no longer be available.
* **Sending messages from the parent app to Appsmith** - Any interactions between the parent app and Appsmith will no longer be available after downgrading. You may have to change your application code if your application captures or interacts with messages from the parent application.

## Cancel subscription
Expand Down
2 changes: 2 additions & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ const sidebars = {
'getting-started/setup/instance-configuration/profile', // Profile & Organisation
'getting-started/setup/instance-configuration/user-management', // User Management
'getting-started/setup/instance-configuration/instance-settings', // Instance Settings
'getting-started/setup/instance-configuration/ai-assistant', // AI Assistant
],
},

Expand Down Expand Up @@ -480,6 +481,7 @@ const sidebars = {
`build-apps/how-to-guides/download-table-data`,
'connect-data/how-to-guides/how-to-download-files-using-api',
`core-concepts/writing-code/ui-actions`,
'build-apps/how-to-guides/use-ask-ai',
'connect-data/how-to-guides/send-emails-using-the-SMTP-plugin',
'build-apps/how-to-guides/generate-pdf-dynamically',
`build-apps/how-to-guides/display-select-options-dynamically`,
Expand Down
Binary file added website/static/img/AskAI-TestKey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/static/img/AskAIExplain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/static/img/AskAIJS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/static/img/AskAIQuery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/static/img/ai-assistant-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions website/static/img/ai-assistant.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading