clausal-decide
Calibrated decisions as relations, for Clausal Prolog.
A "System 1" decision model answers a set of typed questions about a text (pick a label, yes or no, a level on a scale) in one forward pass, with calibrated probabilities. This package runs such a model, either the open laya model or TypeSafe's hosted Jev, and makes its answers relations — neural predicates whose solutions carry probabilities, for symbolic logic to filter, rank and combine:
choice/4,5— pick a label; or enumerate every label with its probabilitynoul/3— the probability that a yes/no answer is yesscore/4,5— a level on a scale; or every level with its probabilitypredict/3,4— several questions in one forward passpredict_batch/3,4— the same questions over many texts, sharing forward passesuse_backend/1,2— the open laya model in-process (default), alaya-serveserver, or TypeSafe's hosted Jev model, which answers the same questionsfinetune/5,register_model/2— fine-tune a checkpoint (on rows your program's own facts can label) and serve it by name
Install
pip install clausal-decide
laya (with torch and transformers) is pulled in as a dependency. Requires
Python 3.13 or later. laya downloads its checkpoint from the Hugging Face Hub
on first use. For the typesafe backend:
pip install "clausal-decide[typesafe]" and set TYPESAFE_API_KEY.
Use
Import the predicates into a seam (.seam) module, as the package's own
tests do. A Clausal Prolog (.clausal) module reaches Python only through
the seam: put the imports in a .seam module and list it under
[tool.clausal] python_bridges in your project's pyproject.toml (see
Importing Prolog).
This example, from tests/fixtures/docs/decide_examples.seam,
escalates a ticket when the model thinks the customer is leaving:
-import_from(py.decide, [noul])
escalate(TICKET) <- (
noul(TICKET, "Does the user threaten to cancel or leave?", P),
P > 0.5
)
test("a cancellation threat escalates") <- (
escalate("Refund the duplicate charge today or we will cancel our plan.")
)
Documentation
License
MIT
Metadata
Release files for clausal-decide 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clausal_decide-0.1.0.tar.gz | 16.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clausal_decide-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.7 kB
Release files / clausal_decide-0.1.0.tar.gz
| Download URL | clausal_decide-0.1.0.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5e3df20e3c286b41d4fd7aeb221ecd46f1cea2cbad6469f60d62d78b1b7300a
|
|
BLAKE2b-256 checksum How to use checksums |
35f56fa646b480f99d042c8f927e5cf90705f99e171c15535097971c9401c6b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 7, 2026.
Transparency logRelease files / clausal_decide-0.1.0-py3-none-any.whl
| Download URL | clausal_decide-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
908a2a8feaa7e1dd349c00c604c03dc4c370fafe7ccd4753b9be2c8d2e92e6c2
|
|
BLAKE2b-256 checksum How to use checksums |
13c75b1f8e61f19e0bd10bdffff5d612e57d658b1f494b9d84cc287a0b78a920
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 7, 2026.
Transparency log