Skip to main content

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 syntax
  • regex - Pattern matching
  • schema - JSON schema validation
  • length - Output length bounds

🔑 Requires API Key (Anthropic or OpenAI)

  • hallucination - Detect made-up facts
  • factuality - Check factual accuracy
  • relevance - Relevance to input
  • toxicity - Harmful content detection
  • bias - Bias/fairness issues
  • pii - Personal information detection
  • consistency - Internal consistency
  • contradiction - Logical contradictions
  • groundedness - Grounded in provided context
  • And more!

Getting API Keys

Anthropic (Claude):

OpenAI (GPT):

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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_qa_sdk-0.1.4-py3-none-any.whl (71.0 kB view details)

Uploaded Python 3

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

Hashes for ai_qa_sdk-0.1.4.tar.gz
Algorithm Hash digest
SHA256 b44ce686505ec00dfbddde8d26b4590094c1453cf65c3ff06ca3647575c24e1a
MD5 9294f2f2f21ebb141eebe0e249f549ca
BLAKE2b-256 d9ed820522329fc7f36581e49685d3cfab17095a8a4797b0fb935e71debf4899

See more details on using hashes here.

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

Hashes for ai_qa_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b833b99738137e1c748cfce63086eef516db0a2120967965fe53b80427b887bc
MD5 92964da72c3c0e2c5401c57cfbefd9fe
BLAKE2b-256 bf16d0f2072308538f681bc8bf9b05c79fe2ced908a0abb92edf65ab85dc58d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page