Skip to main content

BOOTH logo

BOOTH

A lightweight checkpoint layer for AI.

PyPI Package

Python Versions

Tests Status

MIT License

<strong>Tutorial •

<strong>Use Cases •

<strong>Changelog •

<strong>Contributing •

Issues


⚡ Quickstart

Install BOOTH via PyPI:

pip install boothpy

Basic Checkpoint (booth.check)

Every application built on an LLM has to answer: Should my application trust this LLM output?

BOOTH sits between your application and an LLM call, handing back a structured decision (BoothResult) instead of just whatever text the model returned:

import booth

# Pass your existing LLM function into BOOTH

result = booth.check(call_llm, "What is the capital of France?")

if result.ok:

    print(result.answer)                       # "Paris" (confident & unambiguous)

else:

    print(f"BOOTH returned {result.status}")    # AMBIGUOUS / UNCERTAIN — don't ship blind

🎯 Highlighted Example: Grounding Answers with Evidence

Same model, same question, asked with and without BOOTH. This is an actual comparison run, not a constructed demo:

| | Response Output | Application Result |

|---|---|---|

| Without BOOTH | "90 days" (fabricated, no such number exists in policy) | Hallucinated answer sent blindly to user |

| With booth.check_with_evidence() | "45 days" (matches real policy document exactly) | BLOCKED or ACCEPTED defensible decision |

No amount of self-reported confidence catches that first answer. Only checking it against something real does:

import booth

result = booth.check_with_evidence(

    answer=llm_answer,

    evidence=retrieved_docs,

    compare_fn=your_comparison_function,

)

if result.status == booth.BLOCKED:

    print(f"The answer doesn't agree with what was actually retrieved: {result.detail}")

else:

    print(f"Grounded Answer: {result.answer}")

