The open-source Python library solvi, released under the Apache-2.0 license, provides a framework for business decision-making by separating AI model suggestions from deterministic code validation. The system ensures that AI-generated outputs are verified against business rules, preventing hallucinations and ensuring auditability.
In version 0.5.0, the library introduced Python type annotations as a contract. These annotations define facts, questions, and expected answer formats, including specific text fragments, citations, or 'not mentioned' statuses. The library uses a chain of functions where hard checks can override model outputs, ensuring compliance with strict business logic.
The system maintains an audit trail linked by hashes, allowing for the reproduction of decisions. If a model provides an incorrect value, such as a hallucinated amount, the library uses grounding checks to compare the output against the source document. If a value fails validation, the system can trigger a fallback producer or reject the fact entirely.
The library supports various response types, including yes/no, multiple-choice, ordinal scales, and specific text spans. It handles ambiguity by abstaining from an answer when confidence is low, providing a draft for human review. The replay feature allows users to verify past decisions and detect if underlying models or catalogs have changed since the original execution.






