Skip to main content

LLM-powered block generation and rewriting for Plone/Volto

Project description

Develop Master

LLM-powered Volto block generation and rewriting, built on the agentic infrastructure of eea.genai.core.

Main features

  1. generate_blocks(user_request, context, request, properties) — produce a full blocks + blocks_layout structure from a natural-language description (blocks_generator agent).

  2. generate_block(user_request, block_type=None, ...) — produce a single block (blocks_generator_single agent).

  3. 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).

  4. 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.

  5. BlocksKnowledgeSkill enricher — injects every registered block type’s schema + example into the agent’s system prompt.

  6. BlocksContentProvider enricher — injects the current page’s block text into the user prompt (batched IBlockKnowledge lookups, no per-block ZCA queries).

  7. Ships block knowledge for slate, image, columnsBlock, tabs_block. Custom block types register their own via <genai:blockKnowledge>.

  8. @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.

Changelog

1.0 - (2026-05-21)

  • Initial release

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eea_genai_blocks-1.0.tar.gz (25.2 kB view details)

Uploaded Source

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

Hashes for eea_genai_blocks-1.0.tar.gz
Algorithm Hash digest
SHA256 a8b8646c75efce9308a7ffa3cfb9c0d37811b0540ed0ff80c3ada09719a1061f
MD5 42cea1111f7332826a3b5bcfb3564918
BLAKE2b-256 daf67eb98ea91cd463f032b0c5d2f7df4e5739be8952954cc49b53c09db4e8e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page