pguard-llm
Prompt version control and A/B testing for LLM applications.
pip install pguard-llm
The Problem
You tweak a prompt. It gets better. You tweak it again. Now you don't remember what changed, which version was best, or how much each version costs to run.
pguard-llm fixes this — version your prompts, run them, compare them.
Quick Start
from pguard import Prompt
p = Prompt("summarize")
# Save versions
p.save("v1", "Summarize this: {text}", description="Simple")
p.save("v2", "In 3 bullet points, summarize: {text}", description="Structured")
# Run against an LLM
result = p.run(
"v1",
provider="openai",
model="gpt-4o",
api_key="sk-...",
input_vars={"text": "Your article text here..."}
)
print(result.output)
print(result.cost_usd)
print(result.latency_ms)
# Compare v1 vs v2
comparison = p.compare("v1", "v2")
print(comparison.summary())
Supported Providers
| Provider | Install | Models |
|---|---|---|
| OpenAI | pip install openai |
gpt-4o, gpt-4o-mini, ... |
| Anthropic | pip install anthropic |
claude-sonnet-4, claude-haiku-4 |
| Gemini | pip install google-genai |
gemini-2.5-flash, gemini-1.5-pro |
Install with Provider
pip install "pguard-llm[openai]"
pip install "pguard-llm[anthropic]"
pip install "pguard-llm[gemini]"
pip install "pguard-llm[all]"
Storage Backends
# File storage (default) — zero setup
p = Prompt("summarize", storage="file")
# SQLite — better for querying
p = Prompt("summarize", storage="sqlite")
A/B Comparison
comparison = p.compare("v1", "v2")
summary = comparison.summary()
# summary contains:
# - latency_ms: avg latency per version + winner
# - cost_usd: avg cost per version + winner
# - quality_score: avg quality per version + winner
# - tokens_avg: avg tokens per version
CLI
pguard list # list all prompts
pguard versions summarize # list versions
pguard show summarize v1 # show template
pguard runs summarize v1 # show run history
pguard compare summarize v1 v2 # compare versions
RunResult
result.output # LLM response text
result.cost_usd # Cost in USD
result.latency_ms # Latency in milliseconds
result.tokens_in # Input tokens
result.tokens_out # Output tokens
result.quality_score # Quality score (0-1)
result.provider # Provider used
result.model # Model used
License
MIT
Metadata
Release files for pguard-llm 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pguard_llm-0.1.3.tar.gz | 16.0 kB | Without provenance | Details for pguard_llm-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pguard_llm-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for pguard_llm-0.1.3-py3-none-any.whl |
Total release size: 32.2 kB
Release files / pguard_llm-0.1.3.tar.gz
| Download URL | pguard_llm-0.1.3.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6b5e06414ffd7693c248338396358efe09ad38c0d535c8678d9c2ceb62658f9
|
|
BLAKE2b-256 checksum How to use checksums |
2484ddef5fc27ba47cf83791cfe854adee4a9b3ab4b018b2a3388c546bc0f1b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / pguard_llm-0.1.3-py3-none-any.whl
| Download URL | pguard_llm-0.1.3-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ceb52a2bb35a4caa6dd2890371a8740acc13d93f9aa76edfd30a3d6311004af
|
|
BLAKE2b-256 checksum How to use checksums |
9092fdd679ae946737d5dfae98138b2fb3052b93ff25a5ef52b34fce61d11ba3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for pguard-llm 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.