Generate experiences with Puck AI
Read docs
CloudAPI referenceplugin-aiAiFieldType

AiFieldType

Describes how Puck AI handles a user-defined field type, passed to createAiPlugin().

import type { AiFieldType } from "@puckeditor/plugin-ai";
 
const cta: AiFieldType = {
  description: "Renders a branded call-to-action button",
  schema: { type: "object", properties: { label: { type: "string" } } },
};

Give a schema, a defaultValue, or both. For ai.generate(), use AiGenerateFieldType.

Params

ParamExampleTypeStatus
defaultValuedefaultValue: { label: "Countdown" }Any | Function-
descriptiondescription: "Renders a branded CTA"String-
schemaschema: { type: "string" }JSON Schema-

defaultValue

The value to use when adding this field.

Can be any value, or a function that receives some information about the instance:

{
  defaultValue: ({ componentName, fieldName }) => fieldName;
}

description

A description of this field for the model.

schema

The schema Puck AI should use to generate this field.