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

# Use ClickHouse Assistant chat in ClickHouse Cloud

> Guide to enabling and using the AI Chat feature in ClickHouse Cloud Console

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

> This guide explains how to enable and use the AI Chat feature 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-detect-table-modification/pp61YI9DMmfgXVsV/images/use-cases/AI_ML/AIChat/1_open_chat.webp?fit=max&auto=format&n=pp61YI9DMmfgXVsV&q=85&s=e6ca411fde8f85af29eca3344f32a12b" 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-detect-table-modification/pp61YI9DMmfgXVsV/images/use-cases/AI_ML/AIChat/2_consent.webp?fit=max&auto=format&n=pp61YI9DMmfgXVsV&q=85&s=2c23641e5b4fe3f2d9074efde2ae33c0" 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-detect-table-modification/pp61YI9DMmfgXVsV/images/use-cases/AI_ML/AIChat/3_modes.webp?fit=max&auto=format&n=pp61YI9DMmfgXVsV&q=85&s=485fa9c515b763c1d6adaa0b78fb6afa" 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-detect-table-modification/pp61YI9DMmfgXVsV/images/use-cases/AI_ML/AIChat/4_thinking.webp?fit=max&auto=format&n=pp61YI9DMmfgXVsV&q=85&s=a10b67c236ec7336d14db8856e3c93a5" 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-detect-table-modification/pp61YI9DMmfgXVsV/images/use-cases/AI_ML/AIChat/5_history.webp?fit=max&auto=format&n=pp61YI9DMmfgXVsV&q=85&s=719ce94c7f0d417926a83123c6de2ede" 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-detect-table-modification/pp61YI9DMmfgXVsV/images/use-cases/AI_ML/AIChat/6_result_actions.webp?fit=max&auto=format&n=pp61YI9DMmfgXVsV&q=85&s=4447b965b50964525834b3e541558098" 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-detect-table-modification/pp61YI9DMmfgXVsV/images/use-cases/AI_ML/AIChat/7_open_in_editor.webp?fit=max&auto=format&n=pp61YI9DMmfgXVsV&q=85&s=13ef1fc0eb3148a656d03af17c1a0131" 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>
