Metadata-Version: 2.4
Name: typesafe-decisions
Version: 0.1.0
Summary: Small, typed building blocks for semantic decisions in Python.
Author-email: Kai Schinnen <k.schinnen@proton.me>
License-Expression: MIT
Project-URL: Documentation, https://kaischinnen.github.io/typesafe-decisions/
Project-URL: Repository, https://github.com/kaischinnen/typesafe-decisions
Project-URL: Issues, https://github.com/kaischinnen/typesafe-decisions/issues
Keywords: ai,decisions,semantic,typesafe
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: httpx2<3,>=2.13.0
Requires-Dist: typesafe-sdk<0.8,>=0.7.1
Provides-Extra: docs
Requires-Dist: mkdocstrings[python]<2,>=1.0.6; extra == "docs"
Requires-Dist: zensical<0.1,>=0.0.60; extra == "docs"
Dynamic: license-file

# typesafe-decisions

**Small, typed building blocks for semantic decisions in Python.**

[![Tests](https://github.com/kaischinnen/typesafe-decisions/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/kaischinnen/typesafe-decisions/actions/workflows/tests.yml)
![Python 3.11+](https://img.shields.io/badge/Python-3.11%2B-3776AB?logo=python&logoColor=white)
![Status: Experimental](https://img.shields.io/badge/status-experimental-F59E0B)

`typesafe-decisions` is an experimental convenience layer around TypeSafe
System One. It turns semantic judgments into ordinary Python values that an
application can use for routing, thresholds, and other decisions.

The project currently contains a `DecisionClient` for TypeSafe-backed
decisions and a small, independent `llm()` helper for text generation through
Cloudflare AI Gateway.

> [!WARNING]
> This project is unofficial, pre-release software. Its public API may change.

## Quick start

Install the current development version from a checkout:

```bash
python -m pip install -e .
export TYPESAFE_API_KEY="your-api-key"
```

```python
from typesafe_decisions import DecisionClient

with DecisionClient() as decisions:
    team = decisions.match(
        "I was charged twice for the same order.",
        "Which team should handle this ticket?",
        {
            "Billing": "Charges, invoices, and payment problems",
            "Returns": "Refunds, exchanges, and damaged items",
        },
    )

print(team)
```

See the [documentation](https://kaischinnen.github.io/typesafe-decisions/)
for setup, [application examples](https://kaischinnen.github.io/typesafe-decisions/examples/),
concepts, guides, and the API reference.

## Development

Create a virtual environment, install the project in editable mode, and run
the test suite from the repository root:

```bash
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[docs]"
python -m unittest
zensical build --clean
```

The source lives in `src/typesafe_decisions`, documentation examples live in
`docs`, and tests live in `tests`.
