Skip to main content

adjudicate

A small library for one pattern: a detector proposes a span in a document and a short list of candidate replacements; a local language model picks one of them, or KEEP, from the surrounding sentence and a rule of thumb; the applier splices the choice in with case preserved. Every change is a bounded, logged, reasoned edit. The model never rewrites prose.

It is the toolkit behind stylefix (US/UK spelling and style) and proofix (typos, punctuation, commas). It is published because they depend on it; the API may change between 0.x releases.

pip install adjudicate

Modules: llm (OpenAI-compatible client and endpoint resolution), core (Item, Decision, Cache, adjudicate, question; Cache.put_user records a user's answer, which a model decision never overwrites), apply (Edit, apply_edits), context (sentence context, Markdown prose regions; protected spans cover code, front matter, links, HTML and, for Obsidian, wikilinks and embeds, %%comments%%, #tags, $maths$, callout markers and ^block-ids), changes (derive, apply and compose labelled changes between texts), dictionary (Hunspell lookups over the bundled en_US and en_GB dictionaries), setup (run_setup and check_endpoint, behind the tools' --setup and --check-endpoint).

Choosing the model endpoint

resolve_endpoint(app, preset="auto", url=None, model=None, key=None, think=False, timeout=None) merges settings from, highest first:

  1. its arguments (the calling tool's --url, --model, --timeout)
  2. <APP>_LLM_URL, <APP>_LLM_MODEL, <APP>_LLM_KEY, e.g. STYLEFIX_LLM_URL
  3. ~/.config/<app>/config.toml
  4. ADJUDICATE_LLM_URL, ADJUDICATE_LLM_MODEL, ADJUDICATE_LLM_KEY
  5. ~/.config/adjudicate/config.toml, shared by every tool

($XDG_CONFIG_HOME replaces ~/.config when set.) Layers merge field by field, except that a layer naming a url drops the model, key and thinking_switch of the layers below it, since those described another server. With no url anywhere, a local Ollama is used if it is running with a model pulled; otherwise there is no model and callers fall back to listing items for review.

configured_settings(app) gives layers 2 to 5 merged the same way, as {key: (value, source)}, without asking a server anything. api_key_env stays the variable's name. A tool uses it to keep the saved key when its user picks another model on the same server.

[llm]
url = "https://api.example.com/v1"   # any OpenAI-compatible base URL
model = "some-model"                  # optional: the server's first listed model
api_key_env = "EXAMPLE_API_KEY"       # or api_key = "..."; not both
timeout = 120                         # seconds per request
thinking_switch = false               # true for vLLM/LiteLLM serving a reasoning model

thinking_switch = true sends chat_template_kwargs: {enable_thinking: false}, which vLLM honours and strict APIs reject; if a server answers 400 or 422 to it, it is dropped for the rest of the run. Unknown keys, wrong types, empty strings, a timeout that is not positive, and an api_key_env naming an unset variable are errors (ConfigError), so a typo is never silently ignored. An api_key_env is read only if it survives the merge: a higher layer's url or key discards it first.

License

The code is MIT (see LICENSE). The dictionaries in adjudicate/dict/ keep their own licenses: en_US under the SCOWL notice in LICENSE-en_US.txt, en_GB under the LGPL as stated in LICENSE-en_GB.txt.

Metadata

Release files for adjudicate 0.3.7

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

Source distribution (sdist)

Source distribution for adjudicate 0.3.7
File Size Uploaded Provenance Actions
adjudicate-0.3.7.tar.gz 640.5 kB With provenance Details for adjudicate-0.3.7.tar.gz

Built distribution (wheel)

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

Total release size: 1.3 MB

Release files / adjudicate-0.3.7.tar.gz

Download URL adjudicate-0.3.7.tar.gz
Size 640.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2d422206e5f5a11c333d07683a6cdfe363b9b30e2cf56bfa208027a8240df147
BLAKE2b-256 checksum
How to use checksums
7f6e14d77054dc002a81c52938c27464edbb0f6cc2bbbef1eb190d5120550726
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Release files / adjudicate-0.3.7-py3-none-any.whl

Download URL adjudicate-0.3.7-py3-none-any.whl
Size 638.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a7a64b7e781c99dd2675419a1c97359c5860a4fbc143491ec9df8dc5776f669
BLAKE2b-256 checksum
How to use checksums
5dec6368ef44f900674eba1b58cb92ca71b5cd01ef1f1a1897755fd789984ba5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Security for adjudicate 0.3.7

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for adjudicate-0.3.7.tar.gz

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 Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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