Skip to main content

Get a hand writing your content with AI super powers!

Project description

Wagtail AI

Get help with your content using AI superpowers.

License: MIT PyPI version ai CI

Wagtail AI integrates Wagtail with OpenAI's APIs (think ChatGPT) to help you write and correct your content.

Right now, it can:

  • Finish what you've started - write some text and tell Wagtail AI to finish it off for you
  • Correct your spelling/grammar

Requirements & Costs

You'll need a paid OpenAI account and an API key. There'll also be some cost involved. For the API used here, OpenAI charges $0.002 for 1,000 tokens (roughly 4 characters). Every token sent to the API, and every token we get baack counts, so you can expect using 'correction' on 1,000 word paragraph to cost roughly:

  • (1,000 * 4) + (35 * 4) (for the initial prompt) tokens sent to the API
    • 4,000 tokens received from the API
  • = 8,140 tokens = $0.016

The Future

Wagtail AI is very new. Here's some things we'd like to do:

  • Streaming support - the API supports server-sent events, we could do the same
  • A nice UI - it's a bit rough right now
  • Reduce bundle size
  • Internationalisation on text and support for different language prompts
  • Find a better way to hook in to Draftail to do things like show progress bars/spinners.
  • Add more AI behaviours and features - content recommendations, content based Q&A tools, better ways to direct the prompt.
  • Tests!

If you're interested in working on these things, please do!

Links

Installation

  • python -m pip install wagtail-ai
  • Add wagtail_ai to your INSTALLED_APPS
  • Add an OPENAI_API_KEY = {api_key} to your settings key, replacing {api_key} with your OpenAI API key.

Contributing

Install

To make changes to this project, first clone this repository:

git clone https://github.com/tomusher/wagtail-ai.git
cd wagtail-ai

With your preferred virtualenv activated, install testing dependencies:

Using pip

python -m pip install --upgrade pip>=21.3
python -m pip install -e .[testing] -U

Using flit

python -m pip install flit
flit install

pre-commit

Note that this project uses pre-commit. It is included in the project testing requirements. To set up locally:

# go to the project directory
$ cd wagtail-ai
# initialize pre-commit
$ pre-commit install

# Optional, run all checks once for this, then the checks will run only on the changed files
$ git ls-files --others --cached --exclude-standard | xargs pre-commit run --files

How to run tests

Now you can run tests as shown below:

tox

or, you can run them for a specific environment tox -e python3.8-django3.2-wagtail2.15 or specific test tox -e python3.9-django3.2-wagtail2.15-sqlite wagtail-ai.tests.test_file.TestClass.test_method

To run the test app interactively, use tox -e interactive, visit http://127.0.0.1:8020/admin/ and log in with admin/changeme.

Project details


Download files

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

Source Distribution

wagtail-ai-0.1.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

wagtail_ai-0.1.0-py2.py3-none-any.whl (6.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file wagtail-ai-0.1.0.tar.gz.

File metadata

  • Download URL: wagtail-ai-0.1.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for wagtail-ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4ef5d77557728721bb3203e178ef9f8f550297eb0693d6ea20e2f3719737ce5a
MD5 b5ade0390a99d1de5c5e16db301cdd18
BLAKE2b-256 49e961cdff29557cd31675f43281537050e874d2d5444003e73ffe546986371f

See more details on using hashes here.

File details

Details for the file wagtail_ai-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for wagtail_ai-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 03226dc21ddacf9c213726a33e5b4ca9296bec2108c1849d220c44bffef01e0e
MD5 c1cf56015af45a7b46c6561502794dfd
BLAKE2b-256 527baf22623efd93717ffe94f6ebc3d19a05342374ff0512ceb56765a861cbdd

See more details on using hashes here.

Supported by

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