pytest for LLMs
Project description
prompttest
pytest for LLMs.
You wouldn't ship code without tests. ✋😮🤚
Hold your prompts to the same standard. 😎👌🔥
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:
The Prompt File (.txt)
A .txt file for your prompt template with ---[SECTIONS]--- and {variables}.
Example: prompts/customer_service.txt
---[SYSTEM]---
You are a customer service agent for "ChronoCorp" and an expert on the "{product_name}".
Always be helpful, polite, and empathetic. Address the customer by name if it is provided.
Style rules:
- If the customer's message is only a greeting (e.g., "hi", "hello", "hey"):
- Reply with one short, polite greeting.
- Add nothing else: no extra sentences, questions, emojis, or marketing text.
- For other messages, answer concisely and only with information relevant to the request.
---[USER]---
Customer name: {user_name}
Customer query: {user_query}
The Test File (.yml)
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_name: "Jane"
user_query: "Hello"
criteria: "The response must be a simple, polite greeting."
The Result
When you run prompttest, you get two outputs:
The Console Summary
A pass/fail summary right in your terminal.
The Markdown Report
A detailed Markdown report for every single test.
Example: .prompttest_reports/latest/test_customer_service-check-simple-greeting.md
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prompttest-0.2.3.tar.gz.
File metadata
- Download URL: prompttest-0.2.3.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
769686ef5b423de1fe5ae1dfbc56d0fd24fb659e9c8e9cea197dc85684f066af
|
|
| MD5 |
1af1f2c508d4605781658b5e46fc286b
|
|
| BLAKE2b-256 |
8fd9a5999aba913ca102bb1dd1bc26714c1844c8d592a18f4d8e3ed54767ac81
|
Provenance
The following attestation bundles were made for prompttest-0.2.3.tar.gz:
Publisher:
publish.yml on decodingchris/prompttest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prompttest-0.2.3.tar.gz -
Subject digest:
769686ef5b423de1fe5ae1dfbc56d0fd24fb659e9c8e9cea197dc85684f066af - Sigstore transparency entry: 429634331
- Sigstore integration time:
-
Permalink:
decodingchris/prompttest@191d19013a83676e3b51ebc5d71adb2302031ebd -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/decodingchris
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@191d19013a83676e3b51ebc5d71adb2302031ebd -
Trigger Event:
release
-
Statement type:
File details
Details for the file prompttest-0.2.3-py3-none-any.whl.
File metadata
- Download URL: prompttest-0.2.3-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f375261bfa704d7ee5e73a1601d25046bc6b37dfd755869c04d61e2036a8cf7
|
|
| MD5 |
f0d94b3ec2d057ed485887d4f842fa16
|
|
| BLAKE2b-256 |
2d9e0bf7c1dbcd3676c5328368ec2b2bd5a2d4a3edd71127ec8281268a125224
|
Provenance
The following attestation bundles were made for prompttest-0.2.3-py3-none-any.whl:
Publisher:
publish.yml on decodingchris/prompttest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prompttest-0.2.3-py3-none-any.whl -
Subject digest:
3f375261bfa704d7ee5e73a1601d25046bc6b37dfd755869c04d61e2036a8cf7 - Sigstore transparency entry: 429634341
- Sigstore integration time:
-
Permalink:
decodingchris/prompttest@191d19013a83676e3b51ebc5d71adb2302031ebd -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/decodingchris
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@191d19013a83676e3b51ebc5d71adb2302031ebd -
Trigger Event:
release
-
Statement type: