Skip to main content

Async LLM benchmarking library with protocol-based extensibility

Project description

promptum

Python 3.13+ Async License: MIT

Test LLMs Like a Pro.

Stop writing boilerplate to test LLMs. Start getting results.


What's This?

You're choosing between GPT-4, Claude, and Gemini for your product. You need to know which one actually handles your prompts better — not some generic benchmark, but your real tasks, your edge cases, your expected formats.

promptum turns that into a few lines of Python. One client for 100+ models, automatic retries, latency/cost/token tracking, structured validation — all async, all typed, zero config files.

session = Session(provider=client, name="my_test")
session.add_test(Prompt(
    name="basic_math",
    prompt="What is 2+2?",
    model="openai/gpt-3.5-turbo",
    validator=Contains("4"),
))
report = await session.run()
summary = report.get_summary()

No YAML. No inheritance hierarchies. Just Python you can read in 30 seconds.


Quick Start

pip install promptum  # (or: uv pip install promptum)
export OPENROUTER_API_KEY="your-key"
import asyncio
from promptum import Session, Prompt, OpenRouterClient, Contains

async def main():
    async with OpenRouterClient(api_key="your-key") as client:
        session = Session(provider=client, name="quick_test")

        session.add_test(Prompt(
            name="basic_math",
            prompt="What is 15 * 7? Reply with just the number.",
            model="openai/gpt-3.5-turbo",
            validator=Contains("105"),
        ))

        report = await session.run()
        summary = report.get_summary()

        print(f"Passed: {summary.passed}/{summary.total}")
        print(f"Avg latency: {summary.avg_latency_ms:.0f}ms")
        print(f"Total cost: ${summary.total_cost_usd:.6f}")

asyncio.run(main())

Why promptum?

Most LLM testing is ad-hoc scripts that grow into unmaintainable messes. You end up with separate API clients per provider, hand-rolled retry logic, manual latency tracking, and validation scattered across files.

promptum replaces all of that with a single coherent API:

  • 100+ Models via OpenRouter — one client for OpenAI, Anthropic, Google, and more
  • Smart Validation — ExactMatch, Contains, Regex, JsonSchema, or write your own
  • Automatic Retries — exponential/fixed-delay backoff with configurable attempts
  • Metrics Tracking — latency, tokens, cost — automatically captured
  • Async by Default — run tests in parallel with concurrency control
  • Protocol-Based — extend with custom providers and validators, no inheritance needed
  • Type Safe — full type hints, catches errors before runtime

Documentation

  • Session & Testing — Session, Prompt, Report, Summary, TestResult
  • Providers — LLMProvider protocol, OpenRouterClient, Metrics, Retry, Exceptions
  • Validation — Validator protocol, ExactMatch, Contains, Regex, JsonSchema

Requirements

  • Python 3.13+
  • An OpenRouter API key (or implement your own provider)

Contributing

Found a bug? Want a feature? PRs welcome!

git clone https://github.com/deyna256/promptum.git
cd promptum
just sync       # Install dependencies
just test       # Run tests
just lint       # Check code style
just format     # Format code
just typecheck  # Type checking

License

MIT - do whatever you want with it.


Star on GitHub | Report Bug | Request Feature

Made for developers who value their time.

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

promptum-0.0.7.tar.gz (36.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

promptum-0.0.7-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file promptum-0.0.7.tar.gz.

File metadata

  • Download URL: promptum-0.0.7.tar.gz
  • Upload date:
  • Size: 36.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for promptum-0.0.7.tar.gz
Algorithm Hash digest
SHA256 7013c6dd6a1196ffd054e6c1c05c7ce0d6c5e4135e74a5229b3c526eed850fac
MD5 755c684644db9453e42cbc9ad8e05a72
BLAKE2b-256 6dbd9331f68dd042844dd99771c594d99fc7a9e6db649791aa5c900edf5c4d97

See more details on using hashes here.

Provenance

The following attestation bundles were made for promptum-0.0.7.tar.gz:

Publisher: publish.yml on deyna256/promptum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file promptum-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: promptum-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for promptum-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 07064a5c926e5846581c4dbff51f18758842599b2aeb7a359b0bad7768044e6d
MD5 d7aeaf4473a2894bf54bd2e7c295951e
BLAKE2b-256 8a1779575bbbe1f9e7b98ce8fac873bd93adddff57f31fff47acf1aef83854b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for promptum-0.0.7-py3-none-any.whl:

Publisher: publish.yml on deyna256/promptum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page