Skip to main content

tests

release

consisTent is a full blows testing framework for prompts. The goal of consisTent is to create reproducible tests for LLM based applications regardless of the FM used.

Installation

pip install consistent

Concepts

consisTent comes with 2 types of validators (testers)

syntactic validators

This type of validators is used to do static assertions of the LLM output. for example validating if the output is in a certain JSON format and assert the schema. You can also use syntactic validators to assert something is a valid piece of code (JS or Python are supported at the moment)

Syntactic validators are used to assert the FORM of the response

example

consisTent.JsValidator().validate('console.log("Im a JS program!")')

consisTent.PyValidator().validate('print("Im a python program!")')

consisTent.JsonValidator().validate('{"question": "is this a valid JSON?"}')

syntactic validators

This type of validators is used to assert the quality of the response with more "soft" parameters for example, check if something is factually correct, check for hallucinations, check for labels like "funny"/"interesting" etc... another type of semantic validator is the semantic consistency validator where you provide a seed of validated input and a threshold, and the test will assert the semantic distance of the new output from the seed cluster.

Semantic validators are used to assert the CONTENT of the response

example

import consisTent

seed = [
    "the cat sat on the mat",
    "the feline layed on the carpet",
]


consisTent.ConsistencyValidator(
    seed_size=2,
    consistency_threshold=0.5,
).validate(
    seed=seed,
    model_output="the dog sat on the mat",
)

Label Test

OPENAI_KEY = "XXXXXXXXXXXXXXX"

consisTent.LabelsValidator(openai_key=OPENAI_KEY).validate(
    labels=[
        "funny",
        "short",
        "about rabbits",
    ],
    model_output="What do you call a rabbit that tells jokes? A funny bunny!",
)

facts validation

OPENAI_KEY = "XXXXXXXXXXXXXXX"

consisTent.FactsValidator(openai_key=OPENAI_KEY).validate(
    facts=["this car weighs 1000KG"],
    model_output="I can lift this car",
)

Release files for consistent 0.0.10

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

Source distribution (sdist)

Source distribution for consistent 0.0.10
File Size Uploaded
consistent-0.0.10.tar.gz 8.5 kB Details

Built distribution (wheel)

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

Total release size: 19.0 kB

Release files / consistent-0.0.10.tar.gz

Download URL consistent-0.0.10.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ee674a4721eb23e8aea3c65d3ae17abb9725e7c1cc127cc4747d7333e0059e78
BLAKE2b-256 checksum
How to use checksums
d563d00eb436be523b5a88f96316032e6f545f2802814c373079651dd85791f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / consistent-0.0.10-py3-none-any.whl

Download URL consistent-0.0.10-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97312c05b6eaa77a8fa3843929801b1f5c0ed56d34778d3aafeec6043ee2cdaa
BLAKE2b-256 checksum
How to use checksums
bf70aa4691b4bdc59de3289e796bf0563f6a7a8907814446c8be36eaf06053ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 release files

0.0.9

2 release files

0.0.7

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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