LLM-powered block generation and rewriting for Plone/Volto
Project description
LLM-powered Volto block generation and rewriting, built on the agentic infrastructure of eea.genai.core.
Main features
generate_blocks(user_request, context, request, properties) — produce a full blocks + blocks_layout structure from a natural-language description (blocks_generator agent).
generate_block(user_request, block_type=None, ...) — produce a single block (blocks_generator_single agent).
rewrite_blocks(blocks, style=None, ...) and rewrite_block(block, style=None, ...) — rewrite text content in one or more blocks (block_rewriter / block_rewriter_single agents).
IBlockKnowledge named-utility registry — packages declare a block type’s description, JSON schema, example, text extractor, and sanitizer. The agent’s system prompt is built from these utilities.
BlocksKnowledgeSkill enricher — injects every registered block type’s schema + example into the agent’s system prompt.
BlocksContentProvider enricher — injects the current page’s block text into the user prompt (batched IBlockKnowledge lookups, no per-block ZCA queries).
Ships block knowledge for slate, image, columnsBlock, tabs_block. Custom block types register their own via <genai:blockKnowledge>.
@llm-generate-blocks and @llm-rewrite-blocks REST endpoints.
Install
Add eea.genai.blocks to your requirements.txt.
Install the GenericSetup profile.
The four default agents are registered automatically via ZCML and can be overridden by name via the core control panel agents_json.
Adding a new block type
In your addon’s configure.zcml:
<genai:blockKnowledge
block_type="my_block"
title="My Block"
class=".knowledge.MyBlockKnowledge"
/>
In knowledge.py:
from eea.genai.blocks.interfaces import BlockKnowledge
class MyBlockKnowledge(BlockKnowledge):
description = "Describe what the block is for"
schema = '{"@type": "my_block", "value": "..."}'
example = '{"@type": "my_block", "value": "hello"}'
def text_extractor(self, block):
return block.get("value", "")
def block_sanitizer(self, block):
return block # post-LLM cleanup, return canonical dict
Generation/rewriting agents will pick up the new block type automatically — no change to agent config required.
Copyright and license
The Initial Owner of the Original Code is European Environment Agency (EEA). All Rights Reserved.
All contributions to this package are property of their respective authors, and are covered by the same license.
The eea.genai.blocks is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
Changelog
1.0 - (2026-05-21)
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file eea_genai_blocks-1.0.tar.gz.
File metadata
- Download URL: eea_genai_blocks-1.0.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8b8646c75efce9308a7ffa3cfb9c0d37811b0540ed0ff80c3ada09719a1061f
|
|
| MD5 |
42cea1111f7332826a3b5bcfb3564918
|
|
| BLAKE2b-256 |
daf67eb98ea91cd463f032b0c5d2f7df4e5739be8952954cc49b53c09db4e8e9
|