Metadata-Version: 2.5
Name: haloguard
Version: 0.1.0
Summary: Local-first hallucination firewall for LLM applications
Project-URL: Homepage, https://github.com/KunalSoyane/Halogaurd
Project-URL: Issues, https://github.com/KunalSoyane/Halogaurd/issues
Project-URL: Changelog, https://github.com/KunalSoyane/Halogaurd/blob/main/CHANGELOG.md
Author: Kunal Soyane
License-Expression: MIT
License-File: LICENSE
Keywords: hallucination,llm,nli,onnx,rag,safety
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Requires-Dist: onnxruntime>=1.17
Requires-Dist: platformdirs>=4.0
Requires-Dist: pydantic>=2.7
Requires-Dist: tokenizers>=0.19
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pip-audit>=2.7; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Provides-Extra: export
Requires-Dist: optimum[onnxruntime]>=1.21; extra == 'export'
Requires-Dist: sentence-transformers<6,>=3.0; extra == 'export'
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.2; extra == 'langchain'
Provides-Extra: llamaindex
Requires-Dist: llama-index-core>=0.10; extra == 'llamaindex'
Description-Content-Type: text/markdown

# HaloGuard

A local-first hallucination firewall for LLM applications. HaloGuard sits between an
LLM and the application consuming its output, scoring every response for hallucination
risk before it reaches a user. Everything runs on the caller's machine -- no prompt,
response, or context ever leaves the device.

## Scoring modes

- **Entailment mode** (RAG-style): scores whether the response is supported by supplied
  source context, using an NLI cross-encoder (`DeBERTa-v3-small`).
- **Consistency mode** (no context): scores whether the response is internally
  consistent, using the same NLI model over the response's own claims.

## Verdicts

Every check returns a `FirewallResult` with:

- `score` -- 0.0-1.0 hallucination risk (higher = more likely hallucinated)
- `verdict` -- `PASS` / `FLAG` / `BLOCK` / `UNKNOWN`
- `reason` -- human-readable explanation
- `mode_used` -- which scorer ran
- `latency_ms` -- how long the check took

`UNKNOWN` is the fail-open verdict returned when scoring itself fails and
`strict_mode=False` (the default). Set `strict_mode=True` to fail closed instead.

## Honest limitations

HaloGuard is **defense-in-depth, not a guarantee**. An adversarially crafted response
can read as entailed/consistent to any NLI model while still being false. The measured
false-negative rate on the golden benchmark is the real accuracy statement; treat
HaloGuard as one layer in a safety stack, not the only one.

## Development status

v0.1.0 -- early. See [CHANGELOG.md](CHANGELOG.md).

## License

MIT
