ai-qa-sdk
Python SDK for validating AI outputs.
Installation
pip install ai-qa-sdk
This installs everything you need including support for Anthropic (Claude) and OpenAI (GPT).
Quick Start
1. Deterministic Checks (No API Key Needed)
from ai_qa import validate
# Validate JSON format - works immediately!
result = validate(
output='{"name": "John", "age": 30}',
checks=["json_format"]
)
print(f"Passed: {result.passed}")
for check in result.checks:
print(f" {check.name}: {check.score:.2f}")
2. LLM-Powered Checks (Configure Your Provider)
Get an API key first:
- Anthropic (Claude): https://console.anthropic.com → API Keys
- OpenAI (GPT): https://platform.openai.com/api-keys
Then configure and use:
from ai_qa import configure, validate
# Configure your preferred provider
configure(provider="anthropic", api_key="sk-ant-YOUR-KEY-HERE")
# Or use OpenAI instead
# configure(provider="openai", api_key="sk-YOUR-KEY-HERE")
# Now you can use any LLM-powered check
result = validate(
output="The capital of France is Paris",
input="What is the capital of France?",
checks=["factuality", "relevance", "hallucination"]
)
print(f"Passed: {result.passed}")
print(f"Cost: ${result.total_cost:.4f}")
for check in result.checks:
print(f" {check.name}: {check.score:.2f}")
Available Checks
✓ No API Key Required
json_format- Validate JSON syntaxregex- Pattern matchingschema- JSON schema validationlength- Output length bounds
🔑 Requires API Key (Anthropic or OpenAI)
hallucination- Detect made-up factsfactuality- Check factual accuracyrelevance- Relevance to inputtoxicity- Harmful content detectionbias- Bias/fairness issuespii- Personal information detectionconsistency- Internal consistencycontradiction- Logical contradictionsgroundedness- Grounded in provided context- And more!
Providers
ai-qa-sdk supports multiple providers out of the box:
| Provider | Setup | Cost |
|---|---|---|
| Anthropic (Claude) | configure(provider="anthropic", api_key="...") |
~$0.003-0.015 per 1K tokens |
| OpenAI (GPT) | configure(provider="openai", api_key="...") |
~$0.03-0.06 per 1K tokens |
| Local (Ollama) | configure(provider="local", base_url="http://localhost:11434") |
Free (runs locally) |
Get API keys:
- Anthropic: https://console.anthropic.com/api-keys
- OpenAI: https://platform.openai.com/api-keys
Metadata
Release files for ai-qa-sdk 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ai_qa_sdk-0.2.0.tar.gz | 112.7 kB | Without provenance | Details for ai_qa_sdk-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ai_qa_sdk-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for ai_qa_sdk-0.2.0-py3-none-any.whl |
Total release size: 183.9 kB
Release files / ai_qa_sdk-0.2.0.tar.gz
| Download URL | ai_qa_sdk-0.2.0.tar.gz |
|---|---|
| Size | 112.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1b4271c4a2c6739478197827a59f53d5163c64877d280a81d516b55dde6700f
|
|
BLAKE2b-256 checksum How to use checksums |
eef84afdf526c74bc53dd80d51a41e37b3b09b1175b59464841d44fad2616081
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.13
|
Release files / ai_qa_sdk-0.2.0-py3-none-any.whl
| Download URL | ai_qa_sdk-0.2.0-py3-none-any.whl |
|---|---|
| Size | 71.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
62bc9cbf65d3a60e2f184854948b2991bc1699fedab9f5f989b58bd2c610b680
|
|
BLAKE2b-256 checksum How to use checksums |
f93a82c99cd15b1928002ab83353f28027366a1cb03ae37cf43dfd602c60cd03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.13
|
Security for ai-qa-sdk 0.2.0
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.