-
Notifications
You must be signed in to change notification settings - Fork 67
Executing summarization ability with @wordpress/abilities in WordPress 7.0 doesn't work due to invalid schema #346
Copy link
Copy link
Closed
Description
Description
I was testing the changes mentioned in https://make.wordpress.org/core/2026/03/24/client-side-abilities-api-in-wordpress-7-0/ with the summarization ability but couldn't get it executed.
Step-by-step reproduction instructions
Example snippet:
/**
* Generates an AI summary for our review text using the WordPress Abilities API.
*
* The Abilities API is a Script Module (`@wordpress/abilities`), so it must be
* loaded via dynamic `import()` from classic scripts. Server-registered abilities
* (like `ai/summarization`) are available when `@wordpress/core-abilities` is
* enqueued, which WP 7.0 does on all admin pages.
*
* Falls back to `null` when the Abilities API or the ai/summarization ability
* is not available.
*
* @param text The review text to summarize.
* @return The generated summary, or null on failure.
*/
export async function generateSummary(
text: string
): Promise< string | null > {
try {
const { executeAbility } = await import(
/* webpackIgnore: true */ '@wordpress/abilities'
);
const result = await executeAbility( 'ai/summarization', {
content: text,
length: 'medium',
} );
return typeof result === 'string' && result.length > 0
? result
: null;
} catch ( error ) {
console.error( 'Error generating AI summary:', error );
return null;
}
}The first error:
Schema compilation error: Error: schema is invalid: data/properties/length/type must be equal to one of the allowed values, data/properties/length/type must be array, data/properties/length/type must match a schema in anyOf
Error generating AI summary: Error: Ability "ai/summarization" has invalid input. Reason: Invalid schema provided for validation.
After fixing the type in I got another one:
Schema compilation error: Error: strict mode: unknown keyword: "sanitize_callback"
Error generating AI summary: Error: Ability "ai/summarization" has invalid input. Reason: Invalid schema provided for validation.
This one I'm not sure how to fix.
Screenshots, screen recording, code snippet
No response
Environment info
- WordPress 7.0 RC
- AI 0.6.0
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except the AI plugin.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Type] BugSomething isn't workingSomething isn't working
Type
Fields
Give feedbackNo fields configured for issues without a type.