> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-postgresql-tls-support.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-postgresql-tls-support/rCN1jCVQ42dRy0Wp/images/use-cases/AI_ML/AIChat/1_open_chat.webp?fit=max&auto=format&n=rCN1jCVQ42dRy0Wp&q=85&s=a609ced9d409c45e44d41889c19777cc" 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-postgresql-tls-support/rCN1jCVQ42dRy0Wp/images/use-cases/AI_ML/AIChat/2_consent.webp?fit=max&auto=format&n=rCN1jCVQ42dRy0Wp&q=85&s=ede40add6865883eeb18af6d7d19e255" 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-postgresql-tls-support/rCN1jCVQ42dRy0Wp/images/use-cases/AI_ML/AIChat/3_modes.webp?fit=max&auto=format&n=rCN1jCVQ42dRy0Wp&q=85&s=32ca6a069dcc1808d8352592255aafb8" 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-postgresql-tls-support/rCN1jCVQ42dRy0Wp/images/use-cases/AI_ML/AIChat/4_thinking.webp?fit=max&auto=format&n=rCN1jCVQ42dRy0Wp&q=85&s=7b1cc02dada66a21214fb10fe8672fe8" 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-postgresql-tls-support/rCN1jCVQ42dRy0Wp/images/use-cases/AI_ML/AIChat/5_history.webp?fit=max&auto=format&n=rCN1jCVQ42dRy0Wp&q=85&s=d17f658e2405aa4ea7ef9b71f3edc2fa" 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-postgresql-tls-support/rCN1jCVQ42dRy0Wp/images/use-cases/AI_ML/AIChat/6_result_actions.webp?fit=max&auto=format&n=rCN1jCVQ42dRy0Wp&q=85&s=fbb06d51f0d451e9022a59274f572bce" 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-postgresql-tls-support/rCN1jCVQ42dRy0Wp/images/use-cases/AI_ML/AIChat/7_open_in_editor.webp?fit=max&auto=format&n=rCN1jCVQ42dRy0Wp&q=85&s=51a4060445320f300926e1ef3610ffaa" 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>
