Skip to main content

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

Project description

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.

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

praisonaitest-0.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

praisonaitest-0.0.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file praisonaitest-0.0.1.tar.gz.

File metadata

  • Download URL: praisonaitest-0.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for praisonaitest-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b06a2754fdb2fd143568146afde0187dc37c4c45572df3c66221d225320700c6
MD5 6837e7307d210eec4eb53ec6395379a3
BLAKE2b-256 3bf8bd66071a149454767aacd964f07e18dc534bfc236ea7540a0cb9503993f9

See more details on using hashes here.

File details

Details for the file praisonaitest-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for praisonaitest-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c4c2f566f289405364f4331f513a003823fc6889c8da41c9405844f00c604bc6
MD5 637c544a1bda84ef4e2593d213709224
BLAKE2b-256 a611d721863d574dd82f5c9af74e37a77a9fa49e31a6fd7c3ed6845e1be67087

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