> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/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/F7iOqwDUBB9E2S65/images/use-cases/AI_ML/AIChat/1_open_chat.webp?fit=max&auto=format&n=F7iOqwDUBB9E2S65&q=85&s=99adfce6ae6ec1ea4e895688ebcb96f2" 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/F7iOqwDUBB9E2S65/images/use-cases/AI_ML/AIChat/2_consent.webp?fit=max&auto=format&n=F7iOqwDUBB9E2S65&q=85&s=54010396eff18df4fe545f4ad70f7b57" 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/F7iOqwDUBB9E2S65/images/use-cases/AI_ML/AIChat/3_modes.webp?fit=max&auto=format&n=F7iOqwDUBB9E2S65&q=85&s=39a7ccc19b995812b0ad6115ccd8fa46" 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/F7iOqwDUBB9E2S65/images/use-cases/AI_ML/AIChat/4_thinking.webp?fit=max&auto=format&n=F7iOqwDUBB9E2S65&q=85&s=0df1ca2235dcec9f8d0f49fa6271a892" 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/F7iOqwDUBB9E2S65/images/use-cases/AI_ML/AIChat/5_history.webp?fit=max&auto=format&n=F7iOqwDUBB9E2S65&q=85&s=dea90fb7824b49a2fb5b6af0f71fa987" 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/F7iOqwDUBB9E2S65/images/use-cases/AI_ML/AIChat/6_result_actions.webp?fit=max&auto=format&n=F7iOqwDUBB9E2S65&q=85&s=409c86a0ec90d48221a6dfdffcb7945f" 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/F7iOqwDUBB9E2S65/images/use-cases/AI_ML/AIChat/7_open_in_editor.webp?fit=max&auto=format&n=F7iOqwDUBB9E2S65&q=85&s=ff40fb5f4aea3697dda1db999622d341" 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>
