PromptVC
Promptvc is a lightweight and local tool for Git-like version control and A/B testing of your LLM prompts. It acts as a dev tool and version control, designed to help you find the best prompts before you add it into your workflow. Unlike an excel sheet, this is cleaner. Trust us.
Table of Contents
Why?
Instead of guessing which prompt is better, test them:
- Version A: "Summarize this article: {input}"
- Version B: "Write a 2-sentence summary focusing on key insights: {input}"
See which one actually performs better with your data
Install
pip install promptvc
Quick Start
# step 1. initialize promptvc
promptvc init
# step 2. create two prompt versions
promptvc add summarizer "Summarize this article: {input}"
promptvc commit summarizer "version A - simple"
promptvc add summarizer "Write a 2-sentence summary focusing on key insights: {input}"
promptvc commit summarizer "version B - structured"
# step 3. create and edit your test data in the _samples.jsonn
promptvc init-samples summarizer
# inside your summarizer.json, edit your data. oh and dont forget to input your api keys
# step 4. test
promptvc test summarizer 1 2 --llm openai
Usage
CLI Commands
init: Initialize new repo
add <name> <text>: Add prompt version
commit <name> <msg>: Commit staged version
history <name>: View version history
checkout <name> <version>: Get version text
diff <name> <v1> <v2>: Compare versions
list: List all prompts
init-samples <name>: Create samples file
test <name> <v1> <v2>: Compare versions with LLM
Python API
from promptvc.repo import PromptRepo
import openai
def my_llm(prompt):
response = openai.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": prompt}]
)
return response.choices[0].message.content
# A/B test your prompts
repo = PromptRepo()
samples = [{"input": "Your test data here"}]
results = repo.eval_versions("prompt-name", [1, 2], samples, my_llm)
# compare your outputs
for version_id, result in results.items():
print(f"Version {version_id}:")
for output in result['outputs']:
print(f" {output['output']}")
Full example
# test email writing prompts
promptvc add email-writer "Write a professional email about: {input}"
promptvc commit email-writer "formal version"
promptvc add email-writer "Write a friendly, concise email about: {input}"
promptvc commit email-writer "casual version"
# create your test cases
promptvc init-samples email-writer
# inside your json email-writer_samples.json:
# [
# {"input": "quarterly sales meeting"},
# {"input": "server maintenance window"},
# {"input": "new product launch"}
# ]
# test
promptvc test email-writer 1 2 --llm openai
Config
llm_providers:
openai:
api_key: "your-key-here"
default_model: "gpt-4o-mini"
anthropic:
api_key: "your-key-here"
default_model: "claude-3-sonnet-20240229"
MISC
Tests
For tests conducted, refer to TEST.md
Tutorial
Refer to TUTORIAL.md
Contribution
Refer to CONTRIBUTING.md
FAQ
- Can the library do live interactive testing?
A: The library is not built for live, interactive testing. The Pipeline class can only test a pre-scripted sequence of turns, not a dynamic one. The purpose of this tool is to bring version control and A/B testing to the foundational, single-turn prompts.
- Does it work with any LLM? A: Works with OpenAI, Anthropic for now
Metadata
Release files for promptvc 0.0.1
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 | |
|---|---|---|---|---|
| promptvc-0.0.1.tar.gz | 16.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| promptvc-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.4 kB
Release files / promptvc-0.0.1.tar.gz
| Download URL | promptvc-0.0.1.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
efdf11af1c89de91fc516b229b4639855c4fb69e91f52f550907d2dd6bde9378
|
|
BLAKE2b-256 checksum How to use checksums |
8c3519e83e12510acb57d2911c0b3c8d4cc63ebfee407011d3c541e0e38629ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Release files / promptvc-0.0.1-py3-none-any.whl
| Download URL | promptvc-0.0.1-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a457ac590b259483818573014d02a2f996d406081bf74c1227813f58824dca9
|
|
BLAKE2b-256 checksum How to use checksums |
8a0708804abb54f7a3c4760d4d5a834883ff0c2526debe454a0642af4d7e4add
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Security for promptvc 0.0.1
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.