Skip to main content

AI Content Marking for Laravel

Article 50 of the EU AI Act asks that content an AI system generates is marked in a machine-readable format, and that people can tell it was generated. An application that writes product descriptions, summaries or replies with a language model needs the same two things in every place it hands that text out: a marker a tool can find, and a notice a person can read.

This package gives you both, as two separate pieces:

  • a marking that travels with the content: written where a text is delivered, as schema.org microdata in HTML and beside the text in JSON, and inside an image as XMP, kept through every conversion the media library derives from it;
  • a notice component that renders the words a reader sees, wherever your page puts it.
composer require pushery/ai-content-marking-for-laravel

The service provider is registered automatically through package discovery.

A first marked text​

use Pushery\AiContentMarking\MarkedText;

$description = MarkedText::generated($modelOutput, generator: 'Amazon Bedrock');
<x-ai-content-marking::notice :marking="$description->marking" />
<p>{{ $description->html() }}</p>

The page then carries the notice "Created using Generative AI" and, around the text, microdata that names the IPTC term trainedAlgorithmicMedia:

<p class="ai-content-marking-notice">Created using Generative AI</p>
<p><span itemscope itemtype="https://schema.org/CreativeWork"><link itemprop="digitalSourceType" href="https://schema.org/TrainedAlgorithmicMediaDigitalSource"><span itemprop="text">…</span></span></p>

The vocabulary​

A marking names how the content came about with a term of the IPTC Digital Source Type vocabulary, the one schema.org's digitalSourceType property and Google Merchant Center's structured attributes build on. IPTC defines its terms for images, video, audio and text alike. Two of them say that generative AI was involved:

TermIPTC labelUse it for
trainedAlgorithmicMediaCreated using Generative AItext a model wrote
compositeWithTrainedAlgorithmicMediaEdited using Generative AItext a person wrote and a model then rewrote

Pushery\AiContentMarking\DigitalSourceType carries all seventeen current terms.

Pages​

  • Marking text: MarkedText, its forms for HTML, JSON and plain strings, rich HTML, and storing a marking with a model.
  • The notice: the component, its element, and the words in seven languages.
  • Reading markings: finding the markings a page carries, for your own tests.
  • Marking images: XMP written and read by value, C2PA manifests recognized, conversions of the media library that keep the marking, and a check of your own pipeline.
  • Marking mail: a header field a DKIM signature can cover, and a reader that names the signatures listing it.
  • Model register and gap report: whether each model watermarks its text, and every output held against the layers of marking the Code of Practice asks of text.
  • Configuration: every setting, its environment variable and its default.
  • What it does not do: the legal question the package leaves to you, and the marking techniques it does not provide.