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-...
Documentation
See CLAUDE.md for development guide.
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.3.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.3-py3-none-any.whl
(71.1 kB
view details)
File details
Details for the file ai_qa_sdk-0.1.3.tar.gz.
File metadata
- Download URL: ai_qa_sdk-0.1.3.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 |
35e6182c1493a284e775f07a6d77033efece3c0b23c81ee53479409e3fa1e8ba
|
|
| MD5 |
2dff59fc185c5c816581bc098b7989fb
|
|
| BLAKE2b-256 |
d7555b31b7711b778ef2d98dbd4005d1576b835bbeff412b8cb4b6264cc12ecd
|
File details
Details for the file ai_qa_sdk-0.1.3-py3-none-any.whl.
File metadata
- Download URL: ai_qa_sdk-0.1.3-py3-none-any.whl
- Upload date:
- Size: 71.1 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 |
a56f9b01d72c2e010c0a124f0bf083c9591f805acf602499bb00b3ea6b42e2eb
|
|
| MD5 |
7399e507d40810973f1d0d9049b470bc
|
|
| BLAKE2b-256 |
a4471c51121ec1123a3f7d522c4b2af8b2c46874758e98b660a81c6d9c124e6c
|