*(The specific fabricated number will vary from run to run; that's uncalibrated sampling. The pattern is the reliable part.)

check_with_evidence() only runs the compare_fn you give it, so a weak comparator gives a weak check. See the comparator example in the table below for a keyword matcher and an NLI model run on the same inputs.*


Why BOOTH exists

A few months ago, a person working an airport gate helped me find mine after I'd gotten lost, boarding pass in hand, signs everywhere, still at the wrong gate. She didn't know where I'd flown in from, how the aircraft was built, or anything about my itinerary beyond that one boarding pass. She didn't need to. She knew the airport, and she knew what to check.

That's the idea BOOTH is built around. The industry's default answer to "the model got it wrong" has mostly been to make the model know more: more context, more compute, bigger models, more tools bolted around it. And the problem still happens, because it isn't always a knowledge problem. Sometimes what's missing isn't more information going in. It's something whose only job is checking whether what came out actually meets the bar.

BOOTH doesn't try to know more than your model does. It just knows what to check.

I wrote the longer version of this on Substack: "Knowing less, but knowing what matters".


🛠️ Checkpoint Modes

BOOTH provides three primary APIs tailored to your application's workflow:

| Function | Mode | Description |

|---|---|---|

| booth.check() | Synchronous | Evaluates LLM calls for parsing, ambiguity, confidence, and optional custom validator. Retries with reconsideration if needed. |

| booth.check_with_evidence() | Synchronous | Grounds an answer against application-retrieved evidence (e.g. RAG pipeline output). Does not execute LLM calls. |

| booth.acheck() | Asynchronous | Async equivalent of check(), fully supporting async model callables and async execution loops. |


🚦 Status Codes & Result Inspection

booth.check() and booth.check_with_evidence() return a structured BoothResult object.

Status Codes

| Status Code | Type | Description |

|---|---|---|

| ACCEPTED | Success | Answer passed all checks (unambiguous, confidence threshold met, validator passed). |

| REPAIRED | Success | An earlier attempt failed (low confidence, unparseable response, or failed validator), but a retry passed. |

| AMBIGUOUS | Reject | The model reported multiple reasonable readings of the question. Returned immediately, never retried. |

| UNCERTAIN | Reject | No acceptable result: confidence never reached the threshold (default=0.7), the response couldn't be parsed, the validator never passed, or call_fn itself failed. Check result.method and result.call_failed for which. |

| BLOCKED | Reject | Evidence check failed — the answer disagrees with provided evidence documents. |

There is no separate status for a response that can't be parsed: that is UNCERTAIN with result.method == "parse_failure".

Result Inspection

result = booth.check(call_llm, "Categorize ticket: Server unreachable")

# 1. Quick status check

if result.ok:

    print("Answer:", result.answer)

# 2. Safe unwrapping (returns str if ok, raises BoothRejected otherwise)

try:

    answer = result.unwrap()

except booth.BoothRejected as e:

    print(f"Rejected with status={e.result.status}, method={e.result.method}")

# 3. Rich diagnostic attributes

print(result.status)          # Status string (e.g. ACCEPTED, UNCERTAIN, AMBIGUOUS)

print(result.confidence)      # Confidence score float (0.0 to 1.0)

print(result.method)          # Check failure category ('ambiguity', 'confidence', 'validation', 'parse_failure')

print(result.call_failed)     # True if call_fn itself failed (bad key, retired model, network error)

print(result.attempts)        # List of Attempt objects detailing each retry

🔌 Provider Integrations

BOOTH is zero-dependency and provider-agnostic. Because your application supplies the model-calling function, it works with any LLM client or provider — rather than take our word for it, see it run for real:

→ browse real, runnable integration examples

Each folder is a complete, independently reproducible example contributed against a different provider or model, with the actual console output and findings included — not just code snippets. Currently includes provider examples, a local RAG stack, and a comparator study:

| Provider / Model | Function(s) used | What it shows |

|---|---|---|

| Groq (llama-3.3-70b-versatile) | check_with_evidence() | Evidence-grounded refund policy QA, hallucination blocking |

| Google Gemini (gemini-3.5-flash-lite) | check(), check_with_evidence() | Ambiguity detection, evidence grounding, and a real BOOTH gap found along the way: failed API calls looked like an unsure model (now separable with result.call_failed) |

| Anthropic (claude-3-5-haiku-20241022) | check_with_evidence() | Evidence-grounded refund policy QA against Claude |

| Ollama / local models (qwen2.5-coder:7b, llama3.2:latest) | check(), acheck(), check_with_evidence() | check() run against a local model with no evidence grounding — confidence self-reporting behavior shown plainly, good and bad | | LangChain + FAISS + FLAN-T5 (local, cross-encoder/nli-deberta-v3-base as the comparator) | check_with_evidence() | A local RAG stack with an NLI compare_fn. The wrong answer was blocked, but two correct answers were also blocked: an honest look at an over-strict comparator | | Keyword matcher vs. NLI model (MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli) | check_with_evidence() | The same 10 cases through both comparators (4/10 vs 9/10 against the authored expectations), including a conflicting-evidence case that still gets ACCEPTED |

Each example's own RESULTS.md documents what actually happened on a real run: what worked, what didn't, and any surprises along the way — including negative results. That's intentional; a confidently-wrong result from check() alone on a weaker model is as useful a data point as a clean pass.

Want to add your own? See the open call for provider examples — any provider, any model, PRs welcome.


💡 Philosophy

  1. Keep the checkpoint small. A reusable decision layer, not another full LLM framework.

  2. Make uncertainty explicit. Return a structured status instead of silently passing an unacceptable output through.

  3. Treat ambiguity, validation, and confidence as separate, ordered checks. A confident, validator-passing answer can still be ambiguous.

  4. Reconsider instead of blindly resampling. The reason an attempt failed determines what the model is actually shown on retry.

  5. Expose, don't reinterpret. result.parsed shows the model's raw response rather than deciding what it should mean.

  6. Reject invalid data, don't silently coerce it. An out-of-range confidence or an unrecognized boolean-ish value is a reason to reject the attempt, never guess at.

  7. Keep evidence retrieval outside BOOTH. Applications own their own RAG, search, database, or tool infrastructure.

  8. Do not pretend agreement is truth. Agreement with a validator, confidence value, or retrieved evidence is not the same as proving a claim.

  9. Stay provider-agnostic. BOOTH works with any LLM provider because your application supplies the model-calling function.

  10. Don't collapse distinct failures into one bucket. A blank input, a crashing dependency, and a genuine disagreement are different problems and should be distinguishable without reading BOOTH's own source.


**## 📚 Learn More

  • TUTORIAL.md — Complete reference for every function, type, property, and method in BOOTH's API.
  • USECASES.md — Detailed guide on where BOOTH fits in your architecture and where it doesn't.
  • CHANGELOG.md — Release notes and history of features, bug fixes, and API evolution.
  • examples/ — Real, runnable integration examples across providers and models, with documented results.
  • TROUBLESHOOTING.md — Known gotchas from real integration runs, with fixes.

🤝 Contributing

BOOTH is small on purpose. That's a design constraint, not a lack of ambition. Bug reports and confirmed edge cases are the most valuable kind of contribution right now.

See CONTRIBUTING.md for how to report a bug well, what a good reproduction looks like, and what BOOTH's "small on purpose" stance means for feature PRs specifically.


📄 License

This is the official BOOTH repository, maintained by Vedant Brahmbhatt.

BOOTH is released under the MIT License. See LICENSE for the full text.

Metadata

Release files for boothpy 0.5.6

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

Source distribution (sdist)

Source distribution for boothpy 0.5.6
File Size Uploaded Provenance Actions
boothpy-0.5.6.tar.gz 55.3 kB Without provenance Details for boothpy-0.5.6.tar.gz

Built distribution (wheel)

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

Total release size: 70.1 kB

Release files / boothpy-0.5.6.tar.gz

Download URL boothpy-0.5.6.tar.gz
Size 55.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b5c8db042af9a89926b12b74767a37e5364fd184d011559a4f1d680eec18650f
BLAKE2b-256 checksum
How to use checksums
063e635ecfcccb0cbf4e0d54ba5fb9beea8d9cf159b71e86129c9fe1f70ac994
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / boothpy-0.5.6-py3-none-any.whl

Download URL boothpy-0.5.6-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
734c1d6089436050fa40e32b9c0d3cef29feac1d84b30560e062297400e27818
BLAKE2b-256 checksum
How to use checksums
3d7399f8fcf9bae19c86632b0fd01b3031f4a1988dfffb4eb16539c29f971b98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Security for boothpy 0.5.6

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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