Skip to main content

wordmill

A work-in-progress.

wordmill is a document summary API service. It provides a simple REST API which accepts requests to summarize a document. Under the hood, it reaches out to a LLM hosted on any OpenAI-compatible API service.

It is designed to abstract away the "AI" details from your user base. Many people in your organization want to summarize documents. Not as many of them care to know all the details related to LLMs, prompts, document prep, model selection, etc. The service will allow administrators to configure and customize these aspects based on the incoming document type. All the end users need to do is request a summary.

Setup

  1. It is recommended to install pyenv.

    NOTE: Make sure to follow all steps! (A, B, C, D, and so on)

  2. Set up the virtual environment:

    pipenv install --dev
    
  3. Add your LLM access info into .env, example:

    LLM_API_KEY=<your key>
    LLM_BASE_URL="https://my-llm-server:443/v1"
    LLM_MODEL_NAME="mistral-7b-instruct"
    

Running API server

To run the server:

pipenv shell
flask run

Example Usage of the API server

The service accepts a request to summarize the document and returns a URL that you should visit to check the status of your summary.

A background task reaches out to the LLM and awaits the response. Eventually, the status of your summarize task will shift to 'done' and you can view the LLM-generated content. Your task may also shift to 'error' if something went wrong.

Since these summaries do not need to be long-lived, currently we are using flask-caching's "SimpleCache" to store the data. For production purposes, the cache service used by flask-caching will need to be changed to redis or memcached

import json
import requests
import time

# load the document you wish to summarize
with open("incident.json") as fp:
    data = json.load(fp)

# customize the prompt passed to the LLM (optional)
requests.post(
    "http://127.0.0.1:8000/prompt",
    json={"prompt": "Please summarize this document:\n\n{document}"}
)

# submit request to summarize and get background task id
id = requests.post("http://127.0.0.1:8000/summarize", json={"document": data}).json()["id"]

# repeatedly check on the 'summarize' task and wait for summary to be generated...
while True:
    time.sleep(5)
    summary = requests.get(f"http://127.0.0.1:8000/summary/{id}").json()
    if summary["status"] == "done":
        print(summary["content"])
        break

Metadata

Release files for wordmill 0.0.2

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

Source distribution (sdist)

Source distribution for wordmill 0.0.2
File Size Uploaded
wordmill-0.0.2.tar.gz 41.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wordmill 0.0.2
File Interpreter ABI Platform
wordmill-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 51.4 kB

Release files / wordmill-0.0.2.tar.gz

Download URL wordmill-0.0.2.tar.gz
Size 41.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d1c5c7b846da5ab908f456216f88a6a7e3ce67ed2d7f7b91d5ad64ff7c09c416
BLAKE2b-256 checksum
How to use checksums
9e635ffa10266a87622205bf40ad06068138e6d52cc740c46c09e14fce328522
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 May 6, 2025.

Transparency log

Release files / wordmill-0.0.2-py3-none-any.whl

Download URL wordmill-0.0.2-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa20cbb5bc1417dcd4d02bfc203fe2b02702db3d424224ce3adc362c13d6a579
BLAKE2b-256 checksum
How to use checksums
b508acf700b42b72cf3f4e397a72a56a5770e1226cd3877bca3a91cf7c58250e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 May 6, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.2 This release

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