> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-trino-dialect.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ClickHouse Assistant in ClickHouse Cloud

> Learn about, enable, and use ClickHouse Assistant in the ClickHouse Cloud console

export const Image = ({img, alt, size = "lg", background}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  const backgroundColor = background === "white" ? "white" : background === "black" ? "rgb(31 31 28)" : undefined;
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} style={{
    backgroundColor
  }} />
      </Frame>
    </div>;
};

ClickHouse Assistant lets you use natural language to analyze data in a ClickHouse Cloud service. It can generate queries, visualizations, and summaries using context such as active tabs, saved queries, schemas, and dashboards.

The Assistant also includes a Docs AI mode for asking questions grounded in the ClickHouse documentation. Use this guide to enable the Assistant and work with both modes in the ClickHouse Cloud console.

<Steps>
  <Step title="Prerequisites" id="prerequisites">
    1. You must have access to a ClickHouse Cloud organization with AI features enabled (contact your org admin or support if unavailable).
  </Step>

  <Step title="Open the AI Chat panel" id="open-panel">
    1. Navigate to a ClickHouse Cloud service.
    2. In the left sidebar, click the sparkle icon labeled “ClickHouse Assistant”.
    3. (Shortcut) Press <kbd>⌘</kbd> + <kbd>'</kbd> (macOS) or <kbd>Ctrl</kbd> + <kbd>'</kbd> (Linux/Windows) to toggle open.

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/FK17EgxaHf1vQ3q-/images/use-cases/AI_ML/AIChat/1_open_chat.webp?fit=max&auto=format&n=FK17EgxaHf1vQ3q-&q=85&s=31d39d249c9370e4c15405b25408d184" alt="Open AI Chat flyout" size="md" width="1762" height="1364" data-path="images/use-cases/AI_ML/AIChat/1_open_chat.webp" />
  </Step>

  <Step title="Accept the data usage consent (first run)" id="consent">
    1. On first use you're prompted with a consent dialog describing data handling and third‑party LLM sub-processors.
    2. Review and accept to proceed. If you decline, the panel won't open.

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/FK17EgxaHf1vQ3q-/images/use-cases/AI_ML/AIChat/2_consent.webp?fit=max&auto=format&n=FK17EgxaHf1vQ3q-&q=85&s=468f87ee53a99c11cf45c0fd1a7f476e" alt="Consent dialog" size="md" width="1342" height="922" data-path="images/use-cases/AI_ML/AIChat/2_consent.webp" />
  </Step>

  <Step title="Choose a chat mode" id="modes">
    AI Chat currently supports:

    * **Agent**: Multi‑step reasoning over schema + metadata (service must be awake).
    * **Docs AI (Ask)**: Focused Q\&A grounded in official ClickHouse documentation and best‑practice references.

    Use the mode selector at the bottom-left of the flyout to switch.

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/FK17EgxaHf1vQ3q-/images/use-cases/AI_ML/AIChat/3_modes.webp?fit=max&auto=format&n=FK17EgxaHf1vQ3q-&q=85&s=128369df4536c16ba475015a60dae326" alt="Mode selection" size="sm" width="584" height="262" data-path="images/use-cases/AI_ML/AIChat/3_modes.webp" />
  </Step>

  <Step title="Compose and send a message" id="compose">
    1. Type your question (e.g. “Create a materialized view to aggregate daily events by user”).
    2. Press <kbd>Enter</kbd> to send (use <kbd>Shift</kbd> + <kbd>Enter</kbd> for a newline).
    3. While the model is processing you can click “Stop” to interrupt.
  </Step>

  <Step title="Understanding “Agent” thinking steps" id="thinking-steps">
    In Agent mode you may see expandable intermediate “thinking” or planning steps. These provide transparency into how the assistant forms its answer. Collapse or expand as needed.

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/FK17EgxaHf1vQ3q-/images/use-cases/AI_ML/AIChat/4_thinking.webp?fit=max&auto=format&n=FK17EgxaHf1vQ3q-&q=85&s=611317cbd8d17bf240b4a21643cfa2b4" alt="Thinking steps" size="md" width="1702" height="1180" data-path="images/use-cases/AI_ML/AIChat/4_thinking.webp" />
  </Step>

  <Step title="Starting new chats" id="new-chats">
    Click the “New Chat” button to clear context and begin a fresh session.
  </Step>

  <Step title="Viewing chat history" id="history">
    1. The lower section lists your recent chats.
    2. Select a previous chat to load its messages.
    3. Delete a conversation using the trash icon.

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/FK17EgxaHf1vQ3q-/images/use-cases/AI_ML/AIChat/5_history.webp?fit=max&auto=format&n=FK17EgxaHf1vQ3q-&q=85&s=8b45d7632c464afa1b3b05e6d3eab569" alt="Chat history list" size="md" width="1754" height="634" data-path="images/use-cases/AI_ML/AIChat/5_history.webp" />
  </Step>

  <Step title="Working with generated SQL" id="sql-actions">
    When the assistant returns SQL:

    * Review for correctness.
    * Click “Open in editor” to load the query into a new SQL tab.
    * Modify and execute within the Console.

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/FK17EgxaHf1vQ3q-/images/use-cases/AI_ML/AIChat/6_result_actions.webp?fit=max&auto=format&n=FK17EgxaHf1vQ3q-&q=85&s=95883b1a99ff22ef95a95478cba06575" alt="Result actions" size="md" width="1746" height="1362" data-path="images/use-cases/AI_ML/AIChat/6_result_actions.webp" />

    <Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/FK17EgxaHf1vQ3q-/images/use-cases/AI_ML/AIChat/7_open_in_editor.webp?fit=max&auto=format&n=FK17EgxaHf1vQ3q-&q=85&s=bef439754228421a24b8936dfa001a2d" alt="Open generated query in editor" size="md" width="1662" height="284" data-path="images/use-cases/AI_ML/AIChat/7_open_in_editor.webp" />
  </Step>

  <Step title="Stopping or interrupting a response" id="interrupt">
    If a response is taking too long or diverging:

    1. Click the “Stop” button (visible while processing).
    2. The message is marked as interrupted; you can refine your prompt and resend.
  </Step>

  <Step title="Keyboard shortcuts" id="shortcuts">
    | Action       | Shortcut             |
    | ------------ | -------------------- |
    | Open AI Chat | `⌘ + '` / `Ctrl + '` |
    | Send message | `Enter`              |
    | New line     | `Shift + Enter`      |
  </Step>
</Steps>
