Puck AI closed beta
Read docs
API ReferenceAIAI PlugincreateAiPlugin

createAiPlugin

Create a plugin that shows a chat interface for interacting with Puck AI.

import { createAiPlugin } from "@puckeditor/plugin-ai";
import "@puckeditor/plugin-ai/styles.css";
 
const aiPlugin = createAiPlugin();
 
export function Editor() {
  return (
    <Puck
      plugins={[aiPlugin]}
      // ...
    />
  );
}

Params

ParamExampleTypeStatus
chat.examplePromps{}Object-
chat.onSubmit(prompt) => console.log(prompt)Function-
host"https://www.example.com/api/puck"String-

Optional params

chat.examplePrompts

Example prompts to show beneath the text input. Will send the prompt on click.

const chatPlugin = chat({
  examplePrompts: [
    { label: "Landing page", prompt: "Create a landing page about dogs" },
  ],
});

chat.onSubmit(prompt)

A callback that receives the prompt when the user submits the form.

const chatPlugin = chat({
  onSubmit: (prompt) => console.log(prompt),
});

host

Configure the API host that the plugin will call during a chat. This should be your server.