Add your description here
Project description
Quack Test
A plugin for pytest to evaluate non-deterministic agent components.
Installation & Setup
Simply pip install it.
pip install quack-test
To use the LLM judge you will need to add the required config to your .env file.
# OpenAI Provider Configuration
# Set to "OpenAI" or "AzureOpenAI"
OPENAI_PROVIDER=OpenAI
# Unified Configuration
OPENAI_API_KEY=your_api_key_here
OPENAI_MODEL_NAME=gpt-4
OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com/
Run tests
Simply run your tests using pytest (quack_tests are just pytests)
pytest
Writing Tests
You can simply specify @nondeterministic for components, which are not deterministic and should be run multiple times.
Implement everything in a test_*.py file in your test or tests folder.
import random
from quack_test import nondeterministic_fixture, nondeterministic_test, judge
@nondeterministic_fixture(n=5)
def sample_text():
return f"I have {random.randint(1, 10)} apples."
@nondeterministic_test(threshold=0.8)
def test_apples(sample_text):
return judge(sample_text, criterion="Has more than 1 apple")
@nondeterministic_test(threshold=0.8)
def test_apples_gt(sample_text):
return judge(sample_text, gt="I have N (0-10) apples")
@nondeterministic_test(threshold=0.8, should_fail=True)
def test_coal(sample_text):
return judge(sample_text, criterion="Has only coal")
class TestClassBased:
@nondeterministic_test(n=3, threshold=0.2)
def test_assert_only(self):
# Assert-only tests in classes should be treated as successful runs
return random.random()
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 quack_test-0.2.0.tar.gz.
File metadata
- Download URL: quack_test-0.2.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab5b0adfcf8c40c1d48b672c7df98362521dc37ec8bff41aa797745f3407ac43
|
|
| MD5 |
fe75ca3db316b4e61c50d64ef861dacc
|
|
| BLAKE2b-256 |
28c635acf1a02dc9c2baf477ea9c3fdfb36160034faf3a73a8c895004f2c5674
|
Provenance
The following attestation bundles were made for quack_test-0.2.0.tar.gz:
Publisher:
python-publish.yml on penguinmenac3/quack-test
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quack_test-0.2.0.tar.gz -
Subject digest:
ab5b0adfcf8c40c1d48b672c7df98362521dc37ec8bff41aa797745f3407ac43 - Sigstore transparency entry: 725296915
- Sigstore integration time:
-
Permalink:
penguinmenac3/quack-test@2c06d3c351bd4fe0bc2f7283af183b88737090ba -
Branch / Tag:
refs/tags/V0.2.0 - Owner: https://github.com/penguinmenac3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2c06d3c351bd4fe0bc2f7283af183b88737090ba -
Trigger Event:
release
-
Statement type:
File details
Details for the file quack_test-0.2.0-py3-none-any.whl.
File metadata
- Download URL: quack_test-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7420e7eaf3278c40b2f0ecd14b88006541100519b9a3806e14b8331935cdf4e
|
|
| MD5 |
a43e4faccccb97467010bb57532a5bba
|
|
| BLAKE2b-256 |
91f2b13180978b893ae55da08f36931d3c0a45e97e7f1b3d14261bd84cb4ea99
|
Provenance
The following attestation bundles were made for quack_test-0.2.0-py3-none-any.whl:
Publisher:
python-publish.yml on penguinmenac3/quack-test
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quack_test-0.2.0-py3-none-any.whl -
Subject digest:
e7420e7eaf3278c40b2f0ecd14b88006541100519b9a3806e14b8331935cdf4e - Sigstore transparency entry: 725296918
- Sigstore integration time:
-
Permalink:
penguinmenac3/quack-test@2c06d3c351bd4fe0bc2f7283af183b88737090ba -
Branch / Tag:
refs/tags/V0.2.0 - Owner: https://github.com/penguinmenac3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2c06d3c351bd4fe0bc2f7283af183b88737090ba -
Trigger Event:
release
-
Statement type: