Puck AI 0.6 adds tool binding APIs for stricter tool use, the prepareRequest API for easy request manipulation, and the ability to exclude components. See the AI overview for more information on Puck AI.
In this post, we’ll go over everything new in Puck AI 0.6 and how you can start using it:
You can also find in-depth documentation in our AI docs.
Tool binding lets you strictly bind the result of a tool to a field. The tool will be called inline as the page is being generated based on the agent’s intent for this field.
To use tool binding, set ai.bind to the name of your tool.
const config = {
components: {
ImageBlock: {
fields: {
src: {
type: "text",
ai: {
// Strictly set this field the response of the `getImageUrl` tool
bind: "getImageUrl",
},
},
},
// ...
},
},
};When using tool binding, Puck AI will only ever use the result of the tool for this field, making it completely deterministic.
The prepareRequest() API allows you to modify the request made by the AI plugin before being sent to your Puck cloud endpoint:
const aiPlugin = createAiPlugin({
prepareRequest: async (options) => {
return {
headers: {
Authorization: "Bearer my-token",
},
};
},
});Set ai.exclude on any Puck component to prevent the model from adding it to the page.
const config = {
components: {
HeadingBlock: {
fields: {
title: { type: "text" },
},
ai: {
exclude: true, // Don't include this in pages
},
// ...
},
},
};Note, your component still requires a valid config even if excluded.
The plugin package now exposes all AI types for strictly typing your integration.
Run the following command to install the latest version of Puck AI packages:
npm install @puckeditor/cloud-client@latest @puckeditor/plugin-ai@latestPuck AI is now in open beta. Sign up