Universal AI validation SDK — hallucination, factuality, safety checks for any LLM output
Project description
ai-qa-sdk
Python SDK for validating AI outputs.
Installation
pip install ai-qa-sdk
Quick Start
1. Without API Key (Deterministic Checks)
from ai_qa import validate
# Validate JSON format (no API key needed)
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. With API Key (LLM-Powered Checks)
Install with provider support:
# For Anthropic (Claude)
pip install ai-qa-sdk[anthropic]
# For OpenAI (GPT)
pip install ai-qa-sdk[openai]
# For all providers
pip install ai-qa-sdk[all-providers]
Configure and validate:
from ai_qa import configure, validate
# Configure Anthropic (Claude)
configure(provider="anthropic", api_key="sk-ant-...")
# Or configure OpenAI
# configure(provider="openai", api_key="sk-...")
# Now use LLM-powered checks
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!
Getting API Keys
Anthropic (Claude):
- Visit: https://console.anthropic.com
- Create account → API Keys → Create new key
- Format:
sk-ant-...
OpenAI (GPT):
- Visit: https://platform.openai.com/api-keys
- Create account → API Keys → Create new key
- Format:
sk-...
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ai_qa_sdk-0.1.4.tar.gz
(112.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
ai_qa_sdk-0.1.4-py3-none-any.whl
(71.0 kB
view details)
File details
Details for the file ai_qa_sdk-0.1.4.tar.gz.
File metadata
- Download URL: ai_qa_sdk-0.1.4.tar.gz
- Upload date:
- Size: 112.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b44ce686505ec00dfbddde8d26b4590094c1453cf65c3ff06ca3647575c24e1a
|
|
| MD5 |
9294f2f2f21ebb141eebe0e249f549ca
|
|
| BLAKE2b-256 |
d9ed820522329fc7f36581e49685d3cfab17095a8a4797b0fb935e71debf4899
|
File details
Details for the file ai_qa_sdk-0.1.4-py3-none-any.whl.
File metadata
- Download URL: ai_qa_sdk-0.1.4-py3-none-any.whl
- Upload date:
- Size: 71.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b833b99738137e1c748cfce63086eef516db0a2120967965fe53b80427b887bc
|
|
| MD5 |
92964da72c3c0e2c5401c57cfbefd9fe
|
|
| BLAKE2b-256 |
bf16d0f2072308538f681bc8bf9b05c79fe2ced908a0abb92edf65ab85dc58d3
|