Metadata-Version: 2.4
Name: director-ai-lite
Version: 3.16.0
Summary: Standalone three-line LLM streaming-halt guard — model-free, zero dependencies
Author-email: Miroslav Šotek <protoscience@anulum.li>
License-Expression: Apache-2.0
Project-URL: Homepage, https://www.anulum.li
Project-URL: Repository, https://github.com/anulum/director-ai
Project-URL: Documentation, https://anulum.github.io/director-ai/lite/
Project-URL: Issues, https://github.com/anulum/director-ai/issues
Keywords: llm,hallucination,guardrail,streaming,streaming-halt,director-ai
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Provides-Extra: full
Requires-Dist: director-ai<4,>=3.16.0; extra == "full"
Provides-Extra: nli
Requires-Dist: director-ai[nli]<4,>=3.16.0; extra == "nli"
Provides-Extra: rag
Requires-Dist: director-ai[vector]<4,>=3.16.0; extra == "rag"
Provides-Extra: server
Requires-Dist: director-ai[server]<4,>=3.16.0; extra == "server"
Provides-Extra: recommended
Requires-Dist: director-ai[recommended]<4,>=3.16.0; extra == "recommended"

# Director-AI Lite

`director-ai-lite` is a **standalone, dependency-free** LLM streaming-halt guard:
it stops a token stream *before* a hallucination finishes generating. It installs
with zero heavy dependencies (standard library only) and does **not** require the
full `director-ai` package.

```bash
pip install director-ai-lite
```

```python
from director_ai_lite import guard

result = guard(
    token_stream,
    facts={"capital": "Paris is the capital of France."},
    prompt="What is the capital of France?",
)

print(result.output)       # surviving text (halted tokens removed)
print(result.halted)       # True if the stream was stopped
print(result.halt_reason)  # why it was stopped
```

## How it works

The default path is **model-free**: each accumulated prefix is scored by a
grounding heuristic (content-word overlap against the supplied `facts`) and the
same calibrated coherence combination the full package uses in its no-model path.
The stream hard-halts on the first token whose coherence drops below `threshold`
(default `0.5`). With no `facts`, scoring stays neutral and nothing is halted.

Because the grounding heuristic and the coherence calibration match the full
package, you can upgrade to model-backed (NLI/RAG) scoring without changing the
call site.

## Upgrade to model-backed scoring

```bash
pip install "director-ai-lite[full]"
```

Then pass the full package's scorer to `StreamGuard`:

```python
from director_ai_lite import StreamGuard

guard = StreamGuard(facts=..., scorer=my_nli_scorer)  # any review(prompt, text) scorer
```

## Tiers

Director-Lite is the free, standalone entry point. The wider product ladder:

| Tier | What it is |
|---|---|
| **Director-Lite** | **Free.** This package — standalone, model-free streaming halt, zero dependencies. |
| **Director-AI** | The full runtime — model-backed NLI/RAG scoring, REST/gRPC server, framework integrations, sealed evidence packets, tamper-evident audit. |
| **Director-AI Pro** | Production-tier licence and support on top of the full runtime. |
| **Director-AI Full** | The complete advanced + labs capability set. |
| **Director-Class AI** | Enterprise: managed/on-prem deployment, domain tuning, evidence reviews, SLA, procurement support. |

## Support development

Director-Lite is free forever, including in production. If it helps you, you can
sponsor development via [GitHub Sponsors](https://github.com/sponsors/anulum) —
entirely optional, and it keeps the free tier moving.

## License

Apache-2.0.
