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):

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)

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.3-py3-none-any.whl (71.1 kB view details)

Uploaded Python 3

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

Hashes for ai_qa_sdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 35e6182c1493a284e775f07a6d77033efece3c0b23c81ee53479409e3fa1e8ba
MD5 2dff59fc185c5c816581bc098b7989fb
BLAKE2b-256 d7555b31b7711b778ef2d98dbd4005d1576b835bbeff412b8cb4b6264cc12ecd

See more details on using hashes here.

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

Hashes for ai_qa_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a56f9b01d72c2e010c0a124f0bf083c9591f805acf602499bb00b3ea6b42e2eb
MD5 7399e507d40810973f1d0d9049b470bc
BLAKE2b-256 a4471c51121ec1123a3f7d522c4b2af8b2c46874758e98b660a81c6d9c124e6c

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