Repository navigation
4.0.0-rc1
Pre-releaseThe 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/promptand/debug/review_promptare removed (#1271). Use/v1.0/write, or the guardrail endpoints/v1.0/guardrail/input,/v1.0/guardrail/outputand/v1.0/guardrail/guidance. The dashboard's Witty GPT page used/v1.0/promptand needs moving.- An
x-keyheader now decides authentication, ahead of a Bearer token (#1271). A wrongx-keyno longer falls back to the token. POST /api_keyandDELETE /api_keytake the key in a JSON body (#1285).POSTtakes{"api_key": …, "email": …}andDELETEtakes{"api_key": …}. Query parameters are no longer read, andGET /api_keyis removed. A key must have at least 20 letters, digits,-or_. A key that belongs to another email is refused with409.
Operators
-
With
API_KEY_HMAC_KEYset, 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_SSLon (the default), a Redis whose certificate does not check out is refused at startup. PointREDIS_SSL_CA_CERTSat a private CA.REDIS_VERIFY_SSL=false(plain TCP, as incompose.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 syncwithuv run python -m bin.install_spacy_models, and useuv sync --inexactwhen 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, somodels/context_aware_modelholds files instead of symlinks into.cache.
Security
- Dependencies: every package with a known vulnerability is updated, and
pip-auditfinds none in any dependency group. Among them: - Removed from the image: Blackfire, which is now an optional
profilingdependency 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-keyAPI 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:
rehashmoves 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 whenREQUIRE_API_KEYis on withoutAPI_KEY_HMAC_KEY(#1285). - CI: Dependabot watches
uv.lock, and a dailypip-auditfails on a vulnerable lock (#1281, #1284).
Changed
Guardrail API (new)
- The endpoints:
/v1.0/guardrail/inputadds inclusive-language guidance to the messages for a model;/v1.0/guardrail/outputchecks a model's answer and returns a verdict, the findings and a reask;/v1.0/guardrail/guidancegives 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": nullmeans no config (#1285).
LLM routes
/v1.0/writeis rebuilt on the guardrail endpoints (#1271). An empty draft is answered with502(#1285).- A text the LLM provider refuses is answered with
422instead of500, with the deployment'sLLM_REFUSED_MESSAGEor the provider's reason (#1282). - The reask prompt has a line break after the quoted answer and its wording fixed (#1285).
Other
/v2.0/featuressendsVary: 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.