Skip to main content

pytest for LLMs

Project description

prompttest

Build Status PyPI version PyPI - Python Versions PyPI Downloads License: MIT

pytest for LLMs.

You wouldn't ship code without tests. ✋😮🤚

Hold your prompts to the same standard. 😎👌🔥

A demo of prompttest

Features

  • 🔤 Test in Plain English: Write your tests in English, and let an AI grade the response.

  • 🚀 Write Tests Faster: Just list your inputs and criteria in a simple file—no code needed.

  • 🔓 Avoid Vendor Lock-in: Test against any LLM with a single, free OpenRouter API key.

Quick Start

1. Install prompttest

pip install prompttest

2. Set up prompttest

prompttest init

3. Run your tests

prompttest

How It Works

prompttest is built around 2 types of files:

Prompt

A .txt file for your prompt template with ---[SECTIONS]--- and {variables}.

Example: prompts/customer_service.txt

---[SYSTEM]---
You are an expert on the "{product_name}".
Your responses must be helpful and polite.

---[USER]---
Customer tier: {user_tier}
Customer query: {user_query}

Test

A .yml file for test cases with config, inputs and criteria.

Example: prompttests/test_customer_service.yml

config:
  prompt: customer_service

tests:
  - id: check-simple-greeting
    inputs:
      product_name: "Chrono-Watch"
      user_tier: "Standard"
      user_query: "Hello"
    criteria: "The response must be a simple, polite greeting."

Advanced Usage

Run all tests in a folder

prompttest run folder_name/

Run all tests in a file

prompttest run file_name.yml

Run specific test

prompttest run test_id

Contributing

We're building the pytest for LLMs—and we need your help.

Report a bug, propose a feature, or contribute a single line.

Help shape a foundational tool for AI development.

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

prompttest-0.2.2.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

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

prompttest-0.2.2-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file prompttest-0.2.2.tar.gz.

File metadata

  • Download URL: prompttest-0.2.2.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for prompttest-0.2.2.tar.gz
Algorithm Hash digest
SHA256 5cd57067d9f17e54e60af92283c74f95ce52468101db64b09a14688ba8b56a32
MD5 c7f3a062db5f4289417a887d93ce6c83
BLAKE2b-256 09e17ab92372204efeea8c17e6aaa8c726a211c3726c7fe6ed9befd05d950dbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompttest-0.2.2.tar.gz:

Publisher: publish.yml on decodingchris/prompttest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prompttest-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: prompttest-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for prompttest-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e5c3b15b90b83e48f3d8dd5aed02a505506b91d2a4e5e7fe4b74c3d4bb11283c
MD5 e45c2d40e88e94ba39cc7efe5bee9a25
BLAKE2b-256 3c5ea27cd3513481cde0cf34e6b387aec9a9f744fe85f547f5149f1fd34a52ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompttest-0.2.2-py3-none-any.whl:

Publisher: publish.yml on decodingchris/prompttest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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