Skip to content

4.0.0-rc1

Pre-release
Pre-release

Choose a tag to compare

@lsmith77 lsmith77 released this 20 Nov 18:27
· 195 commits to dev since this release

The first release candidate of 4.0.0. It turns Witty GPT into a guardrail API that LLM and agent gateways can call, and replaces PDM with uv. It updates every dependency with known vulnerabilities, and tightens how API keys, request text and Redis connections are handled. A major version because endpoints, authentication order and API key storage change in ways clients and operators have to act on. Pull requests #1271 to #1285.

Before you upgrade

Clients

  • /v1.0/prompt, /debug/prompt and /debug/review_prompt are removed (#1271). Use /v1.0/write, or the guardrail endpoints /v1.0/guardrail/input, /v1.0/guardrail/output and /v1.0/guardrail/guidance. The dashboard's Witty GPT page used /v1.0/prompt and needs moving.
  • An x-key header now decides authentication, ahead of a Bearer token (#1271). A wrong x-key no longer falls back to the token.
  • POST /api_key and DELETE /api_key take the key in a JSON body (#1285). POST takes {"api_key": …, "email": …} and DELETE takes {"api_key": …}. Query parameters are no longer read, and GET /api_key is removed. A key must have at least 20 letters, digits, - or _. A key that belongs to another email is refused with 409.

Operators

  • With API_KEY_HMAC_KEY set, keys are looked up by their digest only (#1283). Keys minted before the secret was set stop working until you run this once, before the next key-file sync:

    uv run python -m bin.api_key rehash
  • Redis over TLS checks the server's certificate (#1285). With REDIS_VERIFY_SSL on (the default), a Redis whose certificate does not check out is refused at startup. Point REDIS_SSL_CA_CERTS at a private CA. REDIS_VERIFY_SSL=false (plain TCP, as in compose.yml) is unchanged.

  • Building or developing locally uses uv, not PDM (#1277). The spaCy models are no longer in the lock (#1284): install them after uv sync with uv run python -m bin.install_spacy_models, and use uv sync --inexact when adding a dependency group, or uv removes them.

  • The context-checker download (bin/download_from_huggingface.py) fetches a pinned revision and copies the files (#1280, #1284). Run it again, so models/context_aware_model holds files instead of symlinks into .cache.

Security

  • Dependencies: every package with a known vulnerability is updated, and pip-audit finds none in any dependency group. Among them:
    • FastAPI 0.165 with Starlette 1.10, pyjwt, cryptography, aiohttp, urllib3 and litellm (#1278);
    • torch 2.15, transformers 5, sentence-transformers 6 and setfit 1.2 (#1279);
    • black, pytest and ddtrace (#1281).
  • Removed from the image: Blackfire, which is now an optional profiling dependency group (#1278), and lxml 4.9.4 with wiktionary-de-parser (#1278, #1284). The image now installs exactly the lock, with hashes (#1284).
  • Sentry: events no longer carry the x-key API key or a query string, and every request body field goes through the privacy filter (#1285).
  • The log: a model's prose answer to a rephrasing is logged by length, not text (#1285). An LLM provider's refusal is logged with the guardrail's name, not its reason (#1282).
  • API keys: rehash moves keys in watched transactions and reports conflicts. The management endpoints never put a key in a URL or an error (#1283, #1285). The start logs a warning when REQUIRE_API_KEY is on without API_KEY_HMAC_KEY (#1285).
  • CI: Dependabot watches uv.lock, and a daily pip-audit fails on a vulnerable lock (#1281, #1284).

Changed

Guardrail API (new)

  • The endpoints:
    • /v1.0/guardrail/input adds inclusive-language guidance to the messages for a model;
    • /v1.0/guardrail/output checks a model's answer and returns a verdict, the findings and a reask;
    • /v1.0/guardrail/guidance gives the bare guidance text;
    • an adapter serves LiteLLM's generic guardrail API (#1271).
  • Thresholds and default: they are set per level and as a ratio, and the default is assistance rather than enforcement (#1275).
  • The guidance is added once, including when a client sends its conversation back each turn (#1285).
  • "config": null means no config (#1285).

LLM routes

  • /v1.0/write is rebuilt on the guardrail endpoints (#1271). An empty draft is answered with 502 (#1285).
  • A text the LLM provider refuses is answered with 422 instead of 500, with the deployment's LLM_REFUSED_MESSAGE or the provider's reason (#1282).
  • The reask prompt has a line break after the quoted answer and its wording fixed (#1285).

Other

  • /v2.0/features sends Vary: x-key, Authorization (#1283). Browsers no longer show an answer cached for another credential.
  • The rules database stays in memory, instead of a stray file in the working directory (#1274).

Settings

  • New: LLM_REFUSED_MESSAGE (#1282), REDIS_SSL_CA_CERTS (#1285) and the guardrail threshold configuration (#1275).

Process

  • Ethics: pull requests are screened against the Witty Works data ethics questions, and record decisions and cut features in their descriptions (#1273, #1276).
  • CI: it runs against the project's LanguageTool image (#1272), and builds the image whenever its inputs change (#1277).

Image: ghcr.io/witty-works/nlp_api:4.0.0-rc1, digest sha256:160f3255a6c8caa5d703565e5b37fb608e2ca05e72465263cf09e3703ac4d372.