Skip to main content

wagtail-jev

Let Jev, TypeSafe's System One model, suggest tags for Wagtail pages. Editors get a Let Jev suggest tags button under the tag field; it scores every existing tag against the page content currently in the editor and adds the ones that pass a confidence threshold.

Each candidate tag is one yes/no (Noul) question, all fanned out in a single request. Thresholding, capping and ranking happen in your code, so tuning needs no re-inference.

Install

pip install wagtail-jev
INSTALLED_APPS = [
    "wagtail_jev",
    ...
]

WAGTAIL_JEV_API_KEY = env("TYPESAFE_API_KEY")  # or leave unset and export TYPESAFE_API_KEY

Use

from modelcluster.contrib.taggit import ClusterTaggableManager
from wagtail.models import Page

from wagtail_jev.models import JevTaggableMixin
from wagtail_jev.panels import JevTagFieldPanel


class ArticlePage(JevTaggableMixin, Page):
    intro = RichTextField(blank=True)
    body = StreamField([...], blank=True)
    tags = ClusterTaggableManager(through="blog.ArticleTag", blank=True)

    jev_text_fields = ("title", "intro", "body")  # what Jev reads
    # jev_tag_fields = {"tags": JevTagField()}    # default

    content_panels = Page.content_panels + [
        FieldPanel("intro"),
        FieldPanel("body"),
        JevTagFieldPanel("tags"),  # instead of FieldPanel("tags")
    ]

JevTagFieldPanel renders the normal tag widget plus the button. The button posts the unsaved form data to an admin endpoint, so suggestions reflect what the editor is looking at. Returned tags are appended to the tag widget; nothing is saved until the editor saves the page.

Several tag fields

A page can have any number of tag fields, each with its own tag model, prompts and threshold. Candidates default to every row of the tag model behind the field, so a feeling_tags manager whose through model points at FeelingTag is only ever offered feelings.

from wagtail_jev.classifier import PromptTemplates
from wagtail_jev.models import JevTagField, JevTaggableMixin


class ArticlePage(JevTaggableMixin, Page):
    tags = ClusterTaggableManager(through="blog.ArticleTag", blank=True)
    feeling_tags = ClusterTaggableManager(
        through="blog.ArticleFeeling", blank=True, related_name="feeling_tagged"
    )

    jev_tag_fields = {
        "tags": JevTagField(),
        "feeling_tags": JevTagField(
            templates=PromptTemplates(
                instructions="Does the mood of `article` match {tag}?",
                criteria_true="A reader would come away feeling {tag}.",
                criteria_false="{tag} does not describe the article's tone.",
            ),
            threshold=0.8,
            candidates=lambda: ["calm", "tense", "joyful"],  # optional override
        ),
    }

    content_panels = Page.content_panels + [
        JevTagFieldPanel("tags"),
        JevTagFieldPanel("feeling_tags"),
    ]

JevTagField attributes (templates, candidates, threshold, max_tags) all default to the corresponding WAGTAIL_JEV_* settings.

Bulk tagging

manage.py jev_tag_pages blog.ArticlePage            # print suggestions
manage.py jev_tag_pages blog.ArticlePage --apply    # save as new draft revisions
manage.py jev_tag_pages blog.ArticlePage --apply --publish --threshold 0.8 --ids 12 34
manage.py jev_tag_pages blog.ArticlePage --field feeling_tags   # default: all jev_tag_fields

In code

from wagtail_jev.classifier import suggest_tags

for s in suggest_tags(title=..., body=..., candidates=["python", "django"]):
    print(s.name, s.probability)

Settings

Setting Default Meaning
WAGTAIL_JEV_API_KEY None Falls back to TYPESAFE_API_KEY env var
WAGTAIL_JEV_MODEL "jev-latest" Pin a versioned ID once thresholds are tuned
WAGTAIL_JEV_THRESHOLD 0.6 Minimum probability for a tag to be suggested
WAGTAIL_JEV_MAX_TAGS None Cap on suggestions per page
WAGTAIL_JEV_MAX_CHARS 12000 Body text sent to Jev is truncated to this
WAGTAIL_JEV_BATCH_SIZE 40 Candidate tags per request
WAGTAIL_JEV_TAG_MODEL "taggit.Tag" Model whose rows are the candidate tags
WAGTAIL_JEV_CANDIDATES None Dotted path to a callable returning tag names; overrides the model
WAGTAIL_JEV_TIMEOUT 30.0 Request timeout in seconds
WAGTAIL_JEV_INSTRUCTIONS see below Question template
WAGTAIL_JEV_CRITERIA_TRUE see below What a "yes" means
WAGTAIL_JEV_CRITERIA_FALSE see below What a "no" means

Prompts

{tag} is replaced with the quoted tag name. The page is available to the model as article.title and article.body; the page's current tags as existing_tags.

WAGTAIL_JEV_INSTRUCTIONS = (
    "Would an editor file the article in `article` under the tag {tag}? "
    "Judge by the article's actual subject matter, not by incidental mentions."
)
WAGTAIL_JEV_CRITERIA_TRUE = "The article is substantially about, or clearly belongs to, the topic {tag}."
WAGTAIL_JEV_CRITERIA_FALSE = "The topic {tag} is absent or only mentioned in passing."

Per-field override: pass PromptTemplates(...) as templates on the field's JevTagField (see "Several tag fields" above).

Tuning

Start with the default threshold, run jev_tag_pages without --apply on a sample of pages, and compare against editor judgment. Raise the threshold if you see false positives; lower it or adjust the prompt if good tags are missed. Non-English content works but is less accurate; test on your own data.

Development

uv venv && uv pip install -e ".[test]"
pytest

Manual check of the editor button against a stubbed Jev client:

python tests/manual_e2e.py          # stubbed Jev, no network
python tests/manual_e2e.py --live   # real Jev; reads WAGTAIL_API_KEY or TYPESAFE_API_KEY from .env

Then log in at http://127.0.0.1:8765/admin/ as admin / pw and open the "Django tips" page.

Release files for wagtail-jev 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wagtail-jev 0.2.0
File Size Uploaded
wagtail_jev-0.2.0.tar.gz 18.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-jev 0.2.0
File Interpreter ABI Platform
wagtail_jev-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.5 kB

Release files / wagtail_jev-0.2.0.tar.gz

Download URL wagtail_jev-0.2.0.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
84f243035aa826fe4e35e6e808199193d04fcfd961949241ec417bdba6dd2f86
BLAKE2b-256 checksum
How to use checksums
ccce72a71d8fe9d7abdbd11101c368cd7a0bf8dd0a38ec3c33362b8fece84571
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / wagtail_jev-0.2.0-py3-none-any.whl

Download URL wagtail_jev-0.2.0-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0a3cc636e21915cd67aba91c0eb0a27aeef8c4a9132fadece4e0062fc10c221
BLAKE2b-256 checksum
How to use checksums
069a27eba9dfc547419e46c9cd999c203ac10b44abf719aa2b21a08198f29a6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page