Skip to main content

PraisonAITest

A minimal and simple testing framework for Large Language Models (LLMs) using LiteLLM.

Installation

pip install PraisonAITest

For development installation:

pip install -e ./

Usage

from praisonaitest import Test

# Example with string validation
test1 = Test(model="openai/gpt-4o-mini", instruction="What is the capital of France?", validate="Paris")
result = test1.run()

print(f"Test result: {'Passed' if result['passed'] else 'Failed'}")
print(f"Response: {result['response']}")
print(f"Latency: {result['latency']:.2f} seconds")
print(f"Token usage: {result['token_usage']}")

# Example with a validation function
def validate_france_response(response):
    """Custom validator that checks if response mentions Paris and France"""
    return "Paris" in response and "France" in response

# Create a test with function validation
test2 = Test(
    model="openai/gpt-4o-mini", 
    instruction="Tell me about the capital of France", 
    validate=validate_france_response
)
result2 = test2.run()

Environment Variables

Create a .env file with your API keys:

# LiteLLM API Key (Required)
LITELLM_API_KEY=your_api_key_here

# Default OpenAI API Key (Optional, if using OpenAI models directly)
OPENAI_API_KEY=your_openai_api_key_here

License

This project is licensed under the MIT License.

Metadata

Release files for PraisonAITest 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PraisonAITest 0.0.1
File Size Uploaded
praisonaitest-0.0.1.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PraisonAITest 0.0.1
File Interpreter ABI Platform
praisonaitest-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / praisonaitest-0.0.1.tar.gz

Download URL praisonaitest-0.0.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b06a2754fdb2fd143568146afde0187dc37c4c45572df3c66221d225320700c6
BLAKE2b-256 checksum
How to use checksums
3bf8bd66071a149454767aacd964f07e18dc534bfc236ea7540a0cb9503993f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.8

Release files / praisonaitest-0.0.1-py3-none-any.whl

Download URL praisonaitest-0.0.1-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4c2f566f289405364f4331f513a003823fc6889c8da41c9405844f00c604bc6
BLAKE2b-256 checksum
How to use checksums
a611d721863d574dd82f5c9af74e37a77a9fa49e31a6fd7c3ed6845e1be67087
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.8

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page